1459eb4d261aef91e89aeb0a660f25306f5c163d.svn-base 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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 CoreFS.CA06;
  10. using System.Collections;
  11. using System.IO;
  12. using System.Diagnostics;
  13. using Infragistics.Win.UltraWinGrid;
  14. using System.Reflection;
  15. //using System.Drawing;
  16. //using System.Collections.Generic;
  17. //using System.ComponentModel;
  18. namespace Core.LZMes.Client.UIB
  19. {
  20. public partial class UIB030320 : FrmBase
  21. {
  22. public UIB030320()
  23. {
  24. InitializeComponent();
  25. }
  26. private void UIB030320_Load(object sender, EventArgs e)
  27. {
  28. this.textProdLn.SelectedIndex = 1;//产线
  29. this.comboShen.SelectedIndex = 0;//审核状态
  30. this.comboSend.SelectedIndex = 1;//发送状态
  31. this.comboBoxLanguage.SelectedIndex = 0;//语种
  32. this.comboBox1.SelectedIndex = 0;//发送异常
  33. this.textInvNO.Text = OperateConditionRecode.ReadCondition("UIB030320_INVNO");
  34. this.textOrd.Text = OperateConditionRecode.ReadCondition("UIB030320_ORD");
  35. this.ultraDateTimeEditor1.Value = DateTime.Now.AddDays(-3);
  36. string directoryPath = "C:\\Temp\\ZBS\\";
  37. if (!Directory.Exists(directoryPath))//若不存在,则创建临时文件夹
  38. {
  39. Directory.CreateDirectory(directoryPath);
  40. }
  41. if (Directory.Exists(directoryPath))
  42. {
  43. foreach (string f in Directory.GetFileSystemEntries(directoryPath))
  44. {
  45. try
  46. {
  47. if (File.Exists(f))
  48. File.Delete(f); //直接删除其中的文件
  49. }
  50. catch (Exception ex)
  51. {
  52. System.Diagnostics.Debug.WriteLine(ex.ToString());
  53. continue;//文件正在使用,则跳过该文件
  54. }
  55. }
  56. }
  57. }
  58. public override void ToolBar_Click(object sender, string ToolbarKey)
  59. {
  60. switch (ToolbarKey)
  61. {
  62. case "Query":
  63. this.DoQuery();
  64. break;
  65. case "DownLoad":
  66. this.DownLoad();
  67. break;
  68. case "SendWWW":
  69. this.SendWWW();
  70. break;
  71. case "DoCheck":
  72. this.DoCheck();
  73. break;
  74. case "UnDoCheck":
  75. this.UnDoCheck();
  76. break;
  77. case "DoSave":
  78. this.DoSave();
  79. break;
  80. case "DoPrint":
  81. this.print();
  82. break;
  83. }
  84. }
  85. private void DoQuery()
  86. {
  87. try
  88. {
  89. ArrayList al = new ArrayList();
  90. if (this.textProdLn.Text == "热轧")
  91. {
  92. al.Add("UIB030320_HOST_01.SELECT");
  93. }
  94. else if (this.textProdLn.Text == "开平")
  95. {
  96. al.Add("UIB030320_BANJIA_01.SELECT");
  97. }
  98. else if (this.textProdLn.Text == "酸轧")
  99. {
  100. al.Add("UIB030320_SUAN_01.SELECT");
  101. }
  102. else if (this.textProdLn.Text == "连退")
  103. {
  104. al.Add("UIB030320_LIAN_01.SELECT");
  105. }
  106. else if (this.textProdLn.Text == "板加(非)")
  107. {
  108. al.Add("UIB030320_HOTBJ_01.SELECT");
  109. }
  110. else
  111. {
  112. return;
  113. }
  114. OperateConditionRecode.WriteCondition("UIB030320_INVNO" , this.textInvNO.Text);
  115. OperateConditionRecode.WriteCondition("UIB030320_ORD", this.textOrd.Text);
  116. al.Add(this.textOrd.Text);
  117. al.Add(this.comboShen.Text);
  118. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));
  119. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"));
  120. al.Add(this.textCar.Text);
  121. al.Add("");//运送指示号
  122. al.Add(this.textInvNO.Text);//明细号
  123. al.Add(this.textStlGrd.Text);//牌号
  124. al.Add(this.comboSend.Text);//是否已发送
  125. al.Add(this.comboSend.Text);//是否已发送
  126. al.Add(this.comboBox1.Text);//是否发送异常
  127. this.dataSet1.Tables[0].Clear();
  128. CoreClientParam ccp = new CoreClientParam();
  129. ccp.ServerName = "UIB.COM.ComDBQuery";
  130. ccp.MethodName = "doSimpleQuery";
  131. ccp.ServerParams = new object[] { al };
  132. ccp.SourceDataTable = this.dataSet1.Tables[0];
  133. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  134. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  135. {
  136. if (ugr.Cells["CRET_PRINT_TP"].Text == "")
  137. {
  138. ugr.Appearance.ForeColor = Color.Blue;//字体颜色
  139. }
  140. else if (ugr.Cells["SEND_TP"].Text != "Y")
  141. {
  142. ugr.Appearance.ForeColor = Color.Blue;//字体颜色
  143. }
  144. }
  145. }
  146. catch (Exception ex)
  147. {
  148. System.Diagnostics.Debug.WriteLine(ex.ToString());
  149. }
  150. }
  151. public void DoCheck()//审核
  152. {
  153. if (MessageBox.Show("确定审核?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  154. return;
  155. try
  156. {
  157. ArrayList al = new ArrayList();
  158. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  159. {
  160. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  161. {
  162. al.Add(ugr.Cells["CRET_NO"].Text);
  163. }
  164. }
  165. CoreClientParam ccp = new CoreClientParam();
  166. ccp.ServerName = "UIB.UIB03.UIB030320";
  167. ccp.MethodName = "ZBSCheckTP";
  168. ccp.ServerParams = new object[] { this.ultraGrid1.Rows[0].Cells["PROD_LINE"].Text//以首行的生产线为当前操作生产线
  169. , al
  170. , "Y"//区分审核与取消审核
  171. , this.UserInfo.GetUserName() };
  172. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  173. this.DoQuery();
  174. }
  175. catch (Exception ex)
  176. {
  177. System.Diagnostics.Debug.WriteLine(ex.ToString());
  178. }
  179. }
  180. public void DoSave()//订单备注
  181. {
  182. try
  183. {
  184. //if (MessageBox.Show("确定修改?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  185. // return;
  186. //ArrayList al = new ArrayList();
  187. //if (this.ultraGrid1.ActiveRow.Cells["PROD_LINE"].Text.Trim() == "热轧"
  188. // || this.ultraGrid1.ActiveRow.Cells["PROD_LINE"].Text.Trim() == "酸轧")
  189. //{
  190. // al.Add("UIB030320_01.UPDATE");
  191. //}
  192. //else if (this.ultraGrid1.ActiveRow.Cells["PROD_LINE"].Text.Trim() == "板加")
  193. //{
  194. // al.Add("UIB030320_02.UPDATE");
  195. //}
  196. //al.Add(this.textBoxRMK.Text);//订单备注
  197. //al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);//合同号
  198. //al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);//订单号
  199. //CoreClientParam ccp = new CoreClientParam();
  200. //ccp.ServerName = "UIB.COM.ComDBSave";
  201. //ccp.MethodName = "doXmlSave";
  202. //ccp.ServerParams = new object[] { al };
  203. //this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  204. }
  205. catch (Exception ex)
  206. {
  207. System.Diagnostics.Debug.WriteLine(ex.ToString());
  208. }
  209. }
  210. public void UnDoCheck()//取消审核,一次只取消一条记录
  211. {
  212. if (MessageBox.Show("确定取消审核?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  213. return;
  214. try
  215. {
  216. ArrayList al = new ArrayList();
  217. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  218. {
  219. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  220. {
  221. al.Add(ugr.Cells["CRET_NO"].Text);
  222. }
  223. }
  224. CoreClientParam ccp = new CoreClientParam();
  225. ccp.ServerName = "UIB.UIB03.UIB030320";
  226. ccp.MethodName = "ZBSCheckTP";
  227. ccp.ServerParams = new object[] { this.ultraGrid1.Rows[0].Cells["PROD_LINE"].Text//以首行的生产线为当前操作生产线
  228. , al
  229. , "N"//区分审核与取消审核
  230. , this.UserInfo.GetUserName() };
  231. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  232. this.DoQuery();
  233. }
  234. catch (Exception ex)
  235. {
  236. System.Diagnostics.Debug.WriteLine(ex.ToString());
  237. }
  238. //try
  239. //{
  240. // if (MessageBox.Show("确定取消审核?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  241. // return;
  242. // if (this.ultraGrid1.ActiveRow == null) return;
  243. // if (this.ultraGrid1.ActiveRow.Cells["CRET_PRINT_TP"].Text == "") return;
  244. // ArrayList al = new ArrayList();
  245. // al.Add("UIB030320_01.UPDATE");
  246. // al.Add("N");
  247. // al.Add(this.UserInfo.GetUserName());
  248. // al.Add(this.ultraGrid1.ActiveRow.Cells["CRET_NO"].Text);
  249. // CoreClientParam ccp = new CoreClientParam();
  250. // ccp.ServerName = "UIB.COM.ComDBSave";
  251. // ccp.MethodName = "doXmlSave";
  252. // ccp.ServerParams = new object[] { al };
  253. // this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  254. //}
  255. //catch (Exception ex)
  256. //{
  257. // System.Diagnostics.Debug.WriteLine(ex.ToString());
  258. //}
  259. }
  260. public void DownLoad()//下载或预览
  261. {
  262. try
  263. {
  264. if (this.ultraGrid1.ActiveRow == null) return;
  265. if (this.ultraGrid1.ActiveRow.Cells["CRET_PRINT_TP"].Text.Trim() == "")
  266. {
  267. MessageBox.Show("未审核的对象" ,"提示");
  268. return;
  269. }
  270. CoreClientParam ccp = new CoreClientParam();
  271. ccp.ServerName = "UIB.UIB03.UIB030320";
  272. ccp.MethodName = "downLoad";
  273. ccp.ServerParams = new object[] { this.ultraGrid1.ActiveRow.Cells["TMPL_NO"].Text.Trim() //模板
  274. ,this.ultraGrid1.ActiveRow.Cells["CRET_NO"].Text.Trim()//质保书号
  275. ,this.ultraGrid1.ActiveRow.Cells["PROD_LINE"].Text.Trim()//产线
  276. ,this.ultraGrid1.ActiveRow.Cells["INV_NO"].Text.Trim()//明细号
  277. // ,this.comboBoxLanguage.Text//语种区分
  278. ,""};//发送时该参数才有值
  279. CoreClientParam cx = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  280. if (ccp.ReturnObject != null && ccp.ReturnCode == 5)
  281. {
  282. MessageBox.Show(ccp.ReturnObject.ToString(), "提示");
  283. return;
  284. }
  285. if (ccp.ReturnInfo != null && ccp.ReturnInfo != "")
  286. {
  287. MessageBox.Show(ccp.ReturnInfo, "提示");
  288. return;
  289. }
  290. byte[] byData = (byte[])cx.ReturnObject;
  291. System.DateTime dt = System.DateTime.Now;
  292. string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt);
  293. string directoryPath = "C:\\Temp\\ZBS\\";
  294. string sFile = directoryPath + this.ultraGrid1.ActiveRow.Cells["CRET_NO"].Text + "_" + TimeNow + ".xls";
  295. FileStream fs = new FileStream(sFile, FileMode.OpenOrCreate, FileAccess.Write);
  296. fs.Write(byData, 0, byData.Length);
  297. fs.Close();
  298. ProcessStartInfo p = new ProcessStartInfo(sFile);
  299. p.WorkingDirectory = Path.GetDirectoryName(sFile);
  300. Process.Start(p);
  301. }
  302. catch (Exception ex)
  303. {
  304. MessageBox.Show(ex.ToString());
  305. }
  306. }
  307. //发送到外网
  308. public void SendWWW()
  309. {
  310. if (MessageBox.Show("确定发送?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  311. return;
  312. try
  313. {
  314. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  315. {
  316. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) && ugr.Cells["CRET_PRINT_TP"].Text == "Y")
  317. {
  318. CoreClientParam ccp = new CoreClientParam();
  319. ccp.ServerName = "UIB.UIB03.UIB030320";
  320. ccp.MethodName = "downLoad";
  321. ccp.ServerParams = new object[] {ugr.Cells["TMPL_NO"].Text.Trim() //模板号
  322. ,ugr.Cells["CRET_NO"].Text.Trim()//质保书编号
  323. ,ugr.Cells["PROD_LINE"].Text.Trim()//产线
  324. ,ugr.Cells["INV_NO"].Text.Trim()//明细号
  325. // ,this.comboBoxLanguage.Text
  326. ,"SEND"};//表示发送
  327. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  328. if (ccp.ReturnObject != null && ccp.ReturnCode == 5)
  329. {
  330. MessageBox.Show(ccp.ReturnObject.ToString(), "提示");
  331. ArrayList al = new ArrayList();
  332. al.Add("UIB030320_MS_02.UPDATE");
  333. al.Add(ugr.Cells["CRET_NO"].Text.Trim());//质保书编号
  334. ccp.ServerName = "UIB.COM.ComDBSave";
  335. ccp.MethodName = "doXmlSave";
  336. ccp.ServerParams = new object[] { al };
  337. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  338. al.Clear();
  339. al.Add("UIB030320_MS_03.UPDATE");
  340. al.Add(ugr.Cells["CRET_NO"].Text.Trim());//质保书编号
  341. ccp.ServerName = "UIB.COM.ComDBSave";
  342. ccp.MethodName = "doXmlSave";
  343. ccp.ServerParams = new object[] { al };
  344. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  345. return;
  346. }
  347. if(ccp.ReturnInfo != null && ccp.ReturnInfo != "") {
  348. MessageBox.Show(ccp.ReturnInfo, "提示");
  349. return;
  350. } else
  351. ugr.Cells["SEND_TP"].Value = "Y";
  352. }
  353. }
  354. this.DoQuery();
  355. }
  356. catch (Exception ex)
  357. {
  358. System.Diagnostics.Debug.WriteLine(ex.ToString());
  359. }
  360. }
  361. public void print()//打印
  362. {
  363. try
  364. {
  365. string directoryPath = "C:\\Temp\\ZBS\\";
  366. int indexFlag = 0;
  367. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  368. {
  369. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) && ugr.Cells["CRET_PRINT_TP"].Text == "Y" )
  370. {
  371. if ((this.textProdLn.Text == "酸轧" || this.textProdLn.Text == "连退") && ugr.Cells["PRINT_CNT"].Text != "0")
  372. {
  373. if (MessageBox.Show(ugr.Cells["CRET_NO"].Text + "已经打印过确定打印?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  374. return;
  375. }
  376. indexFlag++;
  377. CoreClientParam ccp = new CoreClientParam();
  378. ccp.ServerName = "UIB.UIB03.UIB030320";
  379. ccp.MethodName = "downLoad";
  380. ccp.ServerParams = new object[] { ugr.Cells["TMPL_NO"].Text.Trim() //模板
  381. ,ugr.Cells["CRET_NO"].Text.Trim()//质保书号
  382. ,ugr.Cells["PROD_LINE"].Text.Trim()//产线
  383. // ,this.comboBoxLanguage.Text.Trim()//语种区分
  384. ,""};//发送时该参数才有值
  385. CoreClientParam cx = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  386. byte[] byData = (byte[])cx.ReturnObject;
  387. System.DateTime dt = System.DateTime.Now;
  388. string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt);
  389. string sFile = directoryPath + ugr.Cells["CRET_NO"].Text + "_" + TimeNow + Convert.ToString(indexFlag) + ".xls";
  390. FileStream fs = new FileStream(sFile, FileMode.OpenOrCreate, FileAccess.Write);
  391. fs.Write(byData, 0, byData.Length);
  392. fs.Close();
  393. Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
  394. Microsoft.Office.Interop.Excel.Workbook workbook = app.Application.Workbooks.Add(sFile);
  395. Microsoft.Office.Interop.Excel._Worksheet ws = (Microsoft.Office.Interop.Excel._Worksheet)workbook.Worksheets[1];
  396. ws.PrintOut(1, 1, 1, false, Missing.Value, false, false, Missing.Value);//"HP LaserJet P1505"
  397. workbook.Saved = true;
  398. workbook.Close(Missing.Value, Missing.Value, Missing.Value);
  399. app.Quit();
  400. System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
  401. System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
  402. app = null;
  403. GC.Collect();
  404. CoreClientParam ccp2 = new CoreClientParam();
  405. ccp2.ServerName = "UIB.UIB03.UIB030320";
  406. ccp2.MethodName = "PrintCnt";
  407. ccp2.ServerParams = new object[] { this.UserInfo.GetUserName().ToString(), ugr.Cells["CRET_NO"].Text.Trim() };
  408. cx = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  409. }
  410. }this.DoQuery();
  411. }
  412. catch (Exception ex)
  413. {
  414. System.Diagnostics.Debug.WriteLine(ex.ToString());
  415. }
  416. }
  417. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)//订单备注
  418. {
  419. }
  420. private object missing = Missing.Value;
  421. //private Microsoft.Office.Interop.Excel.Application ExcelRS;
  422. //private Microsoft.Office.Interop.Excel.Workbook RSbook;
  423. //private Microsoft.Office.Interop.Excel.Worksheet RSsheet;
  424. private void button1_Click(object sender, EventArgs e)
  425. {
  426. }
  427. //this.sTREETTableAdapter.Fill(this.dataSet1.she);
  428. //string OutFilePath = System.Windows.Forms.Application.StartupPath + @" emp.xls";
  429. //string TemplateFilePath = System.Windows.Forms.Application.StartupPath + @"模版.xls";
  430. //PrintInit(TemplateFilePath, OutFilePath);
  431. //public bool PrintInit(string templetFile, string outputFile)
  432. //{
  433. // try
  434. // {
  435. // if (templetFile == null) { MessageBox.Show("Excel模板文件路径不能为空!"); return false;}
  436. // if (outputFile == null)
  437. // {
  438. // MessageBox.Show("输出Excel文件路径不能为空!");
  439. // return false;
  440. // }
  441. // //把模版文件templetFile拷贝到目输出文件outputFile中,并且目标文件可以改写
  442. // System.IO.File.Copy(templetFile, outputFile, true);
  443. // if (this.ExcelRS != null) ExcelRS = null;
  444. // //实例化ExcelRS对象
  445. // ExcelRS = new Microsoft.Office.Interop.Excel.ApplicationClass();//打开目标文件
  446. // //outputFile
  447. // RSbook = ExcelRS.Workbooks.Open(outputFile, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); //设置第一个工作溥
  448. // RSsheet = (Microsoft.Office.Interop.Excel.Worksheet)RSbook.Sheets.get_Item(1); //激活当前工作溥
  449. // RSsheet.Activate(); //在当前工作溥写入内容
  450. // for (int i = 0; i < this.dataGridView1.RowCount; i++)
  451. // {
  452. // RSsheet.Cells[3 + i, 1] = this.dataGridView1[0, i].Value.ToString();
  453. // RSsheet.Cells[3 + i, 2] = this.dataGridView1[1, i].Value.ToString();
  454. // RSsheet.Cells[3 + i, 3] = this.dataGridView1[2, i].Value.ToString(); } //保存目标文件
  455. // RSbook.Save(); //设置DisplayAlerts
  456. // ExcelRS.DisplayAlerts = false;
  457. // ExcelRS.Visible = true; //ExcelRS.DisplayAlerts = true; //释放对象
  458. // RSsheet = null;
  459. // RSbook = null;
  460. // ExcelRS = null; //释放内存
  461. // }
  462. // catch (Exception ex)
  463. // {
  464. // MessageBox.Show(ex.ToString());
  465. // return false;
  466. // }
  467. // return true;
  468. //}
  469. public void cCollect()
  470. {
  471. GC.Collect();
  472. GC.WaitForPendingFinalizers();
  473. GC.Collect();
  474. GC.WaitForPendingFinalizers();
  475. }
  476. //private void checkBox1_CheckedChanged(object sender, EventArgs e)
  477. //{
  478. // foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  479. // {
  480. // ugr.Cells["CHK"].Value = this.checkBox1.Checked;
  481. // ugr.Update();
  482. // }
  483. //}
  484. private System.Collections.Hashtable tmphsb = new Hashtable();
  485. string tmpflag = "True";
  486. private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  487. {
  488. if (e.Column.Key == "CHK")
  489. {
  490. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in e.Rows)
  491. {
  492. if (row.IsFilteredOut)
  493. {
  494. if (tmpflag == "True" && tmphsb[row.Cells["CRET_NO"].Value.ToString()].ToString() == "False")
  495. {
  496. row.Cells["CHK"].Value = "False";
  497. }
  498. if (tmpflag == "False" && tmphsb[row.Cells["CRET_NO"].Value.ToString()].ToString() == "True")
  499. {
  500. row.Cells["CHK"].Value = "True";
  501. }
  502. }
  503. }
  504. }
  505. }
  506. private void ultraGrid1_BeforeHeaderCheckStateChanged(object sender, BeforeHeaderCheckStateChangedEventArgs e)
  507. {
  508. if (e.Column.Key == "CHK")
  509. {
  510. if (e.NewCheckState == CheckState.Checked)
  511. {
  512. tmpflag = "True";
  513. }
  514. else
  515. {
  516. tmpflag = "False";
  517. }
  518. tmphsb.Clear();
  519. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ultraGrid1.Rows)
  520. {
  521. if(!tmphsb.ContainsKey(row.Cells["CRET_NO"].Value.ToString()))
  522. tmphsb.Add(row.Cells["CRET_NO"].Value.ToString(), row.Cells["CHK"].Value.ToString());
  523. }
  524. }
  525. }
  526. }
  527. }