private void btnSave_Click(object sender, EventArgs e) { if (txtPlanName.Text == "") { MessageBox.Show("Please enter Inspection Plan Name!", "Inspection / Mitigation Planner", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (datePlanDate.Text == "") { MessageBox.Show("Please enter Inspection Plan Date!", "Inspection / Mitigation Planner", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { INSPECTION_PLAN ip = new INSPECTION_PLAN(); ip.InspPlanName = txtPlanName.Text; ip.InspPlanDate = datePlanDate.DateTime; INSPECTION_PLAN_BUS ipBus = new INSPECTION_PLAN_BUS(); List <INSPECTION_PLAN> listPlan = ipBus.getDataSource(); foreach (INSPECTION_PLAN ds in listPlan) { if (ds.InspPlanName == txtPlanName.Text) { MessageBox.Show("Plan Name already exist!", "Inspection / Mitigation Planner", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } ButtonSaveClicked = true; ipBus.add(ip); this.Close(); } } }
private void btnRestoreInspectionPlan_Click(object sender, EventArgs e) { WaitForm2 wf = new WaitForm2(); wf.Show(); dtgvInsHis.Rows.Clear(); RW_ASSESSMENT_BUS rwAssBus = new RW_ASSESSMENT_BUS(); INSPECTION_COVERAGE_BUS insCovBus = new INSPECTION_COVERAGE_BUS(); INSPECTION_PLAN_BUS inPlanBus = new INSPECTION_PLAN_BUS(); INSPECTION_COVERAGE_DETAIL_BUS insCovDeBus = new INSPECTION_COVERAGE_DETAIL_BUS(); DM_ITEMS_BUS dmItemsBus = new DM_ITEMS_BUS(); List <int> listIDCoverage = insCovBus.getlistIDbyEquipmentIDandComponentID(rwAssBus.getEquipmentID(IDAss), rwAssBus.getComponentID(IDAss)); foreach (int i in listIDCoverage) { List <int> listIDDetal = insCovDeBus.getIDbyCoverageID(i); foreach (int j in listIDDetal) { INSPECTION_COVERAGE_DETAIL insCovDe = insCovDeBus.getDataSourcebyID(j); dtgvInsHis.Rows.Add(inPlanBus.getPlanName(insCovBus.getPlanIDbyID(i)), insCovDe.InspectionDate.ToShortDateString(), dmItemsBus.getDMDescriptionbyDMItemID(insCovDe.DMItemID), insCovDe.InspectionSummary, "...", insCovDe.EffectivenessCode, insCovDe.IsCarriedOut, insCovDe.CarriedOutDate.ToShortDateString(), "Delete"); } } int n = dtgvInsHis.RowCount; for (int i = 0; i < n; i++) { dtgvInsHis.Rows[i].ReadOnly = true; dtgvInsHis.Rows[i].Cells[6].ReadOnly = false; dtgvInsHis.Rows[i].Cells[5].ReadOnly = false; dtgvInsHis.Rows[i].Cells[8].ReadOnly = false; dtgvInsHis.Rows[i].Cells[3].ReadOnly = false; } wf.Close(); }
private void Display() { try { gridControl.DataSource = null; INSPECTION_PLAN_BUS busisp = new INSPECTION_PLAN_BUS(); gridControl.DataSource = busisp.getDataSource(); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public void Showtab(int PlanID) { try { INSPECTION_PLAN_BUS businsplan = new INSPECTION_PLAN_BUS(); InspectionPlanName.Text = businsplan.getPlanName(PlanID); InspectionDate.Text = businsplan.getPlanDate(PlanID).ToString(); IDPlan = PlanID; } catch { // do nothing } }
private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DialogResult dlr = MessageBox.Show("Are you sure to delete this inspection plan detail!", "Inspection Planner", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dlr == DialogResult.Yes) { //int rowSelected = gridView1.FocusedRowHandle;DataRow row = gridView1.GetFocusedDataRow(); // lấy dòng đang chọn int _id = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, ColInvisiblePlanID); INSPECTION_PLAN ip = new INSPECTION_PLAN(); ip.PlanID = _id; INSPECTION_PLAN_BUS busisp = new INSPECTION_PLAN_BUS(); busisp.delete(ip); Display(); } }
private List <INSPECTION_COVERAGE> getDataPlanCoverage(int PlanID) { INSPECTION_COVERAGE_BUS busInspcove = new INSPECTION_COVERAGE_BUS(); List <INSPECTION_COVERAGE> listInscove = busInspcove.getDataID(PlanID); List <INSPECTION_COVERAGE> listData = new List <INSPECTION_COVERAGE>(); EQUIPMENT_MASTER_BUS buseq = new EQUIPMENT_MASTER_BUS(); COMPONENT_MASTER_BUS buscom = new COMPONENT_MASTER_BUS(); INSPECTION_PLAN_BUS businsplan = new INSPECTION_PLAN_BUS(); foreach (INSPECTION_COVERAGE inspCove in listInscove) { INSPECTION_COVERAGE rwInspCove = inspCove; rwInspCove.EquipmentName = buseq.getEquipmentName(inspCove.EquipmentID); rwInspCove.ComponentName = buscom.getComponentName(inspCove.ComponentID); rwInspCove.InspectionPlanName = businsplan.getPlanName(inspCove.PlanID); rwInspCove.InspectionPlanDate = businsplan.getPlanDate(inspCove.PlanID).ToString(); listData.Add(rwInspCove); } return(listData); }