华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

673 lines
26 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using DevExpress.XtraEditors;
  9. using ICSSoft.Frame.User.BLL;
  10. using ICSSoft.Base.Language.Tool;
  11. using ICSSoft.Base.UserControl.MessageControl;
  12. using System.Data.SqlClient;
  13. using ICSSoft.Base.Config.AppConfig;
  14. using ICSSoft.Base.Report.Filter;
  15. using ICSSoft.Base.Config.DBHelper;
  16. using ICSSoft.Base.UserControl.FormControl;
  17. using ICSSoft.Base.ReferForm.AppReferForm;
  18. using ICSSoft.Base.Lable.PrintTool;
  19. using ICSSoft.Frame.Data.Entity;
  20. using ICSSoft.Frame.Data.BLL;
  21. //using ZHCSoft.AntiwearValveExpanded.DAL;
  22. //using ZHCSoft.AntiwearValveExpanded.BLL;
  23. //using ZHCSoft.AntiwearValveExpanded.Entity;
  24. namespace ICSSoft.Frame.APP
  25. {
  26. public partial class FormICSOP2User : DevExpress.XtraEditors.XtraForm
  27. {
  28. private string sqltxt = "";
  29. private string sqlconn = "";
  30. String guid = AppConfig.GetGuid();
  31. private DataTable dataSource = null;
  32. #region 构造函数
  33. public FormICSOP2User()
  34. {
  35. InitializeComponent();
  36. this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  37. this.WindowState = FormWindowState.Maximized;
  38. }
  39. #endregion
  40. #region 操作权限
  41. public DataTable RightOfExute()
  42. {
  43. DataTable rData = new DataTable();
  44. rData.Columns.Add("BtnName");
  45. rData.Columns.Add("ActionName");
  46. //查看权限(必须有)
  47. DataRow seeRow = rData.NewRow();
  48. seeRow["BtnName"] = "see";
  49. seeRow["ActionName"] = "查看";
  50. rData.Rows.Add(seeRow);
  51. foreach (Control ctr in panelControl3.Controls)
  52. {
  53. if (ctr.Name == btnFilter.Name || ctr.Name == btnConfig.Name ||
  54. ctr.Name == btnSelectAll.Name || ctr.Name == btnCancelAll.Name ||
  55. ctr.Name == btnOutPut.Name ||
  56. ctr.Name == btnRefresh.Name || ctr.Name == btnExit.Name || ctr.Name == lblTitle.Name || ctr.Name == btnClose.Name)
  57. continue;
  58. DataRow dr = rData.NewRow();
  59. dr["BtnName"] = ctr.Name;
  60. dr["ActionName"] = ctr.Text;
  61. rData.Rows.Add(dr);
  62. }
  63. //List<Control> ControlList = new List<Control>();
  64. //ControlList.Add(btnCreate);
  65. ////ControlList.Add(btnModify);
  66. //ControlList.Add(btnDel);
  67. //ControlList.Add(btnOutPut);
  68. //foreach (Control ctr in ControlList)
  69. //{
  70. // if (ctr.GetType() == typeof(SimpleButton))
  71. // {
  72. // DataRow dr = rData.NewRow();
  73. // dr["BtnName"] = ctr.Name;
  74. // dr["ActionName"] = ctr.Text;
  75. // rData.Rows.Add(dr);
  76. // }
  77. //}
  78. rData.AcceptChanges();
  79. return rData;
  80. }
  81. public DataTable RightOfData()// 数据权限
  82. {
  83. DataTable rData = new DataTable();
  84. rData.Columns.Add("BodyName");
  85. rData.Columns.Add("ControlName");
  86. rData.Columns.Add("ControlCaption");
  87. rData.AcceptChanges();
  88. return rData;
  89. }
  90. #endregion
  91. #region 退出
  92. private void btnClose_Click(object sender, EventArgs e)
  93. {
  94. AppConfig.CloseFormShow(this.Text);
  95. this.Close();
  96. }
  97. private void btnExit_Click(object sender, EventArgs e)
  98. {
  99. AppConfig.CloseFormShow(this.Text);
  100. this.Close();
  101. }
  102. #endregion
  103. #region 移动窗体
  104. private const int WM_NCHITTEST = 0x84;
  105. private const int HTCLIENT = 0x1;
  106. private const int HTCAPTION = 0x2;
  107. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  108. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  109. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  110. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  111. //重写窗体,使窗体可以不通过自带标题栏实现移动
  112. protected override void WndProc(ref Message m)
  113. {
  114. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  115. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  116. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  117. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  118. switch (m.Msg)
  119. {
  120. case WM_NCHITTEST:
  121. base.WndProc(ref m);
  122. if ((int)m.Result == HTCLIENT)
  123. m.Result = (IntPtr)HTCAPTION;
  124. return;
  125. }
  126. //拦截双击标题栏、移动窗体的系统消息
  127. if (m.Msg != 0xA3)
  128. {
  129. base.WndProc(ref m);
  130. }
  131. }
  132. #endregion
  133. #region 列表
  134. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  135. {
  136. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  137. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  138. }
  139. #endregion
  140. #region 过滤
  141. private string tempTableName = "";
  142. private void btnFilter_Click(object sender, EventArgs e)
  143. {
  144. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name));
  145. filter.OldTempTableName = tempTableName;
  146. if (filter.ShowDialog() == DialogResult.OK)
  147. {
  148. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  149. try
  150. {
  151. _wait.Show();
  152. tempTableName = filter.NewTempTableName;
  153. sqltxt = filter.SqlText;
  154. sqlconn = filter.FilterConnectString;
  155. dataSource = filter.FilterData.Tables[0];
  156. grdDetail.DataSource = dataSource;
  157. grvDetail.BestFitColumns();
  158. rptPage.RecordNum = dataSource.Rows.Count;
  159. rptPage.PageSize = 500;
  160. rptPage.PageIndex = 1;
  161. rptPage.ReLoad();
  162. _wait.Close();
  163. }
  164. catch (Exception ex)
  165. {
  166. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  167. _wait.Close();
  168. }
  169. }
  170. }
  171. #endregion
  172. #region 绑定数据源
  173. private void btnConfig_Click(object sender, EventArgs e)
  174. {
  175. if (AppConfig.UserCode.ToLower() != "demo")
  176. {
  177. ICSBaseSimpleCode.AppshowMessageBox("您没有权限设置数据源,请联系软件提供商!");
  178. return;
  179. }
  180. FormDataSource fdata = new FormDataSource(AppConfig.GetMenuId(this.Tag.ToString()), btnConfig.Name);
  181. fdata.ShowDialog();
  182. }
  183. #endregion
  184. #region 分页
  185. private void rptPage_PageIndexChanged(object Sender, EventArgs e)
  186. {
  187. DataTable data = AppConfig.GetPageData(dataSource, rptPage.PageIndex, rptPage.PageSize).Copy();
  188. //DataTable data = AppConfig.GetPageDataByDb(tempTableName, "pagerowindex", rptPage.PageSize, rptPage.PageIndex, dataSource.Rows.Count);
  189. grdDetail.DataSource = data;
  190. }
  191. #endregion
  192. #region 过滤方法
  193. private void FormContainerManager_FormClosing(object sender, FormClosingEventArgs e)
  194. {
  195. AppConfig.DropTemTable(tempTableName);
  196. }
  197. #endregion
  198. #region 全选
  199. private void btnSelectAll_Click(object sender, EventArgs e)
  200. {
  201. grvDetail.PostEditor();
  202. this.Validate();
  203. for (int i = 0; i < grvDetail.RowCount; i++)
  204. {
  205. grvDetail.SetRowCellValue(i, colisSelect, "Y");
  206. }
  207. }
  208. #endregion
  209. #region 全消
  210. private void btnCancelAll_Click(object sender, EventArgs e)
  211. {
  212. grvDetail.PostEditor();
  213. this.Validate();
  214. for (int i = 0; i < grvDetail.RowCount; i++)
  215. {
  216. grvDetail.SetRowCellValue(i, colisSelect, "");
  217. }
  218. }
  219. #endregion
  220. #region 双击
  221. private void grvDetail_DoubleClick(object sender, EventArgs e)
  222. {
  223. if (grvDetail.FocusedRowHandle < 0)
  224. {
  225. return;
  226. }
  227. if (grvDetail.FocusedColumn == colisSelect)
  228. {
  229. if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colisSelect).ToString() == "")
  230. {
  231. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "Y");
  232. }
  233. else
  234. {
  235. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "");
  236. }
  237. }
  238. }
  239. #endregion
  240. #region 删除
  241. private void btnDel_Click(object sender, EventArgs e)
  242. {
  243. SimpleButton btntemp = (SimpleButton)sender;
  244. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  245. {
  246. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  247. return;
  248. }
  249. List<ICSOP2User> op2userList = new List<ICSOP2User>();
  250. for (int i = 0; i < grvDetail.RowCount; i++)
  251. {
  252. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  253. {
  254. ICSOP2User op2user=new ICSOP2User();
  255. op2user.OPCODE=grvDetail.GetRowCellValue(i, colOPCODE).ToString();
  256. op2user.USERCODE=grvDetail.GetRowCellValue(i, colUSERCODE).ToString();
  257. op2userList.Add(op2user);
  258. }
  259. }
  260. if (op2userList.Count == 0)
  261. {
  262. ICSBaseSimpleCode.AppshowMessageBox("请选择数据");
  263. return;
  264. }
  265. if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定删除吗?删除后无法恢复,确定吗?") != DialogResult.OK)
  266. {
  267. btnCancelAll_Click(sender, e);
  268. return;
  269. }
  270. ICSOP2UserBLL.deleteInfo(op2userList, AppConfig.AppConnectString);
  271. ICSBaseSimpleCode.AppshowMessageBox("删除成功");
  272. btnRefresh_Click(null, null);
  273. }
  274. #endregion
  275. #region 导出
  276. private void btnOutPut_Click(object sender, EventArgs e)
  277. {
  278. try
  279. {
  280. FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
  281. foe.ShowDialog();
  282. }
  283. catch (Exception ex)
  284. {
  285. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  286. }
  287. //FormOutExcel foe = new FormOutExcel();
  288. //if (foe.ShowDialog() == DialogResult.OK)
  289. //{
  290. // try
  291. // {
  292. // string outtype = foe._OutType;
  293. // string exceltype = foe._ExcelType;
  294. // string filename = foe._FileName;
  295. // string url = foe._Url;
  296. // string sheetname = foe._SheetName;
  297. // if (outtype.ToLower() == "excel")
  298. // {
  299. // DevExpress.XtraPrinting.XlsExportOptions op = new DevExpress.XtraPrinting.XlsExportOptions();
  300. // op.SheetName = sheetname;
  301. // grdDetail.MainView.ExportToXls((url + "\\" + filename + (exceltype == "2003" ? ".xls" : ".xlsx")), op);
  302. // }
  303. // else
  304. // {
  305. // grdDetail.MainView.ExportToPdf(url + "\\" + filename + ".pdf");
  306. // }
  307. // MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  308. // }
  309. // catch (Exception ex)
  310. // {
  311. // MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  312. // }
  313. //}
  314. }
  315. #endregion
  316. #region 刷新
  317. private void btnRefresh_Click(object sender, EventArgs e)
  318. {
  319. if (string.IsNullOrEmpty(sqlconn))
  320. return;
  321. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  322. try
  323. {
  324. _wait.Show();
  325. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
  326. filter.OldTempTableName = tempTableName;
  327. //tempTableName = filter.NewTempTableName;
  328. //DataTable data = DBHelper.ExecuteDataset(AppConfig.FrameConnectString, CommandType.Text, "select * from " + tempTableName).Tables[0];
  329. dataSource = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sqltxt).Tables[0];
  330. grdDetail.DataSource = dataSource;
  331. grvDetail.BestFitColumns();
  332. rptPage.RecordNum = dataSource.Rows.Count;
  333. rptPage.PageIndex = 1;
  334. rptPage.ReLoad();
  335. _wait.Close();
  336. }
  337. catch (Exception ex)
  338. {
  339. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  340. _wait.Close();
  341. }
  342. }
  343. #endregion
  344. #region 新增
  345. private void btnCreate_Click(object sender, EventArgs e)
  346. {
  347. SimpleButton btntemp = (SimpleButton)sender;
  348. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  349. {
  350. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  351. return;
  352. }
  353. FormICSOP2UserAdd add = new FormICSOP2UserAdd();
  354. add.ShowDialog();
  355. btnRefresh_Click(null, null);
  356. }
  357. #endregion
  358. #region 导入
  359. private void btnImportData_Click(object sender, EventArgs e)
  360. {
  361. SimpleButton btntemp = (SimpleButton)sender;
  362. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  363. {
  364. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  365. return;
  366. }
  367. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm();
  368. _wait.Hide();
  369. try
  370. {
  371. FormReadExcel fre = new FormReadExcel();
  372. if (fre.ShowDialog() != DialogResult.OK)
  373. {
  374. return;
  375. }
  376. DataTable dataSource = fre._excelData;
  377. if (dataSource == null)
  378. {
  379. throw new Exception("excel数据取得失败");
  380. }
  381. _wait.Show();
  382. _wait.Caption = "判断模版是否正确......";
  383. #region 判断模版是否正确
  384. List<FormReadExcelUIModelColumns> colNameList = new List<FormReadExcelUIModelColumns>();
  385. colNameList.Add(new FormReadExcelUIModelColumns("工序代码", true));
  386. colNameList.Add(new FormReadExcelUIModelColumns("人员代码", true));
  387. colNameList.Add(new FormReadExcelUIModelColumns("人员名称", true));
  388. foreach (FormReadExcelUIModelColumns columnsName in colNameList)
  389. {
  390. if (!dataSource.Columns.Contains(columnsName.columnsName))
  391. {
  392. throw new Exception("模版不正确,缺少列" + columnsName.columnsName);
  393. }
  394. }
  395. #endregion
  396. _wait.Caption = "数据整理中......";
  397. List<FormICSOP2UserUIModel> InitInvInfoList = new List<FormICSOP2UserUIModel>();
  398. foreach (DataRow dr in dataSource.Rows)
  399. {
  400. ///判断必输项目是否为空
  401. foreach (FormReadExcelUIModelColumns columnsName in colNameList)
  402. {
  403. if (string.IsNullOrWhiteSpace(dr[columnsName.columnsName].ToString()) == true && columnsName.NotNull == true)
  404. {
  405. throw new Exception("列" + columnsName.columnsName + "没有输入值");
  406. }
  407. }
  408. FormICSOP2UserUIModel Info = new FormICSOP2UserUIModel();
  409. Info.OPCODE = dr["工序代码"].ToString();
  410. Info.USERCODE = dr["人员代码"].ToString();
  411. Info.USERName = dr["人员名称"].ToString();
  412. Info.MUSER = AppConfig.UserCode;
  413. Info.MUSERName = AppConfig.UserName;
  414. Info.MTIME = DateTime.Now;
  415. Info.WorkPoint = AppConfig.WorkPointCode;
  416. Info.EATTRIBUTE1 = "";
  417. InitInvInfoList.Add(Info);
  418. }
  419. _wait.Caption = "导入数据......";
  420. ICSOP2UserBLL.AddList(InitInvInfoList, AppConfig.AppConnectString);
  421. _wait.Close();
  422. ICSBaseSimpleCode.AppshowMessageBox("数据导入成功!");
  423. btnRefresh_Click(null, null);
  424. }
  425. catch (Exception ex)
  426. {
  427. _wait.Close();
  428. ICSBaseSimpleCode.AppshowMessageBox("数据导入失败:" + ex.Message);
  429. }
  430. }
  431. #endregion
  432. #region 导入模板下载
  433. private void btnImportMould_Click(object sender, EventArgs e)
  434. {
  435. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm();
  436. _wait.Hide();
  437. string anjianExcelFileName = Environment.CommandLine.Substring(1, Environment.CommandLine.LastIndexOf("\\")) + "Output\\";
  438. try
  439. {
  440. _wait.Show();
  441. _wait.Caption = "模板下载中......";
  442. SaveFileDialog dlgSaveFileDialog = new SaveFileDialog(); //弹框提示保存
  443. dlgSaveFileDialog.InitialDirectory = anjianExcelFileName; //默认打开目录
  444. dlgSaveFileDialog.FilterIndex = 1;
  445. dlgSaveFileDialog.RestoreDirectory = true;
  446. dlgSaveFileDialog.FileName = "工序人员导入模板.xlsx"; //默认保存名称
  447. dlgSaveFileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx";
  448. if (dlgSaveFileDialog.ShowDialog() == DialogResult.OK)
  449. {
  450. string fileName = dlgSaveFileDialog.FileName; //获取弹出框选择或填写的文件名称
  451. List<FormReadExcelUIModelColumns> colNameList = new List<FormReadExcelUIModelColumns>();
  452. colNameList.Add(new FormReadExcelUIModelColumns("工序代码", true));
  453. colNameList.Add(new FormReadExcelUIModelColumns("工序描述", true));
  454. colNameList.Add(new FormReadExcelUIModelColumns("人员代码", true));
  455. colNameList.Add(new FormReadExcelUIModelColumns("人员名称", true));
  456. FileUtil.exportToExcelFile(fileName, colNameList);
  457. _wait.Close();
  458. ICSBaseSimpleCode.AppshowMessageBox("模板下载成功!");
  459. }
  460. _wait.Close();
  461. }
  462. catch (Exception ex)
  463. {
  464. _wait.Close();
  465. ICSBaseSimpleCode.AppshowMessageBox("模板下载失败:" + ex.Message);
  466. }
  467. }
  468. #endregion
  469. private void ICSItemLot_FormClosing(object sender, FormClosingEventArgs e)
  470. {
  471. AppConfig.DropTemTable(tempTableName);
  472. }
  473. private void FormICSITEM2ROUTE_Load(object sender, EventArgs e)
  474. {
  475. btnFilter_Click(sender, e);
  476. }
  477. private void grvDetail_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
  478. {
  479. if (e.RowHandle >= 0 && e.Column.FieldName == "DCTCODE")
  480. {
  481. //e.DisplayText = FormatHelper.
  482. e.CellValue = "cccc";
  483. }
  484. }
  485. private void btnLinkOP_Click(object sender, EventArgs e)
  486. {
  487. SimpleButton btntemp = (SimpleButton)sender;
  488. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  489. {
  490. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  491. return;
  492. }
  493. int count = 0;
  494. for (int i = 0; i < grvDetail.RowCount; i++)
  495. {
  496. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  497. {
  498. count++;
  499. }
  500. }
  501. if (count != 1)
  502. {
  503. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  504. return;
  505. }
  506. try
  507. {
  508. string itemCode;
  509. string routeCode;
  510. for (int i = 0; i < grvDetail.RowCount; i++)
  511. {
  512. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  513. {
  514. itemCode = grvDetail.GetRowCellValue(i, colOPCODE).ToString();
  515. routeCode = grvDetail.GetRowCellValue(i, colUSERCODE).ToString();
  516. FormICSITEMROUTE2OP linkop = new FormICSITEMROUTE2OP(itemCode, routeCode);
  517. linkop.ShowDialog();
  518. }
  519. }
  520. btnRefresh_Click(null, null);
  521. }
  522. catch (Exception ex)
  523. {
  524. //throw ex;
  525. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  526. }
  527. }
  528. #region 修改
  529. private void btnModify_Click(object sender, EventArgs e)
  530. {
  531. SimpleButton btntemp = (SimpleButton)sender;
  532. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  533. {
  534. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  535. return;
  536. }
  537. int count = 0;
  538. for (int i = 0; i < grvDetail.RowCount; i++)
  539. {
  540. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  541. {
  542. count++;
  543. }
  544. }
  545. if (count != 1)
  546. {
  547. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  548. return;
  549. }
  550. try
  551. {
  552. string opcode="";
  553. string usercode = "";
  554. List<ICSOP2User> op2userList = new List<ICSOP2User>();
  555. for (int i = 0; i < grvDetail.RowCount; i++)
  556. {
  557. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  558. {
  559. opcode = grvDetail.GetRowCellValue(i, colOPCODE).ToString();
  560. usercode = grvDetail.GetRowCellValue(i, colUSERCODE).ToString();
  561. FormICSOP2UserAdd add = new FormICSOP2UserAdd(opcode, usercode);
  562. ICSOP2User op2user = new ICSOP2User();
  563. op2user.OPCODE = grvDetail.GetRowCellValue(i, colOPCODE).ToString();
  564. op2user.USERCODE = grvDetail.GetRowCellValue(i, colUSERCODE).ToString();
  565. op2userList.Add(op2user);
  566. ICSOP2UserBLL.deleteInfo(op2userList, AppConfig.AppConnectString);
  567. add.ShowDialog();
  568. }
  569. }
  570. btnRefresh_Click(null, null);
  571. }
  572. catch (Exception ex)
  573. {
  574. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  575. }
  576. }
  577. #endregion
  578. private void simpleButton1_Click(object sender, EventArgs e)
  579. {
  580. SimpleButton btntemp = (SimpleButton)sender;
  581. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  582. {
  583. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  584. return;
  585. }
  586. FormICSOP2UserAdds add = new FormICSOP2UserAdds();
  587. add.ShowDialog();
  588. btnRefresh_Click(null, null);
  589. }
  590. }
  591. }