CNAS取数仪器端升级
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

frmDatabaseParams.cs 43KB

5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  1. using CnasSynchronusClient;
  2. using CnasSynchrousModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Windows.Forms;
  12. using System.Xml.Serialization;
  13. namespace CNAS_DBSync
  14. {
  15. public delegate void InstrumentItemDataHanlder(Dictionary<string,DataTable> dictInstrument);
  16. public partial class frmDatabaseParams : Form
  17. {
  18. public SyncInstrumentItemInfo syncInstrumentItem = new SyncInstrumentItemInfo(); //仪器信息项
  19. public Dictionary<string, DataTable> dictInstrument = new Dictionary<string, DataTable>();
  20. public DataBaseInfo dataBaseInfo = new DataBaseInfo(); //数据库
  21. public InstumentCodeHanlder InstrumentDelegate; //传递仪器编码委托
  22. public InstrumentItemDataHanlder InstrumentItemData; //传递仪器项委托
  23. private string strReadExcelMode = ""; //读取Excel数据模式
  24. private string strReadFoxproMode = ""; //读取Foxpro数据模式
  25. private string strReadTxtMode = "";//读取Txt数据模式
  26. public frmDatabaseParams(SyncInstrumentItemInfo syncInstrumentItem)
  27. {
  28. InitializeComponent();
  29. this.syncInstrumentItem = syncInstrumentItem;
  30. //读取Excel和FoxPro的模式
  31. strReadExcelMode = FileOperation.GetFormatConfigData<ExcelFormatConfig>("ExcelFormatConfig.xml").ReadExcelFileMode;
  32. strReadFoxproMode = FileOperation.GetFormatConfigData<FoxProFormatConfig>("FoxProFormatConfig.xml").ReadFoxProFileMode;
  33. strReadTxtMode = FileOperation.GetFormatConfigData<NormalFileFormatConfig>("NormalFileFormatConfig.xml").ReadNormalFileMode;
  34. }
  35. private void frmDatabaseParams_Load(object sender, EventArgs e)
  36. {
  37. if (strReadExcelMode == "0")
  38. tabExcel.Text = "Excel(文件)";
  39. else
  40. tabExcel.Text= "Excel(文件夹)";
  41. if (strReadFoxproMode == "0")
  42. tabFoxPro.Text = "Foxpro(文件)";
  43. else
  44. tabFoxPro.Text= "Foxpro(文件夹)";
  45. if (strReadTxtMode == "0")
  46. tabTxt.Text = "TXT(文件)";
  47. else
  48. tabTxt.Text = "TXT(文件夹)";
  49. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  50. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  51. //如果有旧值,加载旧的值
  52. switch (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType)
  53. {
  54. case DataSourceType.Excel:
  55. this.tabcDS.SelectedIndex = 0;
  56. this.txtInportExcel.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path;
  57. this.cbxExcelRemote.Checked= syncInstrumentItem.SyncInstrumentDSInfo.DsPathType == PathType.Local ? false : true;
  58. this.txtRemoteExcelUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser;
  59. this.txtRemoteExcelPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd;
  60. break;
  61. case DataSourceType.FoxPro:
  62. this.tabcDS.SelectedIndex = 1;
  63. this.txtFoxProFolder.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path;
  64. this.txtFoxProUserId.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  65. this.txtFoxProPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  66. this.cbxFoxProRemote.Checked = syncInstrumentItem.SyncInstrumentDSInfo.DsPathType == PathType.Local ? false : true;
  67. this.txtRemoteFoxProUserId.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser;
  68. this.txtRemoteFoxProPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd;
  69. break;
  70. case DataSourceType.Access:
  71. this.tabcDS.SelectedIndex = 2;
  72. this.txtAccessPath.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path;
  73. this.txtAccessUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  74. this.txtAceessPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  75. this.cbxAccessRemote.Checked = syncInstrumentItem.SyncInstrumentDSInfo.DsPathType == PathType.Local ? false : true;
  76. this.txtAccessRemoteUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser;
  77. this.txtAccessRemotePwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd;
  78. break;
  79. case DataSourceType.SQLLite:
  80. this.tabcDS.SelectedIndex = 3;
  81. this.txtSqlitePath.Text= syncInstrumentItem.SyncInstrumentDSInfo.Path;
  82. this.txtSqliteUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  83. this.txtSqlitePwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  84. this.cbxSqliteRemote.Checked = syncInstrumentItem.SyncInstrumentDSInfo.DsPathType == PathType.Local ? false : true;
  85. this.txtSqliteRemoteUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser;
  86. this.txtSqliteRemotePwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd;
  87. break;
  88. case DataSourceType.SQL:
  89. this.tabcDS.SelectedIndex = 4;
  90. this.txtSqlServerHost.Text = syncInstrumentItem.SyncInstrumentDSInfo.Host;
  91. this.txtSqlServerName.Text = syncInstrumentItem.SyncInstrumentDSInfo.ServerName;
  92. this.txtSqlServerUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  93. this.txtSqlServerPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  94. break;
  95. case DataSourceType.MySQL:
  96. this.tabcDS.SelectedIndex = 5;
  97. this.txtMySqlHost.Text= syncInstrumentItem.SyncInstrumentDSInfo.Host;
  98. this.txtMySqlServer.Text = syncInstrumentItem.SyncInstrumentDSInfo.ServerName;
  99. this.txtMySqlUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  100. this.txtMySqlPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  101. this.txtMySqlPort.Text = syncInstrumentItem.SyncInstrumentDSInfo.Port ;
  102. break;
  103. case DataSourceType.Oracle:
  104. this.tabcDS.SelectedIndex = 6;
  105. this.txtOracleHost.Text = syncInstrumentItem.SyncInstrumentDSInfo.Host ;
  106. this.txtOracleSource.Text = syncInstrumentItem.SyncInstrumentDSInfo.ServerName;
  107. this.txtOracleUserId.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
  108. this.txtOraclePwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
  109. this.txtOraclePort.Text = syncInstrumentItem.SyncInstrumentDSInfo.Port;
  110. break;
  111. case DataSourceType.TXT:
  112. this.tabcDS.SelectedIndex = 7;
  113. this.txtInportTxt.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path;
  114. this.cbxRemoteTxt.Checked = syncInstrumentItem.SyncInstrumentDSInfo.DsPathType == PathType.Local ? false : true;
  115. this.txtRemoteTxtUserId.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser;
  116. this.txtRemoteTxtPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd;
  117. break;
  118. default:
  119. break;
  120. }
  121. //加载旧的CNAS数据库信息
  122. if (syncInstrumentItem.SyncTargetDBInfo == null)
  123. syncInstrumentItem.SyncTargetDBInfo = new DataBaseInfo();
  124. this.txtDBHost.Text = syncInstrumentItem.SyncTargetDBInfo.DBHost;
  125. this.txtDBName.Text = syncInstrumentItem.SyncTargetDBInfo.DBName;
  126. this.txtDBUser.Text = syncInstrumentItem.SyncTargetDBInfo.DBUser;
  127. this.txtDBPwd.Text = syncInstrumentItem.SyncTargetDBInfo.DBPwd;
  128. this.txtPort.Text= syncInstrumentItem.SyncTargetDBInfo.DBPort;
  129. }
  130. private void btnOK_Click(object sender, EventArgs e)
  131. {
  132. //点击确定按钮
  133. //InstrumentData instrumentData = null;
  134. switch (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType)
  135. {
  136. case DataSourceType.Access:
  137. syncInstrumentItem.SyncInstrumentDSInfo.Path = this.txtAccessPath.Text.Trim();
  138. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  139. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  140. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtAccessUser.Text.Trim();
  141. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtAceessPwd.Text.Trim();
  142. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = this.cbxAccessRemote.Checked ? PathType.Remote : PathType.Local;
  143. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = this.txtAccessRemoteUser.Text.Trim();
  144. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = this.txtAccessRemotePwd.Text.Trim();
  145. break;
  146. case DataSourceType.SQLLite:
  147. syncInstrumentItem.SyncInstrumentDSInfo.Path = this.txtSqlitePath.Text.Trim();
  148. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  149. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  150. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtSqliteUser.Text.Trim();
  151. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtSqlitePwd.Text.Trim();
  152. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = this.cbxSqliteRemote.Checked ? PathType.Remote : PathType.Local;
  153. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = this.txtSqliteRemoteUser.Text.Trim();
  154. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = this.txtSqliteRemotePwd.Text.Trim();
  155. break;
  156. case DataSourceType.SQL:
  157. syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtSqlServerHost.Text.Trim();
  158. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = this.txtSqlServerName.Text.Trim();
  159. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtSqlServerUser.Text.Trim();
  160. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtSqlServerPwd.Text.Trim();
  161. break;
  162. case DataSourceType.MySQL:
  163. syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtMySqlHost.Text.Trim();
  164. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = this.txtMySqlServer.Text.Trim();
  165. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtMySqlUser.Text.Trim();
  166. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtMySqlPwd.Text.Trim();
  167. syncInstrumentItem.SyncInstrumentDSInfo.Port = this.txtMySqlPort.Text.Trim();
  168. break;
  169. case DataSourceType.Oracle:
  170. syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtOracleHost.Text.Trim();
  171. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = this.txtOracleSource.Text.Trim();
  172. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtOracleUserId.Text.Trim();
  173. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtOraclePwd.Text.Trim();
  174. syncInstrumentItem.SyncInstrumentDSInfo.Port = this.txtOraclePort.Text.Trim();
  175. break;
  176. case DataSourceType.FoxPro:
  177. syncInstrumentItem.SyncInstrumentDSInfo.Path = this.txtFoxProFolder.Text.Trim();
  178. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  179. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  180. syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtFoxProUserId.Text.Trim();
  181. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtFoxProPwd.Text.Trim();
  182. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = this.cbxFoxProRemote.Checked ? PathType.Remote : PathType.Local;
  183. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = this.txtRemoteFoxProUserId.Text.Trim();
  184. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = this.txtRemoteFoxProPwd.Text.Trim();
  185. break;
  186. case DataSourceType.TXT:
  187. syncInstrumentItem.SyncInstrumentDSInfo.Path = this.txtInportTxt.Text.Trim();
  188. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  189. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  190. syncInstrumentItem.SyncInstrumentDSInfo.UserId = "";
  191. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = "";
  192. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = this.cbxRemoteTxt.Checked ? PathType.Remote : PathType.Local;
  193. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = this.txtRemoteTxtUserId.Text.Trim();
  194. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = this.txtRemoteTxtPwd.Text.Trim();
  195. break;
  196. case DataSourceType.Excel:
  197. default:
  198. syncInstrumentItem.SyncInstrumentDSInfo.Path = this.txtInportExcel.Text.Trim();
  199. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  200. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  201. syncInstrumentItem.SyncInstrumentDSInfo.UserId = "";
  202. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = "";
  203. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = this.cbxExcelRemote.Checked ? PathType.Remote : PathType.Local;
  204. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = this.txtRemoteExcelUser.Text.Trim();
  205. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = this.txtRemoteExcelPwd.Text.Trim();
  206. break;
  207. }
  208. object[] obj = new object[] { "", "", "" };
  209. //instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo, obj);
  210. //dictInstrument = instrumentData.GetInstrumentData();
  211. //目标库的信息
  212. syncInstrumentItem.SyncTargetDBInfo.DBHost = this.txtDBHost.Text.Trim();
  213. syncInstrumentItem.SyncTargetDBInfo.DBName = this.txtDBName.Text.Trim();
  214. syncInstrumentItem.SyncTargetDBInfo.DBUser = this.txtDBUser.Text.Trim();
  215. syncInstrumentItem.SyncTargetDBInfo.DBPwd = this.txtDBPwd.Text.Trim();
  216. syncInstrumentItem.SyncTargetDBInfo.DBPort = this.txtPort.Text.Trim();
  217. this.InstrumentDelegate(syncInstrumentItem);
  218. //this.InstrumentItemData(dictInstrument);
  219. this.Close();
  220. }
  221. private void btnOpenFileExcel_Click(object sender, EventArgs e)
  222. {
  223. if (syncInstrumentItem.Code == null) return;
  224. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  225. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  226. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Excel;
  227. if (strReadExcelMode == "0")
  228. {
  229. OpenFileDialog openFile = new OpenFileDialog
  230. {
  231. Filter = "Excel(*.xlsx)|*.xlsx|Excel(*.xls)|*.xls",
  232. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  233. Multiselect = false
  234. };
  235. if (openFile.ShowDialog() == DialogResult.Cancel) return;
  236. this.txtInportExcel.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = openFile.FileName;
  237. string fileType = System.IO.Path.GetExtension(openFile.FileName);
  238. if (string.IsNullOrEmpty(fileType)) return;
  239. }
  240. else
  241. {
  242. FolderBrowserDialog dialog = new FolderBrowserDialog();
  243. dialog.Description = "请选择文件路径";
  244. if (dialog.ShowDialog() == DialogResult.Cancel) return;
  245. this.txtInportExcel.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = dialog.SelectedPath;
  246. }
  247. }
  248. private void tabcDS_Selected(object sender, TabControlEventArgs e)
  249. {
  250. //切换的时候,检查其他类型数据源是否有值,如果有值,将提示删除旧值才能配置新值
  251. if (e.TabPage == tabExcel)
  252. {
  253. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  254. if (!CheckAccessControl() || !CheckSQLiteControl()|| !CheckSQLServerControl()||!CheckMySqlControl() || !CheckOracleControl()||!CheckFoxproControl()||!CheckTxtControl())
  255. {
  256. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  257. {
  258. ClearAccessControl();
  259. ClearSqliteControl();
  260. ClearSQLServerControl();
  261. ClearMySQLControl();
  262. ClearOracleControl();
  263. ClearFoxproControl();
  264. ClearTxtControl();
  265. ClearObjectValue();
  266. }
  267. else
  268. {
  269. ChangeSelectTabPageByType();
  270. return;
  271. }
  272. }
  273. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Excel;
  274. }
  275. if (e.TabPage == tabAccess)
  276. {
  277. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  278. if (!CheckExcelControl() || !CheckSQLiteControl() || !CheckSQLServerControl() || !CheckMySqlControl() || !CheckOracleControl() || !CheckFoxproControl() || !CheckTxtControl())
  279. {
  280. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  281. {
  282. ClearExcelControl();
  283. ClearSqliteControl();
  284. ClearSQLServerControl();
  285. ClearMySQLControl();
  286. ClearOracleControl();
  287. ClearFoxproControl();
  288. ClearTxtControl();
  289. ClearObjectValue();
  290. }
  291. else
  292. {
  293. ChangeSelectTabPageByType();
  294. return;
  295. }
  296. }
  297. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Access;
  298. }
  299. if (e.TabPage == tabSQLite)
  300. {
  301. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  302. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLServerControl() || !CheckMySqlControl() || !CheckOracleControl() || !CheckFoxproControl() || !CheckTxtControl())
  303. {
  304. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  305. {
  306. ClearAccessControl();
  307. ClearExcelControl();
  308. ClearSQLServerControl();
  309. ClearMySQLControl();
  310. ClearOracleControl();
  311. ClearFoxproControl();
  312. ClearTxtControl();
  313. ClearObjectValue();
  314. }
  315. else
  316. {
  317. ChangeSelectTabPageByType();
  318. return;
  319. }
  320. }
  321. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.SQLLite;
  322. }
  323. if (e.TabPage == tabSQLServer)
  324. {
  325. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  326. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || !CheckMySqlControl() || !CheckOracleControl() || !CheckFoxproControl() || !CheckTxtControl())
  327. {
  328. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  329. {
  330. ClearAccessControl();
  331. ClearExcelControl();
  332. ClearSqliteControl();
  333. ClearMySQLControl();
  334. ClearOracleControl();
  335. ClearFoxproControl();
  336. ClearTxtControl();
  337. ClearObjectValue();
  338. }
  339. else
  340. {
  341. ChangeSelectTabPageByType();
  342. return;
  343. }
  344. }
  345. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.SQL;
  346. }
  347. if (e.TabPage == tabMySql)
  348. {
  349. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  350. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || !CheckSQLServerControl()||!CheckOracleControl() || !CheckFoxproControl() || !CheckTxtControl())
  351. {
  352. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  353. {
  354. ClearAccessControl();
  355. ClearExcelControl();
  356. ClearSqliteControl();
  357. ClearSQLServerControl();
  358. ClearOracleControl();
  359. ClearFoxproControl();
  360. ClearTxtControl();
  361. ClearObjectValue();
  362. }
  363. else
  364. {
  365. ChangeSelectTabPageByType();
  366. return;
  367. }
  368. }
  369. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.MySQL;
  370. }
  371. if (e.TabPage == tabOracle)
  372. {
  373. //检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
  374. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || !CheckSQLServerControl()||!CheckMySqlControl() || !CheckFoxproControl() || !CheckTxtControl())
  375. {
  376. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  377. {
  378. ClearAccessControl();
  379. ClearExcelControl();
  380. ClearSqliteControl();
  381. ClearSQLServerControl();
  382. ClearMySQLControl();
  383. ClearFoxproControl();
  384. ClearTxtControl();
  385. ClearObjectValue();
  386. }
  387. else
  388. {
  389. ChangeSelectTabPageByType();
  390. return;
  391. }
  392. }
  393. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Oracle;
  394. }
  395. if (e.TabPage == tabFoxPro)
  396. {
  397. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || !CheckSQLServerControl() || !CheckMySqlControl() || !CheckOracleControl() || !CheckTxtControl())
  398. {
  399. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  400. {
  401. ClearAccessControl();
  402. ClearExcelControl();
  403. ClearSqliteControl();
  404. ClearSQLServerControl();
  405. ClearMySQLControl();
  406. ClearOracleControl();
  407. ClearTxtControl();
  408. ClearObjectValue();
  409. }
  410. else
  411. {
  412. ChangeSelectTabPageByType();
  413. return;
  414. }
  415. }
  416. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.FoxPro;
  417. }
  418. if (e.TabPage == tabTxt)
  419. {
  420. if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || !CheckSQLServerControl() || !CheckMySqlControl() || !CheckOracleControl() || !CheckFoxproControl())
  421. {
  422. if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
  423. {
  424. ClearAccessControl();
  425. ClearExcelControl();
  426. ClearSqliteControl();
  427. ClearSQLServerControl();
  428. ClearMySQLControl();
  429. ClearOracleControl();
  430. ClearFoxproControl();
  431. ClearObjectValue();
  432. }
  433. else
  434. {
  435. ChangeSelectTabPageByType();
  436. return;
  437. }
  438. }
  439. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.TXT;
  440. }
  441. }
  442. //根据数据源类型切换Tab页
  443. private void ChangeSelectTabPageByType()
  444. {
  445. switch (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType)
  446. {
  447. case DataSourceType.SQLLite:
  448. tabcDS.SelectedTab = tabSQLite;
  449. break;
  450. case DataSourceType.Access:
  451. tabcDS.SelectedTab = tabAccess;
  452. break;
  453. case DataSourceType.SQL:
  454. tabcDS.SelectedTab = tabSQLServer;
  455. break;
  456. case DataSourceType.Oracle:
  457. tabcDS.SelectedTab=tabOracle;
  458. break;
  459. case DataSourceType.FoxPro:
  460. tabcDS.SelectedTab = tabFoxPro;
  461. break;
  462. case DataSourceType.TXT:
  463. tabcDS.SelectedTab = tabTxt;
  464. break;
  465. case DataSourceType.Excel:
  466. default:
  467. tabcDS.SelectedTab = tabExcel;
  468. break;
  469. }
  470. }
  471. private bool CheckExcelControl()
  472. {
  473. if (this.txtInportExcel.Text != "")
  474. return false;
  475. else
  476. return true;
  477. }
  478. private bool CheckAccessControl()
  479. {
  480. if (this.txtAccessPath.Text != "" || this.txtAccessUser.Text != "" || this.txtAceessPwd.Text != "")
  481. return false;
  482. else
  483. return true;
  484. }
  485. private bool CheckSQLiteControl()
  486. {
  487. if (this.txtSqlitePath.Text != "" || this.txtSqliteUser.Text != "" || this.txtSqlitePwd.Text != "")
  488. return false;
  489. else
  490. return true;
  491. }
  492. private bool CheckSQLServerControl()
  493. {
  494. if (this.txtSqlServerHost.Text.Trim() != "" || this.txtSqlServerName.Text.Trim() != "" || this.txtSqlServerPwd.Text.Trim() != "" || this.txtSqlServerUser.Text.Trim() != "")
  495. return false;
  496. else
  497. return true;
  498. }
  499. private bool CheckMySqlControl()
  500. {
  501. if (this.txtMySqlHost.Text.Trim() != "" || this.txtMySqlServer.Text.Trim() != "" || this.txtMySqlUser.Text.Trim() != "" || this.txtMySqlPwd.Text.Trim() != ""|| this.txtMySqlPort.Text.Trim()!="")
  502. return false;
  503. else
  504. return true;
  505. }
  506. private bool CheckOracleControl()
  507. {
  508. if (this.txtOraclePort.Text.Trim() != "" || this.txtOraclePwd.Text.Trim() != ""||this.txtOracleHost.Text.Trim()!="" || this.txtOracleSource.Text.Trim() != "" || this.txtOracleUserId.Text.Trim() != "")
  509. return false;
  510. else
  511. return true;
  512. }
  513. private bool CheckFoxproControl()
  514. {
  515. if (this.txtFoxProFolder.Text.Trim() != "" || this.txtFoxProUserId.Text.Trim() != "" || this.txtFoxProPwd.Text.Trim() != "" || this.txtRemoteFoxProUserId.Text.Trim() != "" || this.txtRemoteFoxProPwd.Text.Trim() != "")
  516. {
  517. return false;
  518. }
  519. else
  520. return true;
  521. }
  522. private bool CheckTxtControl()
  523. {
  524. if (this.txtInportTxt.Text.Trim() != "" || this.txtRemoteTxtUserId.Text.Trim() != "" || this.txtRemoteTxtPwd.Text.Trim() != "")
  525. return false;
  526. else
  527. return true;
  528. }
  529. private void btnCNASTestLink_Click(object sender, EventArgs e)
  530. {
  531. if(CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtDBHost.Text.Trim(), this.txtDBName.Text.Trim(), this.txtDBUser.Text.Trim(), this.txtDBPwd.Text.Trim(),this.txtPort.Text.Trim()))
  532. MessageBox.Show("连接成功!");
  533. else
  534. MessageBox.Show("连接失败!");
  535. }
  536. private void ClearExcelControl()
  537. {
  538. this.txtInportExcel.Text = "";
  539. this.txtRemoteExcelUser.Text = "";
  540. this.txtRemoteExcelPwd.Text = "";
  541. }
  542. private void ClearAccessControl()
  543. {
  544. this.txtAccessPath.Text = "";
  545. this.txtAccessUser.Text = "";
  546. this.txtAceessPwd.Text = "";
  547. this.txtAccessRemoteUser.Text = "";
  548. this.txtAccessRemotePwd.Text = "";
  549. }
  550. private void ClearSqliteControl()
  551. {
  552. this.txtSqliteUser.Text = "";
  553. this.txtSqlitePath.Text = "";
  554. this.txtSqlitePwd.Text = "";
  555. this.txtSqliteRemoteUser.Text = "";
  556. this.txtSqliteRemotePwd.Text = "";
  557. }
  558. private void ClearSQLServerControl()
  559. {
  560. this.txtSqlServerHost.Text = "";
  561. this.txtSqlServerName.Text = "";
  562. this.txtSqlServerUser.Text = "";
  563. this.txtSqlServerPwd.Text = "";
  564. }
  565. private void ClearMySQLControl()
  566. {
  567. this.txtMySqlHost.Text = "";
  568. this.txtMySqlServer.Text = "";
  569. this.txtMySqlUser.Text = "";
  570. this.txtMySqlPwd.Text = "";
  571. this.txtMySqlPort.Text = "";
  572. }
  573. private void ClearOracleControl()
  574. {
  575. this.txtOracleHost.Text = "";
  576. this.txtOracleSource.Text = "";
  577. this.txtOracleUserId.Text = "";
  578. this.txtOraclePwd.Text = "";
  579. this.txtOraclePort.Text = "";
  580. }
  581. private void ClearFoxproControl()
  582. {
  583. this.txtFoxProFolder.Text = "";
  584. this.txtFoxProUserId.Text = "";
  585. this.txtFoxProPwd.Text = "";
  586. this.txtRemoteFoxProUserId.Text = "";
  587. this.txtRemoteFoxProPwd.Text = "";
  588. }
  589. private void ClearTxtControl()
  590. {
  591. this.txtInportTxt.Text = "";
  592. this.txtRemoteTxtUserId.Text = "";
  593. this.txtRemoteTxtPwd.Text = "";
  594. }
  595. /// <summary>
  596. /// 清空对象中存储的值
  597. /// </summary>
  598. private void ClearObjectValue()
  599. {
  600. syncInstrumentItem.SyncInstrumentDSInfo.Host = "";
  601. syncInstrumentItem.SyncInstrumentDSInfo.ServerName = "";
  602. syncInstrumentItem.SyncInstrumentDSInfo.Path = "";
  603. syncInstrumentItem.SyncInstrumentDSInfo.UserId = "";
  604. syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = "";
  605. syncInstrumentItem.SyncInstrumentDSInfo.Port = "";
  606. syncInstrumentItem.SyncInstrumentDSInfo.DsPathType = PathType.Local;
  607. syncInstrumentItem.SyncInstrumentDSInfo.RemoteUser = "";
  608. syncInstrumentItem.SyncInstrumentDSInfo.RemotePwd = "";
  609. }
  610. private void btnOpenFileAccess_Click(object sender, EventArgs e)
  611. {
  612. if (syncInstrumentItem.Code == null) return;
  613. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  614. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  615. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Access;
  616. OpenFileDialog openFile = new OpenFileDialog
  617. {
  618. Filter = "Microsoft Access(*.mdb)|*.mdb",
  619. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  620. Multiselect = false
  621. };
  622. if (openFile.ShowDialog() == DialogResult.Cancel) return;
  623. this.txtAccessPath.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = openFile.FileName;
  624. string fileType = System.IO.Path.GetExtension(openFile.FileName);
  625. if (string.IsNullOrEmpty(fileType)) return;
  626. }
  627. private void btnOpenFileSQLite_Click(object sender, EventArgs e)
  628. {
  629. if (syncInstrumentItem.Code == null) return;
  630. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  631. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  632. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.SQLLite;
  633. OpenFileDialog openFile = new OpenFileDialog
  634. {
  635. Filter = "SQLite(*.db)|*.db",
  636. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  637. Multiselect = false
  638. };
  639. if (openFile.ShowDialog() == DialogResult.Cancel) return;
  640. this.txtSqlitePath.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = openFile.FileName;
  641. string fileType = System.IO.Path.GetExtension(openFile.FileName);
  642. if (string.IsNullOrEmpty(fileType)) return;
  643. }
  644. private void btnTestSQLLink_Click(object sender, EventArgs e)
  645. {
  646. if (this.txtSqlServerHost.Text.Trim() == "" || this.txtSqlServerName.Text.Trim() == "" || this.txtSqlServerUser.Text.Trim() == "")
  647. {
  648. MessageBox.Show("请填写相关连接信息。");
  649. return;
  650. }
  651. InstrumentDataSourceInfo dbinfo = new InstrumentDataSourceInfo();
  652. dbinfo.Host = this.txtSqlServerHost.Text.Trim();
  653. dbinfo.ServerName = this.txtSqlServerName.Text.Trim();
  654. dbinfo.UserId = this.txtSqlServerUser.Text.Trim();
  655. dbinfo.UserPwd = this.txtSqlServerPwd.Text.Trim();
  656. if (new SQLServerInstrumentData(dbinfo, new object[] {
  657. "",
  658. "",
  659. ""
  660. }).TestSQLServerLink())
  661. MessageBox.Show("连接成功!");
  662. else
  663. MessageBox.Show("连接失败!");
  664. }
  665. private void cbxExcelRemote_CheckedChanged(object sender, EventArgs e)
  666. {
  667. if (!cbxExcelRemote.Checked)
  668. {
  669. this.btnOpenFileExcel.Visible = true;
  670. lblExcelRemotePwd.Visible = false;
  671. lblExcelRemoteUser.Visible = false;
  672. txtRemoteExcelUser.Visible = false;
  673. txtRemoteExcelPwd.Visible = false;
  674. }
  675. else
  676. {
  677. this.btnOpenFileExcel.Visible = false;
  678. lblExcelRemotePwd.Visible = true;
  679. lblExcelRemoteUser.Visible = true;
  680. txtRemoteExcelUser.Visible = true;
  681. txtRemoteExcelPwd.Visible = true;
  682. }
  683. }
  684. private void cbxAccessRemote_CheckedChanged(object sender, EventArgs e)
  685. {
  686. if (cbxAccessRemote.Checked)
  687. {
  688. btnOpenFileAccess.Visible = false;
  689. lblAccessRemoteUser.Visible = true;
  690. lblAccessRemotePwd.Visible = true;
  691. txtAccessRemoteUser.Visible = true;
  692. txtAccessRemotePwd.Visible = true;
  693. }
  694. else
  695. {
  696. btnOpenFileAccess.Visible = true;
  697. lblAccessRemoteUser.Visible = false;
  698. lblAccessRemotePwd.Visible = false;
  699. txtAccessRemoteUser.Visible = false;
  700. txtAccessRemotePwd.Visible = false;
  701. }
  702. }
  703. private void cbxSqliteRemote_CheckedChanged(object sender, EventArgs e)
  704. {
  705. if (cbxSqliteRemote.Checked)
  706. {
  707. btnOpenFileSQLite.Visible = false;
  708. lblSqliteRemoteUser.Visible = true;
  709. lblSqliteRemotePwd.Visible = true;
  710. txtSqliteRemoteUser.Visible = true;
  711. txtSqliteRemotePwd.Visible = true;
  712. }
  713. else
  714. {
  715. btnOpenFileSQLite.Visible = true;
  716. lblSqliteRemoteUser.Visible = false;
  717. lblSqliteRemotePwd.Visible = false;
  718. txtSqliteRemoteUser.Visible = false;
  719. txtSqliteRemotePwd.Visible = false;
  720. }
  721. }
  722. private void btnMySqlTest_Click(object sender, EventArgs e)
  723. {
  724. if (CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtMySqlHost.Text.Trim(), this.txtMySqlServer.Text.Trim(), this.txtMySqlUser.Text.Trim(), this.txtMySqlPwd.Text.Trim(), this.txtMySqlPort.Text.Trim()))
  725. MessageBox.Show("连接成功!");
  726. else
  727. MessageBox.Show("连接失败!");
  728. }
  729. private void btnOracleTestLink_Click(object sender, EventArgs e)
  730. {
  731. if (this.txtOracleHost.Text.Trim()==""||this.txtOracleSource.Text.Trim() == "" || this.txtOracleUserId.Text.Trim() == ""|| this.txtOraclePort.Text.Trim() == "")
  732. {
  733. MessageBox.Show("请填写相关连接信息。");
  734. return;
  735. }
  736. InstrumentDataSourceInfo dbinfo = new InstrumentDataSourceInfo();
  737. dbinfo.Host = this.txtOracleHost.Text.Trim();
  738. dbinfo.ServerName = this.txtOracleSource.Text.Trim();
  739. dbinfo.UserId = this.txtOracleUserId.Text.Trim();
  740. dbinfo.UserPwd = this.txtOraclePwd.Text.Trim();
  741. dbinfo.Port = this.txtOraclePort.Text.Trim();
  742. if (new OracleInstrumentData(dbinfo, new object[] {
  743. "",
  744. "",
  745. ""
  746. }).TestSQLServerLink())
  747. MessageBox.Show("连接成功!");
  748. else
  749. MessageBox.Show("连接失败!");
  750. }
  751. private void txtFileOpenFoxPro_Click(object sender, EventArgs e)
  752. {
  753. if (syncInstrumentItem.Code == null) return;
  754. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  755. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  756. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.FoxPro;
  757. if (strReadFoxproMode == "0")
  758. {
  759. OpenFileDialog openFile = new OpenFileDialog
  760. {
  761. Filter = "Foxpro文件(*.dbf)|*.dbf",
  762. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  763. Multiselect = false
  764. };
  765. if (openFile.ShowDialog() == DialogResult.Cancel) return;
  766. this.txtFoxProFolder.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = openFile.FileName;
  767. string fileType = System.IO.Path.GetExtension(openFile.FileName);
  768. if (string.IsNullOrEmpty(fileType)) return;
  769. }
  770. else
  771. {
  772. FolderBrowserDialog dialog = new FolderBrowserDialog();
  773. dialog.Description = "请选择文件路径";
  774. if (dialog.ShowDialog() == DialogResult.Cancel) return;
  775. this.txtFoxProFolder.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = dialog.SelectedPath;
  776. }
  777. }
  778. private void cbxFoxProRemote_CheckedChanged(object sender, EventArgs e)
  779. {
  780. if (!cbxFoxProRemote.Checked)
  781. {
  782. this.btnFileOpenFoxPro.Visible = true;
  783. lblFoxproRemoteUserId.Visible = false;
  784. lblFoxproRemotePwd.Visible = false;
  785. txtRemoteFoxProUserId.Visible = false;
  786. txtRemoteFoxProPwd.Visible = false;
  787. }
  788. else
  789. {
  790. this.btnFileOpenFoxPro.Visible = false;
  791. lblFoxproRemoteUserId.Visible = true;
  792. lblFoxproRemotePwd.Visible = true;
  793. txtRemoteFoxProUserId.Visible = true;
  794. txtRemoteFoxProPwd.Visible = true;
  795. }
  796. }
  797. private void btnOpenFileTxt_Click(object sender, EventArgs e)
  798. {
  799. if (syncInstrumentItem.Code == null) return;
  800. if (syncInstrumentItem.SyncInstrumentDSInfo == null)
  801. syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();
  802. syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.TXT;
  803. if (strReadTxtMode == "0")
  804. {
  805. OpenFileDialog openFile = new OpenFileDialog
  806. {
  807. Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*",
  808. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  809. Multiselect = false
  810. };
  811. if (openFile.ShowDialog() == DialogResult.Cancel) return;
  812. this.txtInportTxt.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = openFile.FileName;
  813. string fileType = System.IO.Path.GetExtension(openFile.FileName);
  814. if (string.IsNullOrEmpty(fileType)) return;
  815. }
  816. else
  817. {
  818. FolderBrowserDialog dialog = new FolderBrowserDialog();
  819. dialog.Description = "请选择文件路径";
  820. if (dialog.ShowDialog() == DialogResult.Cancel) return;
  821. this.txtInportTxt.Text = syncInstrumentItem.SyncInstrumentDSInfo.Path = dialog.SelectedPath;
  822. }
  823. }
  824. private void cbxRemoteTxt_CheckedChanged(object sender, EventArgs e)
  825. {
  826. if (!cbxRemoteTxt.Checked)
  827. {
  828. this.btnOpenFileTxt.Visible = true;
  829. lblTxtRemoteUserId.Visible = false;
  830. lblTxtRemoteUserPwd.Visible = false;
  831. txtRemoteTxtUserId.Visible = false;
  832. txtRemoteTxtPwd.Visible = false;
  833. }
  834. else
  835. {
  836. this.btnOpenFileTxt.Visible = false;
  837. lblTxtRemoteUserId.Visible = true;
  838. lblTxtRemoteUserPwd.Visible = true;
  839. txtRemoteTxtUserId.Visible = true;
  840. txtRemoteTxtPwd.Visible = true;
  841. }
  842. }
  843. }
  844. }