FrmZKCXXInfo.cs.svn-base 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Common;
  10. using Infragistics.Win.UltraWinGrid;
  11. using Infragistics.Win.UltraWinGrid.ExcelExport;
  12. using Infragistics.Win;
  13. using System.Collections;
  14. using CoreFS.CA06;
  15. using System.Diagnostics;
  16. using System.IO;
  17. namespace Core.LgMes.Client.lgIntegrationQuery
  18. {
  19. public partial class FrmZKCXXInfo : frmStyleBase
  20. {
  21. private bool bAddNow, bEditNow, bDelNow;
  22. private UltraGridRow currRow = null;
  23. public FrmZKCXXInfo()
  24. {
  25. InitializeComponent();
  26. }
  27. private void FrmZKCXXInfo_Load(object sender, EventArgs e)
  28. {
  29. ultraDateTimeEditor1.DateTime = DateTime.Today;
  30. ultraDateTimeEditor2.DateTime = DateTime.Today;
  31. proc_SetToolbarButtons();
  32. }
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "Query":
  38. {
  39. if (bAddNow || bEditNow || bDelNow)
  40. return;
  41. proc_Query();
  42. proc_SetToolbarButtons();
  43. break;
  44. }
  45. case "Add":
  46. {
  47. if (bAddNow || bEditNow || bDelNow)
  48. return;
  49. currRow = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
  50. this.proc_setCellReadOnly(currRow, false);
  51. bAddNow = true;
  52. this.proc_SetToolbarButtons();
  53. break;
  54. }
  55. case "Edit":
  56. {
  57. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  58. return;
  59. currRow = ultraGrid1.ActiveRow;
  60. this.proc_setCellReadOnly(currRow, false);
  61. bEditNow = true;
  62. this.proc_SetToolbarButtons();
  63. break;
  64. }
  65. case "Save":
  66. {
  67. if (bAddNow)
  68. {
  69. proc_Add("Add");
  70. }
  71. else if (bEditNow)
  72. {
  73. proc_Add("Edit");
  74. }
  75. proc_Query();
  76. break;
  77. }
  78. case "Delete":
  79. {
  80. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  81. return;
  82. bDelNow = true;
  83. this.proc_SetToolbarButtons();
  84. proc_Delete();
  85. bDelNow = false;
  86. proc_Query();
  87. this.proc_SetToolbarButtons();
  88. break;
  89. }
  90. case "Export":
  91. {
  92. try
  93. {
  94. if (ultraGrid1.Rows.Count == 0) return;
  95. string strFileName = "真空槽记录" + DateTime.Now.ToString("yyyyMMdd");
  96. SaveFileDialog dlg = new SaveFileDialog();
  97. dlg.Title = "保存";
  98. dlg.OverwritePrompt = true;
  99. dlg.Filter = "Excel文件(*.xls)|*.xls";
  100. dlg.AddExtension = true;
  101. dlg.FileName = strFileName;
  102. if (dlg.ShowDialog() == DialogResult.OK)
  103. {
  104. strFileName = dlg.FileName;
  105. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  106. if (MessageBox.Show("数据导出成功!\r\n需要打开所导出文件吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  107. {
  108. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  109. ProcessStartInfo p = new ProcessStartInfo(strFileName);
  110. p.WorkingDirectory = Path.GetDirectoryName(strFileName);
  111. Process.Start(p);
  112. }
  113. }
  114. }
  115. catch (Exception ex)
  116. {
  117. MessageBox.Show(ex.Message);
  118. }
  119. break;
  120. }
  121. case "Cancel":
  122. {
  123. if (!(bAddNow || bEditNow)) return;
  124. string strOpt = " [" + (bAddNow ? "新增" : (bEditNow ? "修改" : "")) + "]";
  125. if (MessageBox.Show("确定要取消" + strOpt + "操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  126. return;
  127. if (bAddNow)
  128. {
  129. currRow.Delete(false);
  130. currRow = null;
  131. if (ultraGrid1.Rows.Count > 0)
  132. {
  133. ultraGrid1.ActiveCell = ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"];
  134. ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"].Selected = false;
  135. }
  136. bAddNow = false;
  137. }
  138. else if (bEditNow)
  139. {
  140. this.proc_setCellReadOnly(currRow, true);
  141. currRow = null;
  142. bEditNow = false;
  143. }
  144. this.proc_SetToolbarButtons();
  145. break;
  146. }
  147. case "Close":
  148. {
  149. this.Close();
  150. break;
  151. }
  152. }
  153. }
  154. public void proc_Query()
  155. {
  156. Cursor oldCursor = this.Cursor;
  157. this.Cursor = Cursors.WaitCursor;
  158. try
  159. {
  160. this.dataTable1.Clear();
  161. string sqlStr = @"SELECT * FROM DEV_ZKC_XX_INFO WHERE
  162. OPTDATE BETWEEN TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS')";
  163. if (ultraDateTimeEditor1.DateTime.Date > ultraDateTimeEditor2.DateTime.Date)
  164. {
  165. MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  166. return;
  167. }
  168. string strFrom = ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd") + " 00:00:00";
  169. string strTo = ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  170. sqlStr = string.Format(sqlStr, strFrom, strTo);
  171. //调用服务端方法
  172. CoreClientParam CCP_LgEts = new CoreClientParam();
  173. DataTable dt = new DataTable();
  174. CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBExecute";
  175. CCP_LgEts.MethodName = "doSimpleQuery";
  176. CCP_LgEts.ServerParams = new object[] { sqlStr };
  177. CCP_LgEts.SourceDataTable = dt;
  178. this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  179. DataSet ds = new DataSet();
  180. if (dt != null && dt.Rows.Count > 0)
  181. {
  182. this.dataTable1.Rows.Clear();
  183. DataRow dr;
  184. for (int iRow = 0; iRow < dt.Rows.Count; iRow++)
  185. {
  186. dr = this.dataTable1.NewRow();
  187. for (int jCol = 0; jCol < dt.Columns.Count; jCol++)
  188. {
  189. if (this.dataTable1.Columns.Contains(dt.Columns[jCol].ColumnName))
  190. {
  191. dr[dt.Columns[jCol].ColumnName] = dt.Rows[iRow][jCol];
  192. }
  193. }
  194. this.dataTable1.Rows.Add(dr);
  195. }
  196. }
  197. ultraGrid1.UpdateData();
  198. if (ultraGrid1.Rows.Count > 0)
  199. {
  200. ultraGrid1.ActiveCell = ultraGrid1.Rows[0].Cells["UUID_"];
  201. ultraGrid1.Rows[0].Cells["UUID_"].Selected = false;
  202. }
  203. this.proc_SetUltraGridReadOnly(ultraGrid1);
  204. }
  205. catch
  206. { }
  207. finally
  208. {
  209. this.Cursor = oldCursor;
  210. }
  211. }
  212. public void proc_Add(string flag)
  213. {
  214. try
  215. {
  216. this.ultraGrid1.UpdateData();
  217. if (dataTable1.Rows.Count > 0)
  218. {
  219. string strErr = "";
  220. string strMess = "";
  221. if (flag == "Add")
  222. {
  223. ArrayList arry = new ArrayList();
  224. arry.Add("frmZKCXXInfo.Insert");
  225. string str1 = ultraGrid1.ActiveRow.Cells["LADLEID"].Text;
  226. string str2 = ultraGrid1.ActiveRow.Cells["FACTORY"].Text;
  227. string str3 = ultraGrid1.ActiveRow.Cells["HLG_DATE"].Text;
  228. string str4 = ultraGrid1.ActiveRow.Cells["HLG_TIME"].Text;
  229. string str5 = ultraGrid1.ActiveRow.Cells["LG_ISCLEAN"].Text;
  230. string str6 = ultraGrid1.ActiveRow.Cells["XX_DATE"].Text;
  231. string str7 = ultraGrid1.ActiveRow.Cells["XX_TIME"].Text;
  232. string str8 = ultraGrid1.ActiveRow.Cells["XXLZ"].Text;
  233. string str9 = ultraGrid1.ActiveRow.Cells["LS_CRG"].Text;
  234. string str10 = ultraGrid1.ActiveRow.Cells["LS_FL"].Text;
  235. string str11 = ultraGrid1.ActiveRow.Cells["LS_XBC"].Text;
  236. string str12 = ultraGrid1.ActiveRow.Cells["LS_ZBC"].Text;
  237. string str13 = ultraGrid1.ActiveRow.Cells["LS_SBC"].Text;
  238. string str14 = ultraGrid1.ActiveRow.Cells["XJ_CDZ"].Text;
  239. string str15 = ultraGrid1.ActiveRow.Cells["XJ_CBZ"].Text;
  240. string str16 = ultraGrid1.ActiveRow.Cells["XJ_HLGZ"].Text;
  241. string str17 = ultraGrid1.ActiveRow.Cells["REPAIR_TYPE"].Text;
  242. string str18 = ultraGrid1.ActiveRow.Cells["XB_CDZ"].Text;
  243. string str19 = ultraGrid1.ActiveRow.Cells["XB_CBZ"].Text;
  244. string str20 = ultraGrid1.ActiveRow.Cells["XB_HLGZ"].Text;
  245. string str21 = ultraGrid1.ActiveRow.Cells["FJ_FL"].Text;
  246. string str22 = ultraGrid1.ActiveRow.Cells["FJ_GRB"].Text;
  247. string str23 = ultraGrid1.ActiveRow.Cells["FJ_FBF"].Text;
  248. string str24 = ultraGrid1.ActiveRow.Cells["FJ_CQXT"].Text;
  249. string str25 = ultraGrid1.ActiveRow.Cells["CHECK_MAN"].Text;
  250. string str26 = ultraGrid1.ActiveRow.Cells["CHECK_DATE"].Text;
  251. string str27 = ultraGrid1.ActiveRow.Cells["CHECK_TIME"].Text;
  252. string str28 = ultraGrid1.ActiveRow.Cells["SX_DATE"].Text;
  253. string str29 = ultraGrid1.ActiveRow.Cells["SX_TIME"].Text;
  254. string str30 = ultraGrid1.ActiveRow.Cells["CTCH"].Text;
  255. string str31 = ultraGrid1.ActiveRow.Cells["SGQG_ISOK"].Text;
  256. string str32 = ultraGrid1.ActiveRow.Cells["TSTQ_ISOK"].Text;
  257. string str33 = ultraGrid1.ActiveRow.Cells["EZQR"].Text;
  258. string str34 = ultraGrid1.ActiveRow.Cells["XKQR"].Text;
  259. string str35 = ultraGrid1.ActiveRow.Cells["FZBQR"].Text;
  260. string str36 = ultraGrid1.ActiveRow.Cells["FIRE_ISOK"].Text;
  261. string str37 = ultraGrid1.ActiveRow.Cells["QR_MAN"].Text;
  262. string str38 = ultraGrid1.ActiveRow.Cells["HKKS_DATE"].Text;
  263. string str39 = ultraGrid1.ActiveRow.Cells["HKKS_TIME"].Text;
  264. string str40 = ultraGrid1.ActiveRow.Cells["HKKS_MQLL"].Text;
  265. string str41 = ultraGrid1.ActiveRow.Cells["HKKS_YQLL"].Text;
  266. string str42 = ultraGrid1.ActiveRow.Cells["HKKS_OPT_MAN"].Text;
  267. string str43 = ultraGrid1.ActiveRow.Cells["TZH_DATE"].Text;
  268. string str44 = ultraGrid1.ActiveRow.Cells["TZH_TIME"].Text;
  269. string str45 = ultraGrid1.ActiveRow.Cells["TZH_MQLL"].Text;
  270. string str46 = ultraGrid1.ActiveRow.Cells["TZH_YQLL"].Text;
  271. string str47 = ultraGrid1.ActiveRow.Cells["TZH_OPT_MAN"].Text;
  272. string str48 = ultraGrid1.ActiveRow.Cells["TDH_DATE"].Text;
  273. string str49 = ultraGrid1.ActiveRow.Cells["TDH_TIME"].Text;
  274. string str50 = ultraGrid1.ActiveRow.Cells["TDH_MQLL"].Text;
  275. string str51 = ultraGrid1.ActiveRow.Cells["TDH_YQLL"].Text;
  276. string str52 = ultraGrid1.ActiveRow.Cells["TDH_OPT_MAN"].Text;
  277. string str53 = ultraGrid1.ActiveRow.Cells["GG_DATE"].Text;
  278. string str54 = ultraGrid1.ActiveRow.Cells["GG_TIME"].Text;
  279. string str55 = ultraGrid1.ActiveRow.Cells["ALL_TIME"].Text;
  280. string str56 = ultraGrid1.ActiveRow.Cells["GG_BZ"].Text;
  281. string str57 = this.UserInfo.GetUserName().Trim();
  282. arry.Add(str1);
  283. arry.Add(str2);
  284. arry.Add(str3);
  285. arry.Add(str4);
  286. arry.Add(str5);
  287. arry.Add(str6);
  288. arry.Add(str7);
  289. arry.Add(str8);
  290. arry.Add(str9);
  291. arry.Add(str10);
  292. arry.Add(str11);
  293. arry.Add(str12);
  294. arry.Add(str13);
  295. arry.Add(str14);
  296. arry.Add(str15);
  297. arry.Add(str16);
  298. arry.Add(str17);
  299. arry.Add(str18);
  300. arry.Add(str19);
  301. arry.Add(str20);
  302. arry.Add(str21);
  303. arry.Add(str22);
  304. arry.Add(str23);
  305. arry.Add(str24);
  306. arry.Add(str25);
  307. arry.Add(str26);
  308. arry.Add(str27);
  309. arry.Add(str28);
  310. arry.Add(str29);
  311. arry.Add(str30);
  312. arry.Add(str31);
  313. arry.Add(str32);
  314. arry.Add(str33);
  315. arry.Add(str34);
  316. arry.Add(str35);
  317. arry.Add(str36);
  318. arry.Add(str37);
  319. arry.Add(str38);
  320. arry.Add(str39);
  321. arry.Add(str40);
  322. arry.Add(str41);
  323. arry.Add(str42);
  324. arry.Add(str43);
  325. arry.Add(str44);
  326. arry.Add(str45);
  327. arry.Add(str46);
  328. arry.Add(str47);
  329. arry.Add(str48);
  330. arry.Add(str49);
  331. arry.Add(str50);
  332. arry.Add(str51);
  333. arry.Add(str52);
  334. arry.Add(str53);
  335. arry.Add(str54);
  336. arry.Add(str55);
  337. arry.Add(str56);
  338. arry.Add(str57);
  339. CommonClientToServer cctos = new CommonClientToServer();
  340. cctos.ob = this.ob;
  341. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  342. "doSimpleSave", arry, out strErr);
  343. this.proc_setCellReadOnly(currRow, true);
  344. currRow = null;
  345. bAddNow = false;
  346. }
  347. else if (flag == "Edit")
  348. {
  349. ArrayList arry = new ArrayList();
  350. arry.Add("frmZKCXXInfo.Update");
  351. string str1 = ultraGrid1.ActiveRow.Cells["LADLEID"].Text;
  352. string str2 = ultraGrid1.ActiveRow.Cells["FACTORY"].Text;
  353. string str3 = ultraGrid1.ActiveRow.Cells["HLG_DATE"].Text;
  354. string str4 = ultraGrid1.ActiveRow.Cells["HLG_TIME"].Text;
  355. string str5 = ultraGrid1.ActiveRow.Cells["LG_ISCLEAN"].Text;
  356. string str6 = ultraGrid1.ActiveRow.Cells["XX_DATE"].Text;
  357. string str7 = ultraGrid1.ActiveRow.Cells["XX_TIME"].Text;
  358. string str8 = ultraGrid1.ActiveRow.Cells["XXLZ"].Text;
  359. string str9 = ultraGrid1.ActiveRow.Cells["LS_CRG"].Text;
  360. string str10 = ultraGrid1.ActiveRow.Cells["LS_FL"].Text;
  361. string str11 = ultraGrid1.ActiveRow.Cells["LS_XBC"].Text;
  362. string str12 = ultraGrid1.ActiveRow.Cells["LS_ZBC"].Text;
  363. string str13 = ultraGrid1.ActiveRow.Cells["LS_SBC"].Text;
  364. string str14 = ultraGrid1.ActiveRow.Cells["XJ_CDZ"].Text;
  365. string str15 = ultraGrid1.ActiveRow.Cells["XJ_CBZ"].Text;
  366. string str16 = ultraGrid1.ActiveRow.Cells["XJ_HLGZ"].Text;
  367. string str17 = ultraGrid1.ActiveRow.Cells["REPAIR_TYPE"].Text;
  368. string str18 = ultraGrid1.ActiveRow.Cells["XB_CDZ"].Text;
  369. string str19 = ultraGrid1.ActiveRow.Cells["XB_CBZ"].Text;
  370. string str20 = ultraGrid1.ActiveRow.Cells["XB_HLGZ"].Text;
  371. string str21 = ultraGrid1.ActiveRow.Cells["FJ_FL"].Text;
  372. string str22 = ultraGrid1.ActiveRow.Cells["FJ_GRB"].Text;
  373. string str23 = ultraGrid1.ActiveRow.Cells["FJ_FBF"].Text;
  374. string str24 = ultraGrid1.ActiveRow.Cells["FJ_CQXT"].Text;
  375. string str25 = ultraGrid1.ActiveRow.Cells["CHECK_MAN"].Text;
  376. string str26 = ultraGrid1.ActiveRow.Cells["CHECK_DATE"].Text;
  377. string str27 = ultraGrid1.ActiveRow.Cells["CHECK_TIME"].Text;
  378. string str28 = ultraGrid1.ActiveRow.Cells["SX_DATE"].Text;
  379. string str29 = ultraGrid1.ActiveRow.Cells["SX_TIME"].Text;
  380. string str30 = ultraGrid1.ActiveRow.Cells["CTCH"].Text;
  381. string str31 = ultraGrid1.ActiveRow.Cells["SGQG_ISOK"].Text;
  382. string str32 = ultraGrid1.ActiveRow.Cells["TSTQ_ISOK"].Text;
  383. string str33 = ultraGrid1.ActiveRow.Cells["EZQR"].Text;
  384. string str34 = ultraGrid1.ActiveRow.Cells["XKQR"].Text;
  385. string str35 = ultraGrid1.ActiveRow.Cells["FZBQR"].Text;
  386. string str36 = ultraGrid1.ActiveRow.Cells["FIRE_ISOK"].Text;
  387. string str37 = ultraGrid1.ActiveRow.Cells["QR_MAN"].Text;
  388. string str38 = ultraGrid1.ActiveRow.Cells["HKKS_DATE"].Text;
  389. string str39 = ultraGrid1.ActiveRow.Cells["HKKS_TIME"].Text;
  390. string str40 = ultraGrid1.ActiveRow.Cells["HKKS_MQLL"].Text;
  391. string str41 = ultraGrid1.ActiveRow.Cells["HKKS_YQLL"].Text;
  392. string str42 = ultraGrid1.ActiveRow.Cells["HKKS_OPT_MAN"].Text;
  393. string str43 = ultraGrid1.ActiveRow.Cells["TZH_DATE"].Text;
  394. string str44 = ultraGrid1.ActiveRow.Cells["TZH_TIME"].Text;
  395. string str45 = ultraGrid1.ActiveRow.Cells["TZH_MQLL"].Text;
  396. string str46 = ultraGrid1.ActiveRow.Cells["TZH_YQLL"].Text;
  397. string str47 = ultraGrid1.ActiveRow.Cells["TZH_OPT_MAN"].Text;
  398. string str48 = ultraGrid1.ActiveRow.Cells["TDH_DATE"].Text;
  399. string str49 = ultraGrid1.ActiveRow.Cells["TDH_TIME"].Text;
  400. string str50 = ultraGrid1.ActiveRow.Cells["TDH_MQLL"].Text;
  401. string str51 = ultraGrid1.ActiveRow.Cells["TDH_YQLL"].Text;
  402. string str52 = ultraGrid1.ActiveRow.Cells["TDH_OPT_MAN"].Text;
  403. string str53 = ultraGrid1.ActiveRow.Cells["GG_DATE"].Text;
  404. string str54 = ultraGrid1.ActiveRow.Cells["GG_TIME"].Text;
  405. string str55 = ultraGrid1.ActiveRow.Cells["ALL_TIME"].Text;
  406. string str56 = ultraGrid1.ActiveRow.Cells["GG_BZ"].Text;
  407. string str57 = this.UserInfo.GetUserName().Trim();
  408. string uuid = ultraGrid1.ActiveRow.Cells["UUID_"].Text;
  409. arry.Add(str1);
  410. arry.Add(str2);
  411. arry.Add(str3);
  412. arry.Add(str4);
  413. arry.Add(str5);
  414. arry.Add(str6);
  415. arry.Add(str7);
  416. arry.Add(str8);
  417. arry.Add(str9);
  418. arry.Add(str10);
  419. arry.Add(str11);
  420. arry.Add(str12);
  421. arry.Add(str13);
  422. arry.Add(str14);
  423. arry.Add(str15);
  424. arry.Add(str16);
  425. arry.Add(str17);
  426. arry.Add(str18);
  427. arry.Add(str19);
  428. arry.Add(str20);
  429. arry.Add(str21);
  430. arry.Add(str22);
  431. arry.Add(str23);
  432. arry.Add(str24);
  433. arry.Add(str25);
  434. arry.Add(str26);
  435. arry.Add(str27);
  436. arry.Add(str28);
  437. arry.Add(str29);
  438. arry.Add(str30);
  439. arry.Add(str31);
  440. arry.Add(str32);
  441. arry.Add(str33);
  442. arry.Add(str34);
  443. arry.Add(str35);
  444. arry.Add(str36);
  445. arry.Add(str37);
  446. arry.Add(str38);
  447. arry.Add(str39);
  448. arry.Add(str40);
  449. arry.Add(str41);
  450. arry.Add(str42);
  451. arry.Add(str43);
  452. arry.Add(str44);
  453. arry.Add(str45);
  454. arry.Add(str46);
  455. arry.Add(str47);
  456. arry.Add(str48);
  457. arry.Add(str49);
  458. arry.Add(str50);
  459. arry.Add(str51);
  460. arry.Add(str52);
  461. arry.Add(str53);
  462. arry.Add(str54);
  463. arry.Add(str55);
  464. arry.Add(str56);
  465. arry.Add(str57);
  466. arry.Add(uuid);
  467. CommonClientToServer cctos = new CommonClientToServer();
  468. cctos.ob = this.ob;
  469. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  470. "doSimpleSave", arry, out strErr);
  471. this.proc_setCellReadOnly(currRow, true);
  472. currRow = null;
  473. bEditNow = false;
  474. }
  475. if (strErr == "")
  476. {
  477. dataTable1.AcceptChanges();
  478. //JJBStaticFunction.SetRowEdit(ultraGrid1);
  479. if (!string.IsNullOrEmpty(strMess))
  480. MessageBox.Show(strMess, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  481. }
  482. else
  483. {
  484. MessageBox.Show("保存失败!输入信息已经存在或数据无效。", "错误");
  485. }
  486. if (ultraGrid1.ActiveCell != null)
  487. ultraGrid1.ActiveCell.Activated = false;
  488. this.proc_SetToolbarButtons();
  489. }
  490. }
  491. catch (System.Exception ex)
  492. {
  493. Console.WriteLine(ex.ToString());
  494. }
  495. }
  496. public void proc_Delete()
  497. {
  498. try
  499. {
  500. string strErr = "";
  501. ArrayList arry = new ArrayList();
  502. if (this.ultraGrid1.ActiveRow == null) return;
  503. string uuid_ = ultraGrid1.ActiveRow.Cells["UUID_"].Text.Trim();
  504. arry.Add("frmZKCXXInfo.Delete");
  505. arry.Add(uuid_);
  506. CommonClientToServer cctos = new CommonClientToServer();
  507. cctos.ob = this.ob;
  508. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  509. "doSimpleSave", arry, out strErr);
  510. if (!string.IsNullOrEmpty(strErr))
  511. {
  512. MessageBox.Show("删除错误:" + strErr);
  513. }
  514. else
  515. {
  516. MessageBox.Show("删除成功:" + strErr);
  517. }
  518. }
  519. catch { }
  520. }
  521. private void proc_SetToolbarButtons()
  522. {
  523. try
  524. {
  525. this.ToolBarItemEnable(this, "Query", !(bAddNow || bEditNow || bDelNow));
  526. this.ToolBarItemEnable(this, "Add", !(bAddNow || bEditNow || bDelNow));
  527. this.ToolBarItemEnable(this, "Edit", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  528. this.ToolBarItemEnable(this, "Delete", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  529. this.ToolBarItemEnable(this, "Export", (!(bAddNow || bEditNow || bDelNow) && ultraGrid1.Rows.Count > 0));
  530. this.ToolBarItemEnable(this, "Save", (bAddNow || bEditNow));
  531. this.ToolBarItemEnable(this, "Cancel", (bAddNow || bEditNow));
  532. //this.ToolBarVisible(this, "Save");
  533. //this.Toolbars[0].Tools["Save"].SharedProps.Visible = (bAddNow || bEditNow);
  534. //this.Toolbars[0].Tools["Cancel"].SharedProps.Visible = (bAddNow || bEditNow);
  535. }
  536. catch { }
  537. }
  538. private void proc_setCellReadOnly(UltraGridRow row, bool bReadOnly)
  539. {
  540. try
  541. {
  542. if (row == null)
  543. return;
  544. if (bReadOnly)
  545. {
  546. row.Activation = Activation.ActivateOnly;
  547. row.CellAppearance.BackColor = Color.White;
  548. foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in row.Cells)
  549. {
  550. cell.CancelUpdate();
  551. }
  552. }
  553. else
  554. {
  555. row.Activation = Activation.AllowEdit;
  556. row.CellAppearance.BackColor = Color.Khaki;
  557. }
  558. }
  559. catch (Exception ex)
  560. {
  561. MessageBox.Show(ex.Message);
  562. }
  563. }
  564. private void proc_SetUltraGridReadOnly(Infragistics.Win.UltraWinGrid.UltraGridBase ultGrid)
  565. {
  566. foreach (UltraGridRow row in ultGrid.Rows)
  567. {
  568. row.Activation = Activation.ActivateOnly;
  569. }
  570. }
  571. }
  572. }