private void btnDelete_Click(object sender, EventArgs e) { MasterPass master = new MasterPass(); master.ShowDialog(); if (master.Result()) { // update failure for fail record try { BLFailRecord failRecord = new BLFailRecord(); failRecord.UpdateFailureForFailrecord(oldId, Convert.ToInt32(numNewId.Value)); } catch (Exception) { MessageBox.Show("Lỗi chuyển tên sự cố "); } try { //delete failure Failure fail = new Failure(); fail.Remove(oldId); MessageBox.Show("Đã xóa !"); result = true; this.Close(); } catch (Exception) { MessageBox.Show("Lỗi xóa fail Record"); } } }
private void btnRemove_Click(object sender, EventArgs e) { MasterPass masterPass = new MasterPass(); masterPass.ShowDialog(); if (masterPass.Result()) { int temp = rowTemp; BLFailRecord re = new BLFailRecord(); re.setId(Convert.ToInt32(gvProblem.Rows[temp].Cells[recordIdIndex].Value.ToString())); re.Remove(Convert.ToInt32(gvProblem.Rows[temp].Cells[recordIdIndex].Value.ToString())); MessageBox.Show("Đã xóa"); LoadData(); } }
private void btnRecord_Click(object sender, EventArgs e) { isSendMail = false; if (Convert.ToInt32(((Item)cbbProblem.SelectedItem).Value) >= 0) { line.Load(); BLFailRecord f = new BLFailRecord(); f.setFailureId(Convert.ToInt32(((Item)cbbProblem.SelectedItem).Value.ToString())); f.setEquip(Convert.ToInt32(((Item)cbbEquipment.SelectedItem).Value)); f.setReporterCode(employee.getOpCode()); f.setDescription(rtbDes.Text); f.setLine(cbbLine.SelectedItem.ToString()); bool validate = true; if (txtPO.Text.Length >= 3 && txtPO.Text.Length <= 12) { f.setPO(txtPO.Text); } else { validate = false; } Regex regex = new Regex("[0-9]"); if (!regex.IsMatch(txtPO.Text)) { validate = false; } f.setModel(txtModel.Text); if (txtMaterial.Text.Length > 0) { f.setMaterial(txtMaterial.Text); } else { f.setMaterial(""); } if (validate) { f.Add(); //if (isSendMail) //{ // Email mail = new Email(); // String content = rtbDes.Text; // String model = ""; // String po = ""; // String material = ""; // po += txtPO.Text; // model += txtModel.Text; // material += txtMaterial.Text; // mail = new Email(employee.getOpName(), rtbTo.Text, rtbCc.Text, ((Item)cbbCategory.SelectedItem).Text, line.getLineId(), ((Item)cbbProblem.SelectedItem).Text, content, wait, line.getUpperLevelMail().Split(';').ToList(), f.GetLastRecordId(), ((Item)cbbEquipment.SelectedItem).Text, po, model, material); // // mail.serverMail = this.serverMail; // // mail.port = this.port; // mail.Send(); //} btnClear.PerformClick(); this.Close(); } else { MessageBox.Show("Thông tin PO phải từ 3-12 số; Model phải hơn 3 ký tự", "Yeu cau nhap du thong tin"); } } else { MessageBox.Show("Vui lòng chọn sự cố"); } return; // btnSend.PerformClick(); }