using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Gm_WMS.DataAccess.DataService; using Stone.Common; namespace Stone.WinModule.BasicData { public partial class frmErrLog : Stone.WinModule.BasicData.frmBaseMain { public frmErrLog() { InitializeComponent(); this.tlbAdd.Visible = false; this.tlbAddCopy.Visible = false; this.tlbEdit.Visible = false; this.tlbDelete.Visible = false; this.tlbInput.Visible = false; } public override void Search(string code) { if (code == "") { strWhere = "1=1"; } else { strWhere = "(OperCode like '%" + code + "%'"; strWhere += " or [Msg] like '%" + code + "%')"; } if (cbIsNeed.Checked) { strWhere += " and IsClose = 0"; } } private void frmErrLog_Load(object sender, EventArgs e) { ToolStripButton btnHandle = new ToolStripButton("处理"); btnHandle.Image = this.imageList1.Images[3]; btnHandle.TextImageRelation = TextImageRelation.ImageAboveText; btnHandle.Click += btnHandle_Click; this.toolStrip1.Items.Insert(4, btnHandle); } private void btnHandle_Click(object sender, EventArgs e) { string LogID = "0"; try { if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择一行记录"); string OperCode = this.dgrdView.SelectedRows[0].Cells["OperCode"].Value.ToString(); //校验当前人员是否运行操作该记录 if(OperCode != User.UserInfo.UserName) { throw new Exception($"只能处理自己权限下的错误提示!"); } var strID = this.dgrdView.SelectedRows[0].Cells["ID"].Value.ToString(); var strsql = "Update t_Error_Log set IsClose = 1 where ID = " + strID; var db = new LocalDBService(); db.Exec_NonQuery(strsql); MyMessageBox.ShowInfoMessage($"处理成功"); this.tlbRefresh.PerformClick(); } catch (Exception ex) { MyMessageBox.ShowErrorMessage(ex.Message); } } } }