public void riskPoF(int ID) { RW_FULL_POF_BUS bus = new RW_FULL_POF_BUS(); RW_FULL_POF obj = bus.getData(ID); cbThinningType.Text = obj.ThinningType; textEdit1.Text = obj.GFFTotal.ToString(); textEdit2.Text = obj.FMS.ToString(); txt0Thinning.Text = obj.ThinningAP1.ToString(); txt36Thinning.Text = obj.ThinningAP2.ToString(); txt72Thinning.Text = obj.ThinningAP3.ToString(); txt0StressCorrosion.Text = obj.SCCAP1.ToString(); txt36StressCorrosion.Text = obj.SCCAP2.ToString(); txt72StressCorrosion.Text = obj.SCCAP3.ToString(); txt0External.Text = obj.ExternalAP1.ToString(); txt36External.Text = obj.ExternalAP2.ToString(); txt72External.Text = obj.ExternalAP3.ToString(); txt0HighTemperature.Text = obj.HTHA_AP1.ToString(); txt36HighTemperature.Text = obj.HTHA_AP2.ToString(); txt72HighTemperature.Text = obj.HTHA_AP3.ToString(); txt0BrittleFracture.Text = obj.BrittleAP1.ToString(); txt36BrittleFracture.Text = obj.BrittleAP2.ToString(); txt72BrittleFracture.Text = obj.BrittleAP3.ToString(); txt0Piping.Text = obj.FatigueAP1.ToString(); txt36Piping.Text = obj.FatigueAP2.ToString(); txt72Piping.Text = obj.FatigueAP3.ToString(); txt0Other.Text = obj.SemiAP1.ToString(); txt32Other.Text = obj.SemiAP2.ToString(); txt72Other.Text = obj.SemiAP3.ToString(); txt0TotalGeneralThinning.Text = obj.ThinningGeneralAP1.ToString(); txt36TotalGeneralThinning.Text = obj.ThinningGeneralAP2.ToString(); txt72TotalGeneralThinning.Text = obj.ThinningGeneralAP3.ToString(); txt0TotalLocalThinning.Text = obj.ThinningLocalAP1.ToString(); txt36TotalLocalThinning.Text = obj.ThinningLocalAP2.ToString(); txt72TotalLocalThinning.Text = obj.ThinningLocalAP3.ToString(); txt0FinalTotalDamage.Text = obj.TotalDFAP1.ToString(); txt36FinalTotalDamage.Text = obj.TotalDFAP2.ToString(); txt72FinalTotalDamage.Text = obj.TotalDFAP3.ToString(); txt0PoF.Text = obj.PoFAP1.ToString(); txt36PoF.Text = obj.PoFAP2.ToString(); txt72PoF.Text = obj.PoFAP3.ToString(); txt0PoFCategory.Text = obj.PoFAP1Category; txt36PoFCategory.Text = obj.PoFAP2Category; txt72PoFCategory.Text = obj.PoFAP3Category; }
public void delete(RW_FULL_POF obj) { DAL.delete(obj.ID); }
public void edit(RW_FULL_POF obj) { DAL.edit(obj.ID, obj.ThinningAP1, obj.ThinningAP2, obj.ThinningAP3, obj.SCCAP1, obj.SCCAP2, obj.SCCAP3, obj.ExternalAP1, obj.ExternalAP2, obj.ExternalAP3, obj.BrittleAP1, obj.BrittleAP2, obj.BrittleAP3, obj.HTHA_AP1, obj.HTHA_AP2, obj.HTHA_AP3, obj.FatigueAP1, obj.FatigueAP2, obj.FatigueAP3.ToString(), obj.FMS, obj.ThinningType, obj.GFFTotal, obj.ThinningLocalAP1, obj.ThinningLocalAP2, obj.ThinningLocalAP3, obj.ThinningGeneralAP1, obj.ThinningGeneralAP2, obj.ThinningGeneralAP3, obj.TotalDFAP1, obj.TotalDFAP2, obj.TotalDFAP3, obj.PoFAP1, obj.PoFAP2, obj.PoFAP3, obj.MatrixPoFAP1, obj.MatrixPoFAP2, obj.MatrixPoFAP3, obj.RLI, obj.SemiAP1, obj.SemiAP2, obj.SemiAP3, obj.PoFAP1Category, obj.PoFAP2Category, obj.PoFAP3Category, obj.CoFValue, obj.CoFCategory, obj.CoFMatrixValue); }
public RW_FULL_POF getData(int ID) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); RW_FULL_POF obj = new RW_FULL_POF(); String sql = "Use [rbi] Select [ID]" + ",[ThinningAP1]" + ",[ThinningAP2]" + ",[ThinningAP3]" + ",[SCCAP1]" + ",[SCCAP2]" + ",[SCCAP3]" + ",[ExternalAP1]" + ",[ExternalAP2]" + ",[ExternalAP3]" + ",[BrittleAP1]" + ",[BrittleAP2]" + ",[BrittleAP3]" + ",[HTHA_AP1]" + ",[HTHA_AP2]" + ",[HTHA_AP3]" + ",[FatigueAP1]" + ",[FatigueAP2]" + ",[FatigueAP3]" + ",[FMS]" + ",[ThinningType]" + ",[GFFTotal]" + ",[ThinningLocalAP1]" + ",[ThinningLocalAP2]" + ",[ThinningLocalAP3]" + ",[ThinningGeneralAP1]" + ",[ThinningGeneralAP2]" + ",[ThinningGeneralAP3]" + ",[TotalDFAP1]" + ",[TotalDFAP2]" + ",[TotalDFAP3]" + ",[PoFAP1]" + ",[PoFAP2]" + ",[PoFAP3]" + ",[MatrixPoFAP1]" + ",[MatrixPoFAP2]" + ",[MatrixPoFAP3]" + ",[RLI]" + ",[SemiAP1]" + ",[SemiAP2]" + ",[SemiAP3]" + ",[PoFAP1Category]" + ",[PoFAP2Category]" + ",[PoFAP3Category]" + ",[CoFValue]" + ",[CoFCategory]" + ",[CoFMatrixValue]" + "From [dbo].[RW_FULL_POF] WHERE [ID] = '" + ID + "' "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.ThinningAP1 = (float)reader.GetDouble(1); } if (!reader.IsDBNull(2)) { obj.ThinningAP2 = (float)reader.GetDouble(2); } if (!reader.IsDBNull(3)) { obj.ThinningAP3 = (float)reader.GetDouble(3); } if (!reader.IsDBNull(4)) { obj.SCCAP1 = (float)reader.GetDouble(4); } if (!reader.IsDBNull(5)) { obj.SCCAP2 = (float)reader.GetDouble(5); } if (!reader.IsDBNull(6)) { obj.SCCAP3 = (float)reader.GetDouble(6); } if (!reader.IsDBNull(7)) { obj.ExternalAP1 = (float)reader.GetDouble(7); } if (!reader.IsDBNull(8)) { obj.ExternalAP2 = (float)reader.GetDouble(8); } if (!reader.IsDBNull(9)) { obj.ExternalAP3 = (float)reader.GetDouble(9); } if (!reader.IsDBNull(10)) { obj.BrittleAP1 = (float)reader.GetDouble(10); } if (!reader.IsDBNull(11)) { obj.BrittleAP2 = (float)reader.GetDouble(11); } if (!reader.IsDBNull(12)) { obj.BrittleAP3 = (float)reader.GetDouble(12); } if (!reader.IsDBNull(13)) { obj.HTHA_AP1 = (float)reader.GetDouble(13); } if (!reader.IsDBNull(14)) { obj.HTHA_AP2 = (float)reader.GetDouble(14); } if (!reader.IsDBNull(15)) { obj.HTHA_AP3 = (float)reader.GetDouble(15); } if (!reader.IsDBNull(16)) { obj.FatigueAP1 = (float)reader.GetDouble(16); } if (!reader.IsDBNull(17)) { obj.FatigueAP2 = (float)reader.GetDouble(17); } if (!reader.IsDBNull(18)) { obj.FatigueAP3 = (float)reader.GetDouble(18); } if (!reader.IsDBNull(19)) { obj.FMS = (float)reader.GetDouble(19); } if (!reader.IsDBNull(20)) { obj.ThinningType = reader.GetString(20); } if (!reader.IsDBNull(21)) { obj.GFFTotal = (float)reader.GetDouble(21); } if (!reader.IsDBNull(22)) { obj.ThinningLocalAP1 = (float)reader.GetDouble(22); } if (!reader.IsDBNull(23)) { obj.ThinningLocalAP2 = (float)reader.GetDouble(23); } if (!reader.IsDBNull(24)) { obj.ThinningLocalAP3 = (float)reader.GetDouble(24); } if (!reader.IsDBNull(25)) { obj.ThinningGeneralAP1 = (float)reader.GetDouble(25); } if (!reader.IsDBNull(26)) { obj.ThinningGeneralAP2 = (float)reader.GetDouble(26); } if (!reader.IsDBNull(27)) { obj.ThinningGeneralAP3 = (float)reader.GetDouble(27); } if (!reader.IsDBNull(28)) { obj.TotalDFAP1 = (float)reader.GetDouble(28); } if (!reader.IsDBNull(29)) { obj.TotalDFAP2 = (float)reader.GetDouble(29); } if (!reader.IsDBNull(30)) { obj.TotalDFAP3 = (float)reader.GetDouble(30); } if (!reader.IsDBNull(31)) { obj.PoFAP1 = (float)reader.GetDouble(31); } if (!reader.IsDBNull(32)) { obj.PoFAP2 = (float)reader.GetDouble(32); } if (!reader.IsDBNull(33)) { obj.PoFAP3 = (float)reader.GetDouble(33); } if (!reader.IsDBNull(34)) { obj.MatrixPoFAP1 = (float)reader.GetDouble(34); } if (!reader.IsDBNull(35)) { obj.MatrixPoFAP2 = (float)reader.GetDouble(35); } if (!reader.IsDBNull(36)) { obj.MatrixPoFAP3 = (float)reader.GetDouble(36); } if (!reader.IsDBNull(37)) { obj.RLI = (float)reader.GetDouble(37); } if (!reader.IsDBNull(38)) { obj.SemiAP1 = (float)reader.GetDouble(38); } if (!reader.IsDBNull(39)) { obj.SemiAP2 = (float)reader.GetDouble(39); } if (!reader.IsDBNull(40)) { obj.SemiAP3 = (float)reader.GetDouble(40); } if (!reader.IsDBNull(41)) { obj.PoFAP1Category = reader.GetString(41); } if (!reader.IsDBNull(42)) { obj.PoFAP2Category = reader.GetString(42); } if (!reader.IsDBNull(43)) { obj.PoFAP3Category = reader.GetString(43); } if (!reader.IsDBNull(44)) { obj.CoFValue = (float)reader.GetDouble(44); } if (!reader.IsDBNull(45)) { obj.CoFCategory = reader.GetString(45); } if (!reader.IsDBNull(46)) { obj.CoFMatrixValue = (float)reader.GetDouble(46); } } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL !"); } finally { conn.Close(); } return(obj); }
public List <RiskSummary> getData() { RW_ASSESSMENT_BUS assBus = new RW_ASSESSMENT_BUS(); List <int> allIDAssessment = assBus.getAllID(); List <RiskSummary> dataRisk = new List <RiskSummary>(); for (int i = 0; i < allIDAssessment.Count; i++) { RiskSummary risk = new RiskSummary(); RW_FULL_POF_BUS busPoF = new RW_FULL_POF_BUS(); RW_FULL_POF fullPoF = busPoF.getData(allIDAssessment[i]); //RW_CA_LEVEL_1_BUS busCA = new RW_CA_LEVEL_1_BUS(); //RW_CA_LEVEL_1 CA = busCA.getData(allIDAssessment[i]); //get EquipmentID ----> get EquipmentTypeName and APIComponentType int equipmentID = assBus.getEquipmentID(allIDAssessment[i]); EQUIPMENT_MASTER_BUS eqMaBus = new EQUIPMENT_MASTER_BUS(); EQUIPMENT_TYPE_BUS eqTypeBus = new EQUIPMENT_TYPE_BUS(); String equipmentTypename = eqTypeBus.getEquipmentTypeName(eqMaBus.getEquipmentTypeID(equipmentID)); COMPONENT_MASTER_BUS comMasterBus = new COMPONENT_MASTER_BUS(); API_COMPONENT_TYPE_BUS apiBus = new API_COMPONENT_TYPE_BUS(); int apiID = comMasterBus.getAPIComponentTypeID(equipmentID); String API_ComponentType_Name = apiBus.getAPIComponentTypeName(apiID); RW_INPUT_CA_LEVEL_1_BUS busInputCA = new RW_INPUT_CA_LEVEL_1_BUS(); RW_INPUT_CA_LEVEL_1 inputCA = busInputCA.getData(allIDAssessment[i]); SITES_BUS busSite = new SITES_BUS(); FACILITY_BUS busFacility = new FACILITY_BUS(); RW_ASSESSMENT_BUS busAssessment = new RW_ASSESSMENT_BUS(); risk.SitesName = busSite.getSiteName(eqMaBus.getSiteID(equipmentID)); risk.FacilityName = busFacility.getFacilityName(eqMaBus.getFacilityID(equipmentID)); risk.AssessmentName = busAssessment.getAssessmentName(allIDAssessment[i]); risk.EquipmentName = eqMaBus.getEquipmentName(equipmentID); risk.EquipmentNumber = eqMaBus.getEquipmentNumber(equipmentID); //Equipment Name or Equipment Number can dc gan lai risk.EquipmentDesc = eqMaBus.getEquipmentDesc(equipmentID); //Equipment Description gan lai risk.EquipmentType = equipmentTypename; //Equipment type risk.ComponentName = comMasterBus.getComponentName(equipmentID); //component name risk.RepresentFluid = inputCA.API_FLUID; //Represent fluid risk.FluidPhase = inputCA.SYSTEM; //fluid phase risk.currentRisk = 0; //current risk //risk.cofcatFlammable = CA.CA_inj_flame; //cofcat. Flammable //risk.cofcatPeople = CA.FC_inj;//cofcat people //risk.cofcatAsset = CA.FC_prod;//cofcat assessment //risk.cofcatEnv = CA.FC_envi;//cofcat envroment //risk.cofcatReputation = 0; //cof reputation //risk.cofcatCombined = CA.FC_total; //combined //risk.componentMaterialGrade; //component material glade risk.initThinningPoF = fullPoF.ThinningAP1; //Thinning POF risk.initEnvCracking = fullPoF.SCCAP1; //Cracking env risk.initOtherPoF = fullPoF.HTHA_AP1 + fullPoF.BrittleAP1; //OtherPOF risk.initPoF = risk.initThinningPoF + risk.initEnvCracking + risk.initOtherPoF; //Init POF risk.extThinningPoF = fullPoF.ExternalAP1; //Ext Thinning POF risk.extEnvCrackingPoF = 0; //ExtEnv Cracking risk.extOtherPoF = 0; //Ext Other POF risk.extPoF = risk.extThinningPoF + risk.extEnvCrackingPoF + risk.extOtherPoF; //Ext POF risk.PoF = risk.initPoF + risk.extPoF; //POF //risk.CurrentRiskCalculation = fullPoF.PoFAP1 * CA.FC_total; //Current risk //risk.futureRisk = fullPoF.PoFAP2 * CA.FC_total; dataRisk.Add(risk); } return(dataRisk); }