Beispiel #1
0
 public override void Delete(object sender, EventArgs e)
 {
     if (dgvDefectiveHandle.SelectedRows.Count > 0)
     {
         if (MessageBox.Show(Resources.IsDelete, Resources.MsgBoxTitleDelete, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             try
             {
                 DefectiveHandleService service = new DefectiveHandleService();
                 if (service.DeleteDefectiveHandle(dgvDefectiveHandle.SelectedRows[0].Cells[0].Value.ToString()))
                 {
                     frm.NoticeMessage = Resources.DeleteDone;
                 }
                 else
                 {
                     frm.NoticeMessage = Resources.DeleteError;
                 }
             }
             catch (Exception err)
             {
                 Log.WriteError(err.Message, err);
             }
         }
         RefreshClicked();
     }
     else
     {
         frm.NoticeMessage = Resources.DelDefectiveHandleError;
     }
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtExplain.Text.Trim().Length > 0 && txtName.Text.Trim().Length > 0)
     {
         try
         {
             DefectiveHandleVO vo = new DefectiveHandleVO {
                 HandleID = txtID.Text, HandleName = txtName.Text.Trim(), HandleExplain = txtExplain.Text.Trim()
             };
             DefectiveHandleService service = new DefectiveHandleService();
             if (service.UpdateDefectiveHandle(vo))
             {
                 if (vo.HandleID != "0")
                 {
                     MessageBox.Show(Resources.ModDone, Resources.ModDone, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show(Resources.AddDone, Resources.AddDone, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             else
             {
                 if (vo.HandleID != "0")
                 {
                     MessageBox.Show(Resources.ModError, Resources.ModError, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show(Resources.AddError, Resources.AddError, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         catch (Exception err)
         {
             Log.WriteError(err.Message, err);
         }
     }
     else
     {
         MessageBox.Show(Resources.isEssential, Resources.MsgBoxTitleWarn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }