FrmProductWater.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using CoreFS.CA06;
  4. using Infragistics.Win.UltraWinEditors;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Windows.Forms;
  12. namespace Core.StlMes.Client.Qcm
  13. {
  14. public partial class FrmProductWater : FrmBase
  15. {
  16. //接箍码基础表数据
  17. private DataTable dtSCJG = null;
  18. List<int> list = new List<int>();
  19. int num = 0;
  20. public FrmProductWater()
  21. {
  22. InitializeComponent();
  23. //cmb1.SelectedIndex = 0;
  24. }
  25. private void FrmProductWater_Load(object sender, EventArgs e)
  26. {
  27. //结箍码
  28. InitDropList(ref dtSCJG, ultraSCJG, "com.steering.pss.qcm.ComBaseQuery.getComMSCJG", "SPEC_JG_DESC");
  29. DataTable dt1 = new DataTable();
  30. dt1.Columns.Add("xiaid");
  31. DataRow dr4 = dt1.NewRow();
  32. dr4["xiaid"] = "";
  33. dt1.Rows.Add(dr4);
  34. DataRow dr1 = dt1.NewRow();
  35. dr1["xiaid"] = "国标/国际/协议";
  36. dt1.Rows.Add(dr1);
  37. DataRow dr2 = dt1.NewRow();
  38. dr2["xiaid"] = "客户";
  39. dt1.Rows.Add(dr2);
  40. DataRow dr3 = dt1.NewRow();
  41. dr3["xiaid"] = "内控";
  42. dt1.Rows.Add(dr3);
  43. leixing.DataSource = dt1;
  44. leixing.ValueMember = "xiaid";
  45. }
  46. public override void ToolBar_Click(object sender, string ToolbarKey)
  47. {
  48. switch (ToolbarKey)
  49. {
  50. case "doQuery":
  51. doQuery(false);
  52. break;
  53. case "QueryKey":
  54. doQuery(true);
  55. break;
  56. case "doSave":
  57. doSave();
  58. break;
  59. case "doDelete":
  60. this.doDeleteOrResume(true);
  61. break;
  62. case "doResume":
  63. this.doDeleteOrResume(false);
  64. break;
  65. case "doClose":
  66. this.Close();
  67. break;
  68. }
  69. }
  70. private void doSave()
  71. {
  72. int number = this.ultraGrid1.Rows.Count;
  73. num = 0;
  74. try
  75. {
  76. for (int i = 0; i < number; i++)
  77. {
  78. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["UCCHOOSE"].Value))
  79. {
  80. //判定勾选项是新增行,还是修改行。
  81. if (ultraGrid1.Rows[i].Cells["XH"].Value.ToString() == "")
  82. {
  83. doAdd();
  84. }
  85. else
  86. {
  87. doUpdate();
  88. }
  89. }
  90. }
  91. if (num == 0)
  92. {
  93. MessageBox.Show("请选择需要处理的数据行!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  94. return;
  95. }
  96. if (num > 0)
  97. {
  98. doQuery(false);
  99. MessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  100. }
  101. }
  102. catch
  103. {
  104. MessageBox.Show("保存失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  105. return;
  106. }
  107. }
  108. private void doAdd()
  109. {
  110. //获取新增加的行。
  111. ultraGrid1.UpdateData();
  112. ArrayList parms = new ArrayList();
  113. //判断是否勾选。
  114. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  115. {
  116. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["UCCHOOSE"].Value) && num > -1 && ultraGrid1.Rows[i].Cells["XH"].Value.ToString() == "" && ultraGrid1.Rows[i].Cells["UnboundColumn2"].Value.ToString() == "tagtrue")
  117. {
  118. try
  119. {
  120. if (ultraGrid1.Rows[i].Cells["STDSTYLE"].Value.ToString() == "")
  121. {
  122. MessageBox.Show("标准类型不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  123. num = -10; return;
  124. }
  125. if (ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString() == "")
  126. {
  127. MessageBox.Show("请输入保压时间!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  128. num = -10; return;
  129. }
  130. try
  131. {
  132. Double.Parse(ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString());
  133. }
  134. catch
  135. {
  136. MessageBox.Show("保压时间需填写数值类型!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  137. num = -10; return;
  138. }
  139. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() != "" && ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() != "")
  140. {
  141. if (ultraGrid1.Rows[i].Cells["SPEC_JG_DESC"].Value.ToString() != "")
  142. {
  143. MessageBox.Show("外径和接箍码不能同时存在", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  144. num = -10; return;
  145. }
  146. if (double.Parse(ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString()) > double.Parse(ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString()))
  147. {
  148. MessageBox.Show("外径的最小值不能大于最大值", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  149. num = -10; return;
  150. }
  151. }
  152. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() != "")
  153. {
  154. if (ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() == "")
  155. {
  156. MessageBox.Show("外径的最大值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  157. num = -10; return;
  158. }
  159. }
  160. if (ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() != "")
  161. {
  162. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() == "")
  163. {
  164. MessageBox.Show("外径的最小值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  165. num = -10; return;
  166. }
  167. }
  168. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() != "" && ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() != "")
  169. {
  170. if (double.Parse(ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString()) > double.Parse(ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString()))
  171. {
  172. MessageBox.Show("壁厚的最小值不能大于最大值", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  173. num = -10; return;
  174. }
  175. }
  176. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() != "")
  177. {
  178. if (ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() == "")
  179. {
  180. MessageBox.Show("壁厚的最大值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  181. num = -10; return;
  182. }
  183. }
  184. if (ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() != "")
  185. {
  186. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() == "")
  187. {
  188. MessageBox.Show("壁厚的最小值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  189. num = -10; return;
  190. }
  191. }
  192. //构建ArrayList,添加到parms当中。
  193. ArrayList parm = new ArrayList();
  194. parm.Add(Guid.NewGuid().ToString().Substring(0, 20));
  195. switch (ultraGrid1.Rows[i].Cells["STDSTYLE"].Value.ToString())
  196. {
  197. case "国标/国际/协议":
  198. parm.Add("G");
  199. break;
  200. case "客户":
  201. parm.Add("K");
  202. break;
  203. case "内控":
  204. parm.Add("N");
  205. break;
  206. }
  207. parm.Add(ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString());
  208. parm.Add(ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString());
  209. parm.Add(ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString());
  210. parm.Add(ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString());
  211. parm.Add(ultraGrid1.Rows[i].Cells["SPEC_JG"].Text.ToString());
  212. parm.Add(ultraGrid1.Rows[i].Cells["SPEC_JG_DESC"].Value.ToString());
  213. parm.Add(ultraGrid1.Rows[i].Cells["MODEL_CODE"].Value.ToString());
  214. parm.Add(ultraGrid1.Rows[i].Cells["MODEL_DESC"].Value.ToString());
  215. parm.Add(ultraGrid1.Rows[i].Cells["PRESSURE_Y"].Value.ToString());
  216. //创建人应为当前操作用户。
  217. parm.Add(this.UserInfo.GetUserName());
  218. //创建时间为当前时间。
  219. parm.Add(DateTime.Now.ToString());
  220. parm.Add(ultraGrid1.Rows[i].Cells["MEMO"].Value.ToString());
  221. parm.Add(ultraGrid1.Rows[i].Cells["PRESSURE"].Value.ToString());
  222. parm.Add(ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString());
  223. ultraGrid1.Rows[i].Cells["UnboundColumn2"].Value = "";
  224. ServerHelper.SetData("com.steering.pss.qcm.CoreProducWater.doAdd", new Object[] { parm }, this.ob);
  225. num++;
  226. list.Add(i);
  227. }
  228. catch
  229. {
  230. MessageBox.Show("输入类型有误");
  231. return;
  232. }
  233. }
  234. }
  235. }
  236. private void doDeleteOrResume(Boolean flag)
  237. {
  238. ultraGrid1.UpdateData();
  239. string tishi = "";
  240. int numb = 0;
  241. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  242. {
  243. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["UCCHOOSE"].Value))
  244. {
  245. if (flag)
  246. tishi = "删除";
  247. else
  248. tishi = "恢复";
  249. if (numb == 0)
  250. {
  251. if (MessageBox.Show(tishi + "勾选记录,您是否继续?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  252. {
  253. return;
  254. }
  255. }
  256. numb++;
  257. ArrayList parm = new ArrayList();
  258. if (flag == true)
  259. {
  260. parm.Add(UserInfo.GetUserName());
  261. }
  262. parm.Add(ultraGrid1.Rows[i].Cells["MSC"].Value.ToString());
  263. switch (ultraGrid1.Rows[i].Cells["STDSTYLE"].Value.ToString())
  264. {
  265. case "国标/国际/协议":
  266. parm.Add("G");
  267. break;
  268. case "客户":
  269. parm.Add("K");
  270. break;
  271. case "内控":
  272. parm.Add("N");
  273. break;
  274. }
  275. parm.Add(ultraGrid1.Rows[i].Cells["XH"].Value.ToString());
  276. //主表删除
  277. int count = ServerHelper.SetData("com.steering.pss.qcm.CoreProducWater.deleteLineInfo", new Object[] { parm, flag }, this.ob);
  278. }
  279. }
  280. if (numb == 0)
  281. {
  282. MessageBox.Show("请选择需要处理的数据行!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  283. return;
  284. }
  285. doQuery(false);
  286. }
  287. private void doUpdate()
  288. {
  289. //需要实现批量修改功能。
  290. ultraGrid1.UpdateData();
  291. ArrayList parms = new ArrayList();
  292. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  293. {
  294. //复选框是否已经选中
  295. if ((Boolean)ultraGrid1.Rows[i].Cells["UCCHOOSE"].Value && num > -1 && ultraGrid1.Rows[i].Cells["XH"].Value.ToString() != "")
  296. {
  297. if (ultraGrid1.Rows[i].Cells["STDSTYLE"].Value.ToString() == "")
  298. {
  299. MessageBox.Show("标准类型不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  300. num = -10; return;
  301. }
  302. if (ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString() == "")
  303. {
  304. MessageBox.Show("请输入保压时间!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  305. num = -10; return;
  306. }
  307. try
  308. {
  309. Double.Parse(ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString());
  310. }
  311. catch
  312. {
  313. MessageBox.Show("保压时间需填写数值类型!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  314. num = -10; return;
  315. }
  316. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() != "" && ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() != "")
  317. {
  318. if (ultraGrid1.Rows[i].Cells["SPEC_JG_DESC"].Value.ToString() != "")
  319. {
  320. MessageBox.Show("外径和接箍码不能同时存在", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  321. num = -10; return;
  322. }
  323. if (double.Parse(ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString()) > double.Parse(ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString()))
  324. {
  325. MessageBox.Show("外径的最小值不能大于最大值", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  326. num = -10; return;
  327. }
  328. }
  329. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() != "")
  330. {
  331. if (ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() == "")
  332. {
  333. MessageBox.Show("外径的最大值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  334. num = -10; return;
  335. }
  336. }
  337. if (ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString() != "")
  338. {
  339. if (ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString() == "")
  340. {
  341. MessageBox.Show("外径的最小值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  342. num = -10; return;
  343. }
  344. }
  345. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() != "" && ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() != "")
  346. {
  347. if (double.Parse(ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString()) > double.Parse(ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString()))
  348. {
  349. MessageBox.Show("壁厚的最小值不能大于最大值", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  350. num = -10; return;
  351. }
  352. }
  353. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() != "")
  354. {
  355. if (ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() == "")
  356. {
  357. MessageBox.Show("壁厚的最大值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  358. num = -10; return;
  359. }
  360. }
  361. if (ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString() != "")
  362. {
  363. if (ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString() == "")
  364. {
  365. MessageBox.Show("壁厚的最小值没有填写!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  366. num = -10; return;
  367. }
  368. }
  369. ArrayList parm = new ArrayList();
  370. parm.Add(ultraGrid1.Rows[i].Cells["MIN_D"].Value.ToString());
  371. parm.Add(ultraGrid1.Rows[i].Cells["MAX_D"].Value.ToString());
  372. parm.Add(ultraGrid1.Rows[i].Cells["MIN_H"].Value.ToString());
  373. parm.Add(ultraGrid1.Rows[i].Cells["MAX_H"].Value.ToString());
  374. parm.Add(ultraGrid1.Rows[i].Cells["SPEC_JG"].Text.ToString());
  375. parm.Add(ultraGrid1.Rows[i].Cells["SPEC_JG_DESC"].Value.ToString());
  376. parm.Add(ultraGrid1.Rows[i].Cells["MODEL_CODE"].Value.ToString());
  377. parm.Add(ultraGrid1.Rows[i].Cells["MODEL_DESC"].Value.ToString());
  378. parm.Add(ultraGrid1.Rows[i].Cells["PRESSURE_Y"].Value.ToString());
  379. //创建人应为当前操作用户。
  380. parm.Add(this.UserInfo.GetUserName());
  381. //创建时间为当前时间。
  382. parm.Add(DateTime.Now.ToString());
  383. parm.Add(ultraGrid1.Rows[i].Cells["MEMO"].Value.ToString());
  384. parm.Add(ultraGrid1.Rows[i].Cells["PRESSURE"].Value.ToString());
  385. parm.Add(ultraGrid1.Rows[i].Cells["SAVE_TIME"].Value.ToString());
  386. parm.Add(ultraGrid1.Rows[i].Cells["MSC"].Value.ToString());
  387. switch (ultraGrid1.Rows[i].Cells["STDSTYLE"].Value.ToString())
  388. {
  389. case "国标/国际/协议":
  390. parm.Add("G");
  391. break;
  392. case "客户":
  393. parm.Add("K");
  394. break;
  395. case "内控":
  396. parm.Add("N");
  397. break;
  398. }
  399. parm.Add(ultraGrid1.Rows[i].Cells["XH"].Value.ToString());
  400. //主表修改
  401. ultraGrid1.Rows[i].Cells["UnboundColumn2"].Value = "";
  402. int count = ServerHelper.SetData("com.steering.pss.qcm.CoreProducWater.doUpdate", new Object[] { parm }, this.ob);
  403. num++;
  404. list.Add(i);
  405. }
  406. }
  407. }
  408. /// <summary>
  409. /// 查询方法,比较通用的查询方法
  410. /// </summary>
  411. private void doQuery(bool flag)
  412. {
  413. bool validFlag = flag;
  414. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProducWater.doQuery", new Object[] { validFlag }, this.ob);
  415. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  416. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  417. {
  418. for (int j = 0; j < ultraGrid1.Rows[i].Cells.Count; j++)
  419. {
  420. if (j == 19) break;
  421. ultraGrid1.Rows[i].Cells[j].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  422. }
  423. }
  424. UltraGridColumn[] col = new UltraGridColumn[] { this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"] };
  425. GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, col);
  426. //不同颜色区分是否有效数据
  427. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  428. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  429. {
  430. row = ultraGrid1.Rows[i];
  431. if (row.Cells["VALIDFLAG"].Value.ToString().Equals("0"))
  432. {
  433. row.Appearance.ForeColor = Color.Red;
  434. }
  435. else
  436. {
  437. row.Appearance.ForeColor = Color.Black;
  438. }
  439. }
  440. foreach (int i in list)
  441. {
  442. ultraGrid1.Rows[i].Cells["UCCHOOSE"].Value = true;
  443. }
  444. list.Clear();
  445. }
  446. /// <summary>
  447. /// 初始下拉框
  448. /// </summary>
  449. /// <param name="dt">数据表</param>
  450. /// <param name="uce">下拉框</param>
  451. /// <param name="methodId">方法名</param>
  452. /// <param name="desc">描述</param>
  453. /// <param name="code">代码</param>
  454. private void InitDropList(ref DataTable dt, UltraComboEditor uce, string methodId, string desc)
  455. {
  456. DataTable dts = ServerHelper.GetData(methodId, null, this.ob);
  457. int num = dts.Rows.Count;
  458. DataTable dt2 = new DataTable();
  459. dt2.Columns.Add("fenlei");
  460. dt2.Columns.Add("fenname");
  461. DataRow dr;
  462. for (int i = 0; i < num; i++)
  463. {
  464. dr = dt2.NewRow();
  465. dr["fenlei"] = dts.Rows[i]["SPEC_JG_DESC"];
  466. dr["fenname"] = dts.Rows[i]["SPEC_JG"];
  467. dt2.Rows.Add(dr);
  468. }
  469. uce.DataSource = dt2;
  470. uce.ValueMember = "fenname";
  471. uce.DisplayMember = "fenlei";
  472. }
  473. /// <summary>
  474. /// 扣型选择后赋值给ultragrid1
  475. /// </summary>
  476. /// <param name="code">扣型代码</param>
  477. /// <param name="desc">扣型描述</param>
  478. public void SetModelText(string code, string desc)
  479. {
  480. this.ultraGrid1.DisplayLayout.ActiveRow.Cells["MODEL_CODE"].Value = code;
  481. this.ultraGrid1.DisplayLayout.ActiveRow.Cells["MODEL_DESC"].Value = desc;
  482. }
  483. private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  484. {
  485. if (e.Cell.Column.Key.Equals("MODEL_DESC") && Convert.ToBoolean(ultraGrid1.DisplayLayout.ActiveRow.Cells["UCCHOOSE"].Value))
  486. {
  487. UltraGridRow row = this.ultraGrid1.DisplayLayout.ActiveRow;
  488. FrmModel frms = new FrmModel();
  489. frms.Desc = row.Cells["MODEL_DESC"].Value.ToString();
  490. frms.FrmOb = this.ob;
  491. frms.ShowDialog();
  492. row.Cells["MODEL_CODE"].Value = frms.Code;
  493. row.Cells["MODEL_DESC"].Value = frms.Desc;
  494. }
  495. }
  496. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  497. {
  498. if (e.Cell.Column.Key.Equals("UCCHOOSE"))
  499. {
  500. this.ultraGrid1.UpdateData();
  501. Activation activation = Activation.ActivateOnly;
  502. if (Convert.ToBoolean(e.Cell.Value))
  503. {
  504. activation = Activation.AllowEdit;
  505. e.Cell.Row.Cells["UnboundColumn2"].Value = "tagtrue";
  506. }
  507. CellsCollection cells = e.Cell.Row.Cells;
  508. for (int i = 0; i < cells.Count; i++)
  509. {
  510. if (!cells[i].Column.Key.Equals("UCCHOOSE")) //i!=9
  511. {
  512. if (i == 22) break;
  513. e.Cell.Row.Cells[i].Activation = activation;
  514. }
  515. }
  516. }
  517. }
  518. private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
  519. {
  520. for (int i = 0; i < e.Row.Cells.Count; i++)
  521. {
  522. if (i == 22) break;
  523. e.Row.Cells[i].Activation = Activation.NoEdit;
  524. }
  525. }
  526. }
  527. }