示例#1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtDeleteId.Text))
     {
         Ultils.TextControlNotNull(txtProductionId, "The Box ID required.");
     }
     else
     {
         if (comboBoxEditDelete.EditValue.ToString() == "Production ID")
         {
             try
             {
                 _oqcService.DeleteLogByProductionId(txtDeleteId.Text);
                 VisibleDeleteMessage(true, "Delete production success!");
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else if (comboBoxEditDelete.EditValue.ToString() == "Box ID")
         {
             try
             {
                 _oqcService.DeleteLogByBoxId(txtDeleteId.Text);
                 VisibleDeleteMessage(true, "Delete Box success!");
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
 }
示例#2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string id = txtSearchPCB.Text.Trim();

            if (string.IsNullOrEmpty(id))
            {
                Ultils.TextControlNotNull(txtSearchPCB, "Vui lòng nhập thông tin cần tìm");
            }
            else
            {
                dynamic mboxResult = MessageBox.Show($"Bạn có muốn xóa [{id}] hay không?",
                                                     @"THÔNG BÁO",
                                                     MessageBoxButtons.YesNo,
                                                     MessageBoxIcon.Warning);
                if (mboxResult == DialogResult.Yes)
                {
                    if (comboBoxEditSearchByKey.EditValue.ToString() == "Production ID")
                    {
                        try
                        {
                            _oqcService.DeleteLogByProductionId(id);
                            MessageBox.Show($"Delete Label [{id}] success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            gridControlData.DataSource = null;
                            gridControlData.Refresh();
                            btnDelete.Enabled = false;
                            txtSearchPCB.ResetText();
                            txtSearchPCB.Focus();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    else if (comboBoxEditSearchByKey.EditValue.ToString() == "Box ID")
                    {
                        try
                        {
                            _oqcService.DeleteLogByBoxId(id);
                            MessageBox.Show($"Delete BoxID [{id}] success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            gridControlData.DataSource = null;
                            gridControlData.Refresh();
                            txtSearchPCB.ResetText();
                            txtSearchPCB.Focus();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
        }