private void btnAddInspectionPlan_Click(object sender, EventArgs e) { RW_INSPECTION_HISTORY_BUS rwInsHisBus = new RW_INSPECTION_HISTORY_BUS(); RW_ASSESSMENT_BUS rwAssBus = new RW_ASSESSMENT_BUS(); int n = rwInsHisBus.getDataComp(rwAssBus.getComponentID(IDAss)).Count; if (n > 0) { dtgvInsHis.Rows.Add("-", DateTime.Now.ToShortDateString(), "Corrosion Under Insulation", "", "", "E", 0, DateTime.Now.ToShortDateString()); } else { if (dtgvInsHis.RowCount > 0) { dtgvInsHis.Rows.Add("-", DateTime.Now.ToShortDateString(), "Corrosion Under Insulation", "", "", "E", 0, DateTime.Now.ToShortDateString()); } else { MessageBox.Show("This proposal does not have mitigation plan, please add mitigation planning.", "Inspection / Mitigation", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } } }
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(); }