public List <RW_PRIMARY_FLUID> getDataSource() { List <RW_PRIMARY_FLUID> list = new List <RW_PRIMARY_FLUID>(); RW_PRIMARY_FLUID obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "SELECT [ID]" + ",[FluidName]" + ",[NBP]" + ",[MW]" + ",[Density]" + ",[ChemicalFactor]" + ",[HealthDegree]" + ",[Flammability]" + ",[Reactivity]" + " FROM [rbi].[dbo].[RW_PRIMARY_FLUID]" + " "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_PRIMARY_FLUID(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.FluidName = reader.GetString(1); } if (!reader.IsDBNull(2)) { obj.NBP = reader.GetFloat(2); } if (!reader.IsDBNull(3)) { obj.MW = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.Density = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.ChemicalFactor = reader.GetInt32(5); } if (!reader.IsDBNull(6)) { obj.HealthDegree = reader.GetInt32(6); } if (!reader.IsDBNull(7)) { obj.Flammability = reader.GetInt32(7); } if (!reader.IsDBNull(8)) { obj.Reactivity = reader.GetInt32(8); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!", "ERROR!"); } finally { conn.Close(); } return(list); }
public List <RW_ASSESSMENT> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_ASSESSMENT> list = new List <RW_ASSESSMENT>(); RW_ASSESSMENT obj = null; String sql = " Use [rbi] Select [ID]" + ",[EquipmentID]" + ",[ComponentID]" + ",[AssessmentDate]" + ",[AssessmentMethod]" + ",[RiskAnalysisPeriod]" + ",[IsEquipmentLinked]" + ",[RecordType]" + ",[ProposalNo]" + ",[RevisionNo]" + ",[IsRecommend]" + ",[ProposalOrRevision]" + ",[AdoptedBy]" + ",[AdoptedDate]" + ",[RecommendedBy]" + ",[RecommendedDate]" + ",[ProposalName]" + "From [dbo].[RW_ASSESSMENT] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_ASSESSMENT(); obj.ID = reader.GetInt32(0); obj.EquipmentID = reader.GetInt32(1); obj.ComponentID = reader.GetInt32(2); if (!reader.IsDBNull(3)) { obj.AssessmentDate = reader.GetDateTime(3); } if (!reader.IsDBNull(4)) { obj.AssessmentMethod = reader.GetInt32(4); } if (!reader.IsDBNull(5)) { obj.RiskAnalysisPeriod = reader.GetInt32(5); } obj.IsEquipmentLinked = reader.GetOrdinal("IsEquipmentLinked"); if (!reader.IsDBNull(7)) { obj.RecordType = reader.GetString(7); } if (!reader.IsDBNull(8)) { obj.ProposalNo = reader.GetInt32(8); } if (!reader.IsDBNull(9)) { obj.RevisionNo = reader.GetInt32(9); } obj.IsRecommend = reader.GetOrdinal("IsRecommend"); if (!reader.IsDBNull(11)) { obj.ProposalOrRevision = reader.GetString(11); } if (!reader.IsDBNull(12)) { obj.AdoptedBy = reader.GetString(12); } if (!reader.IsDBNull(13)) { obj.AdoptedDate = reader.GetDateTime(13); } if (!reader.IsDBNull(14)) { obj.RecommendedBy = reader.GetString(14); } if (!reader.IsDBNull(15)) { obj.RecommendedDate = reader.GetDateTime(15); } if (!reader.IsDBNull(16)) { obj.ProposalName = reader.GetString(16); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public RW_INPUT_CA_LEVEL_1 GetData(int ID) { RW_INPUT_CA_LEVEL_1 obj = new RW_INPUT_CA_LEVEL_1(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] SELECT [API_FLUID]" + ",[SYSTEM]" + ",[Release_Duration]" + ",[Detection_Type]" + ",[Isulation_Type]" + ",[Mitigation_System]" + ",[Equipment_Cost]" + ",[Injure_Cost]" + ",[Evironment_Cost]" + ",[Toxic_Percent]" + ",[Personal_Density]" + ",[Material_Cost]" + ",[Production_Cost]" + ",[Mass_Inventory]" + ",[Mass_Component]" + ",[Stored_Pressure]" + ",[Stored_Temp]" + " FROM [rbi].[dbo].[RW_INPUT_CA_LEVEL1] 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 = ID; try { obj.API_FLUID = reader.GetString(0); } catch { obj.API_FLUID = ""; } try { obj.SYSTEM = reader.GetString(1); } catch { obj.SYSTEM = "Liquid"; } try { obj.Release_Duration = reader.GetString(2); } catch { obj.Release_Duration = ""; } try { obj.Detection_Type = reader.GetString(3); } catch { obj.Detection_Type = ""; } try { obj.Isulation_Type = reader.GetString(4); } catch { obj.Isulation_Type = ""; } try { obj.Mitigation_System = reader.GetString(5); } catch { obj.Mitigation_System = ""; } try { obj.Equipment_Cost = (float)reader.GetDouble(6); } catch { obj.Equipment_Cost = 0; } try { obj.Injure_Cost = (float)reader.GetDouble(7); } catch { obj.Injure_Cost = 0; } try { obj.Environment_Cost = (float)reader.GetDouble(8); } catch { obj.Environment_Cost = 0; } try { obj.Toxic_Percent = (float)reader.GetDouble(9); } catch { obj.Toxic_Percent = 0; } try { obj.Personal_Density = (float)reader.GetDouble(10); } catch { obj.Personal_Density = 0; } try { obj.Material_Cost = (float)reader.GetDouble(11); } catch { obj.Material_Cost = 0; } try { obj.Production_Cost = (float)reader.GetDouble(12); } catch { obj.Production_Cost = 0; } try { obj.Mass_Inventory = (float)reader.GetDouble(13); } catch { obj.Mass_Inventory = 0; } try { obj.Mass_Component = (float)reader.GetDouble(14); } catch { obj.Mass_Component = 0; } try { obj.Stored_Pressure = (float)reader.GetDouble(15); } catch { obj.Stored_Pressure = 0; } try { obj.Stored_Temp = (float)reader.GetDouble(16); } catch { obj.Stored_Temp = 0; } } } } } catch { obj.ID = 0; //MessageBox.Show("GET DATA FAIL!" + ex.ToString(), "ERROR!"); } finally { conn.Close(); } return(obj); }
public List <RW_MATERIAL> getDataSource() { List <RW_MATERIAL> list = new List <RW_MATERIAL>(); RW_MATERIAL obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] SELECT [ID]" + ",[MaterialName]" + ",[DesignPressure]" + ",[DesignTemperature]" + ",[MinDesignTemperature]" + ",[BrittleFractureThickness]" + ",[CorrosionAllowance]" + ",[SigmaPhase]" + ",[SulfurContent]" + ",[HeatTreatment]" + ",[SteelProductForm]" + ",[ReferenceTemperature]" + ",[PTAMaterialCode]" + ",[HTHAMaterialCode]" + ",[IsPTA]" + ",[IsHTHA]" + ",[Austenitic]" + ",[Temper]" + ",[CarbonLowAlloy]" + ",[NickelBased]" + ",[ChromeMoreEqual12]" + ",[YieldStrength]" + ",[TensileStrength]" + ",[CostFactor]" + "FROM [dbo].[RW_MATERIAL] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_MATERIAL(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.MaterialName = reader.GetString(1); } if (!reader.IsDBNull(2)) { obj.DesignPressure = reader.GetFloat(2); } if (!reader.IsDBNull(3)) { obj.DesignTemperature = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.MinDesignTemperature = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.BrittleFractureThickness = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { obj.CorrosionAllowance = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { obj.SigmaPhase = reader.GetFloat(7); } if (!reader.IsDBNull(8)) { obj.SulfurContent = reader.GetString(8); } if (!reader.IsDBNull(9)) { obj.HeatTreatment = reader.GetString(9); } if (!reader.IsDBNull(10)) { obj.SteelProductForm = reader.GetString(10); } if (!reader.IsDBNull(11)) { obj.ReferenceTemperature = reader.GetFloat(11); } if (!reader.IsDBNull(12)) { obj.PTAMaterialCode = reader.GetString(12); } if (!reader.IsDBNull(13)) { obj.HTHAMaterialCode = reader.GetString(13); } obj.IsPTA = reader.GetInt32(14); obj.IsHTHA = reader.GetInt32(15); obj.Austenitic = reader.GetInt32(16); obj.Temper = reader.GetInt32(17); obj.CarbonLowAlloy = reader.GetInt32(18); obj.NickelBased = reader.GetInt32(19); obj.ChromeMoreEqual12 = reader.GetInt32(20); if (!reader.IsDBNull(21)) { obj.YieldStrength = reader.GetFloat(21); } if (!reader.IsDBNull(22)) { obj.TensileStrength = reader.GetFloat(22); } obj.CostFactor = reader.GetFloat(23); list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!", "ERROR!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <GENERIC_FLUID> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <GENERIC_FLUID> list = new List <GENERIC_FLUID>(); GENERIC_FLUID obj = null; String sql = " Use [rbi] Select [GenericFluidID]" + ",[GenericFluid]" + ",[ExamplesOfApplicable]" + ",[FluidType]" + ",[NBP]" + ",[MW]" + ",[Density]" + ",[AmbientState]" + ",[AutoIgnitionTemperature]" + ",[ChemicalFactor]" + ",[HealthDegree]" + ",[Flammability]" + ",[Reactivity]" + "From [dbo].[GENERIC_FLUID]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new GENERIC_FLUID(); obj.GenericFluidID = reader.GetInt32(0); obj.GenericFluid = reader.GetString(1); if (!reader.IsDBNull(2)) { obj.ExamplesOfApplicable = reader.GetString(2); } obj.FluidType = reader.GetInt32(3); if (!reader.IsDBNull(4)) { obj.NBP = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.MW = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { obj.Density = reader.GetFloat(6); } obj.AmbientState = reader.GetInt32(7); if (!reader.IsDBNull(8)) { obj.AutoIgnitionTemperature = reader.GetInt32(8); } if (!reader.IsDBNull(9)) { obj.ChemicalFactor = reader.GetInt32(9); } if (!reader.IsDBNull(10)) { obj.HealthDegree = reader.GetInt32(10); } if (!reader.IsDBNull(11)) { obj.Flammability = reader.GetInt32(11); } if (!reader.IsDBNull(12)) { obj.Reactivity = reader.GetInt32(12); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public RW_CA_LEVEL_1 getData(int ID) { RW_CA_LEVEL_1 obj = new RW_CA_LEVEL_1(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "SELECT [Release_Phase]" + ",[fact_di]" + ",[fact_mit]" + ",[fact_ait]" + ",[CA_cmd]" + ",[CA_inj_flame]" + ",[CA_inj_toxic]" + ",[CA_inj_ntnf]" + ",[FC_cmd]" + ",[FC_affa]" + ",[FC_prod]" + ",[FC_inj]" + ",[FC_envi]" + ",[FC_total]" + ",[FCOF_Category]" + " FROM [rbi].[dbo].[RW_CA_LEVEL1] 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 = ID; obj.Release_Phase = reader.GetString(0); obj.fact_di = (float)reader.GetDouble(1); obj.fact_mit = (float)reader.GetDouble(2); obj.fact_ait = (float)reader.GetDouble(3); obj.CA_cmd = (float)reader.GetDouble(4); obj.CA_inj_flame = (float)reader.GetDouble(5); obj.CA_inj_toxic = (float)reader.GetDouble(6); obj.CA_inj_ntnf = (float)reader.GetDouble(7); obj.FC_cmd = (float)reader.GetDouble(8); obj.FC_affa = (float)reader.GetDouble(9); obj.FC_prod = (float)reader.GetDouble(10); obj.FC_inj = (float)reader.GetDouble(11); obj.FC_envi = (float)reader.GetDouble(12); obj.FC_total = (float)reader.GetDouble(13); obj.FCOF_Category = reader.GetString(14); } } } } catch { obj.ID = 0; //MessageBox.Show("GET DATA FAIL!", "ERROR!"); } finally { conn.Close(); } return(obj); }
public List <FACILITY_RISK_TARGET> getDataSource() { List <FACILITY_RISK_TARGET> list = new List <FACILITY_RISK_TARGET>(); FACILITY_RISK_TARGET obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "SELECT [FacilityID]" + ",[RiskTarget_A]" + ",[RiskTarget_B]" + ",[RiskTarget_C]" + ",[RiskTarget_D]" + ",[RiskTarget_E]" + ",[RiskTarget_CA]" + ",[RiskTarget_FC]" + " FROM [rbi].[dbo].[FACILITY_RISK_TARGET]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new FACILITY_RISK_TARGET(); obj.FacilityID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.RiskTarget_A = reader.GetFloat(1); } if (!reader.IsDBNull(2)) { obj.RiskTarget_B = reader.GetFloat(2); } if (!reader.IsDBNull(3)) { obj.RiskTarget_C = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.RiskTarget_D = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.RiskTarget_E = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { obj.RiskTarget_CA = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { obj.RiskTarget_FC = reader.GetFloat(7); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); } return(list); }
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 void add(int ID, DateTime CommissionDate, int AdminUpsetManagement, int ContainsDeadlegs, int CyclicOperation, int HighlyDeadlegInsp, int DowntimeProtectionUsed, String ExternalEnvironment, int HeatTraced, int InterfaceSoilWater, int LinerOnlineMonitoring, int MaterialExposedToClExt, double MinReqTemperaturePressurisation, String OnlineMonitoring, int PresenceSulphidesO2, int PresenceSulphidesO2Shutdown, int PressurisationControlled, int PWHT, int SteamOutWaterFlush, double ManagementFactor, String ThermalHistory, int YearLowestExpTemp, double Volume, String TypeOfSoil, String EnvironmentSensitivity, double DistanceToGroundWater, String AdjustmentSettle, int ComponentIsWelded, int TankIsMaintained) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + " " + "INSERT INTO [dbo].[RW_EQUIPMENT]" + "([ID]" + ",[CommissionDate]" + ",[AdminUpsetManagement]" + ",[ContainsDeadlegs]" + ",[CyclicOperation]" + ",[HighlyDeadlegInsp]" + ",[DowntimeProtectionUsed]" + ",[ExternalEnvironment]" + ",[HeatTraced]" + ",[InterfaceSoilWater]" + ",[LinerOnlineMonitoring]" + ",[MaterialExposedToClExt]" + ",[MinReqTemperaturePressurisation]" + ",[OnlineMonitoring]" + ",[PresenceSulphidesO2]" + ",[PresenceSulphidesO2Shutdown]" + ",[PressurisationControlled]" + ",[PWHT]" + ",[SteamOutWaterFlush]" + ",[ManagementFactor]" + ",[ThermalHistory]" + ",[YearLowestExpTemp]" + ",[Volume]" + ",[TypeOfSoil]" + ",[EnvironmentSensitivity]" + ",[DistanceToGroundWater]" + ",[AdjustmentSettle]" + ",[ComponentIsWelded]" + ",[TankIsMaintained])" + "VALUES" + "('" + ID + "'" + ",'" + CommissionDate + "'" + ",'" + AdminUpsetManagement + "'" + ",'" + ContainsDeadlegs + "'" + ",'" + CyclicOperation + "'" + ",'" + HighlyDeadlegInsp + "'" + ",'" + DowntimeProtectionUsed + "'" + ",'" + ExternalEnvironment + "'" + ",'" + HeatTraced + "'" + ",'" + InterfaceSoilWater + "'" + ",'" + LinerOnlineMonitoring + "'" + ",'" + MaterialExposedToClExt + "'" + ",'" + MinReqTemperaturePressurisation + "'" + ",'" + OnlineMonitoring + "'" + ",'" + PresenceSulphidesO2 + "'" + ",'" + PresenceSulphidesO2Shutdown + "'" + ",'" + PressurisationControlled + "'" + ",'" + PWHT + "'" + ",'" + SteamOutWaterFlush + "'" + ",'" + ManagementFactor + "'" + ",'" + ThermalHistory + "'" + ",'" + YearLowestExpTemp + "'" + ",'" + Volume + "'" + ",'" + TypeOfSoil + "'" + ",'" + EnvironmentSensitivity + "'" + ",'" + DistanceToGroundWater + "'" + ",'" + AdjustmentSettle + "'" + ",'" + ComponentIsWelded + "'" + ",'" + TankIsMaintained + "')" + " "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "ADD FAIL!"); } finally { conn.Close(); conn.Dispose(); } }
// get datasource public List <RW_FULL_COF_FLUID> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_FULL_COF_FLUID> list = new List <RW_FULL_COF_FLUID>(); RW_FULL_COF_FLUID obj = null; String sql = "Use[rbi] Select[ID]" + ",[Cp]" + ",[k]" + ",[GFFTotal]" + ",[Kv_n]" + ",[ReleasePhase]" + ",[Cd]" + ",[Ptrans]" + ",[NBP]" + ",[Density]" + ",[MW]" + ",[R]" + ",[Ps]" + ",[Ts]" + ",[Patm]" + ",[fact_di]" + ",[fact_mit]" + ",[fact_AIT]" + ",[g]" + ",[h]" + "From [dbo].[RW_FULL_COF_FLUID] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_FULL_COF_FLUID(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.Cp = reader.GetFloat(1); } if (!reader.IsDBNull(2)) { obj.k = reader.GetFloat(2); } if (!reader.IsDBNull(3)) { obj.GFFTotal = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.Kv_n = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.ReleasePhase = reader.GetString(5); } if (!reader.IsDBNull(6)) { obj.Cd = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { obj.Ptrans = reader.GetFloat(7); } if (!reader.IsDBNull(8)) { obj.NBP = reader.GetFloat(8); } if (!reader.IsDBNull(9)) { obj.Density = reader.GetFloat(9); } if (!reader.IsDBNull(10)) { obj.MW = reader.GetFloat(10); } if (!reader.IsDBNull(11)) { obj.R = reader.GetFloat(11); } if (!reader.IsDBNull(12)) { obj.Ps = reader.GetFloat(12); } if (!reader.IsDBNull(13)) { obj.Ts = reader.GetFloat(13); } if (!reader.IsDBNull(14)) { obj.Patm = reader.GetFloat(14); } if (!reader.IsDBNull(15)) { obj.fact_di = reader.GetFloat(15); } if (!reader.IsDBNull(16)) { obj.fact_mit = reader.GetFloat(16); } if (!reader.IsDBNull(17)) { obj.fact_AIT = reader.GetFloat(17); } if (!reader.IsDBNull(18)) { obj.g = reader.GetFloat(18); } if (!reader.IsDBNull(19)) { obj.h = reader.GetFloat(19); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void add(int ID, float ThinningAP1, float ThinningAP2, float ThinningAP3, float SCCAP1, float SCCAP2, float SCCAP3, float ExternalAP1, float ExternalAP2, float ExternalAP3, float BrittleAP1, float BrittleAP2, float BrittleAP3, float HTHA_AP1, float HTHA_AP2, float HTHA_AP3, float FatigueAP1, float FatigueAP2, String FatigueAP3, float FMS, String ThinningType, float GFFTotal, float ThinningLocalAP1, float ThinningLocalAP2, float ThinningLocalAP3, float ThinningGeneralAP1, float ThinningGeneralAP2, float ThinningGeneralAP3, float TotalDFAP1, float TotalDFAP2, float TotalDFAP3, float PoFAP1, float PoFAP2, float PoFAP3, float MatrixPoFAP1, float MatrixPoFAP2, float MatrixPoFAP3, float RLI, float SemiAP1, float SemiAP2, float SemiAP3, String PoFAP1Category, String PoFAP2Category, String PoFAP3Category, float CoFValue, String CoFCategory, float CoFMatrixValue) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "INSERT INTO [dbo].[RW_FULL_POF]" + "([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])" + " VALUES" + "( '" + 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 + "')"; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "ADD FAIL!"); } finally { conn.Close(); } }
public void add(int ID, double Cp, double k, double GFFTotal, double Kv_n, String ReleasePhase, double Cd, double Ptrans, double NBP, double Density, double MW, double R, double Ps, double Ts, double Patm, double fact_di, double fact_mit, double fact_AIT, double g, double h) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + " " + "INSERT INTO [dbo].[RW_FULL_COF_FLUID]" + "([ID]" + ",[Cp]" + ",[k]" + ",[GFFTotal]" + ",[Kv_n]" + ",[ReleasePhase]" + ",[Cd]" + ",[Ptrans]" + ",[NBP]" + ",[Density]" + ",[MW]" + ",[R]" + ",[Ps]" + ",[Ts]" + ",[Patm]" + ",[fact_di]" + ",[fact_mit]" + ",[fact_AIT]" + ",[g]" + ",[h])" + "VALUES" + "('" + ID + "'" + ",'" + Cp + "'" + ",'" + k + "'" + ",'" + GFFTotal + "'" + ",'" + Kv_n + "'" + ",'" + ReleasePhase + "'" + ",'" + Cd + "'" + ",'" + Ptrans + "'" + ",'" + NBP + "'" + ",'" + Density + "'" + ",'" + MW + "'" + ",'" + R + "'" + ",'" + Ps + "'" + ",'" + Ts + "'" + ",'" + Patm + "'" + ",'" + fact_di + "'" + ",'" + fact_mit + "'" + ",'" + fact_AIT + "'" + ",'" + g + "'" + ",'" + h + "')" + " "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "ADD FAIL!"); } finally { conn.Close(); conn.Dispose(); } }
public RW_CA_TANK getData(int ID) { RW_CA_TANK obj = new RW_CA_TANK(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "SELECT [Hydraulic_Water] " + ",[Hydraulic_Fluid] " + ",[Seepage_Velocity] " + ",[Flow_Rate_D1] " + ",[Flow_Rate_D2] " + ",[Flow_Rate_D3] " + ",[Flow_Rate_D4] " + ",[Leak_Duration_D1] " + ",[Leak_Duration_D2] " + ",[Leak_Duration_D3] " + ",[Leak_Duration_D4] " + ",[Release_Volume_Leak_D1] " + ",[Release_Volume_Leak_D2] " + ",[Release_Volume_Leak_D3] " + ",[Release_Volume_Leak_D4] " + ",[Release_Volume_Rupture] " + ",[Liquid_Height] " + ",[Volume_Fluid] " + ",[Time_Leak_Ground] " + ",[Volume_SubSoil_Leak_D1] " + ",[Volume_SubSoil_Leak_D4] " + ",[Volume_Ground_Water_Leak_D1] " + ",[Volume_Ground_Water_Leak_D4] " + ",[Barrel_Dike_Leak] " + ",[Barrel_Dike_Rupture] " + ",[Barrel_Onsite_Leak] " + ",[Barrel_Onsite_Rupture] " + ",[Barrel_Offsite_Leak] " + ",[Barrel_Offsite_Rupture] " + ",[Barrel_Water_Leak] " + ",[Barrel_Water_Rupture] " + ",[FC_Environ_Leak] " + ",[FC_Environ_Rupture] " + ",[FC_Environ] " + ",[Material_Factor] " + ",[Component_Damage_Cost] " + ",[Business_Cost] " + ",[Consequence] " + ",[ConsequenceCategory] " + " FROM [rbi].[dbo].[RW_CA_TANK] 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 = ID; obj.Hydraulic_Water = (float)reader.GetDouble(0); obj.Hydraulic_Fluid = (float)reader.GetDouble(1); obj.Seepage_Velocity = (float)reader.GetDouble(2); obj.Flow_Rate_D1 = (float)reader.GetDouble(3); obj.Flow_Rate_D2 = (float)reader.GetDouble(4); obj.Flow_Rate_D3 = (float)reader.GetDouble(5); obj.Flow_Rate_D4 = (float)reader.GetDouble(6); obj.Leak_Duration_D1 = (float)reader.GetDouble(7); obj.Leak_Duration_D2 = (float)reader.GetDouble(8); obj.Leak_Duration_D3 = (float)reader.GetDouble(9); obj.Leak_Duration_D4 = (float)reader.GetDouble(10); obj.Release_Volume_Leak_D1 = (float)reader.GetDouble(11); obj.Release_Volume_Leak_D2 = (float)reader.GetDouble(12); obj.Release_Volume_Leak_D3 = (float)reader.GetDouble(13); obj.Release_Volume_Leak_D4 = (float)reader.GetDouble(14); obj.Release_Volume_Rupture = (float)reader.GetDouble(15); obj.Liquid_Height = (float)reader.GetDouble(16); obj.Volume_Fluid = (float)reader.GetDouble(17); obj.Time_Leak_Ground = (float)reader.GetDouble(18); obj.Volume_SubSoil_Leak_D1 = (float)reader.GetDouble(19); obj.Volume_SubSoil_Leak_D4 = (float)reader.GetDouble(20); obj.Volume_Ground_Water_Leak_D1 = (float)reader.GetDouble(21); obj.Volume_Ground_Water_Leak_D4 = (float)reader.GetDouble(22); obj.Barrel_Dike_Leak = (float)reader.GetDouble(23); obj.Barrel_Dike_Rupture = (float)reader.GetDouble(24); obj.Barrel_Onsite_Leak = (float)reader.GetDouble(25); obj.Barrel_Onsite_Rupture = (float)reader.GetDouble(26); obj.Barrel_Offsite_Leak = (float)reader.GetDouble(27); obj.Barrel_Offsite_Rupture = (float)reader.GetDouble(28); obj.Barrel_Water_Leak = (float)reader.GetDouble(29); obj.Barrel_Water_Rupture = (float)reader.GetDouble(30); obj.FC_Environ_Leak = (float)reader.GetDouble(31); obj.FC_Environ_Rupture = (float)reader.GetDouble(32); obj.FC_Environ = (float)reader.GetDouble(33); obj.Material_Factor = (float)reader.GetDouble(34); obj.Component_Damage_Cost = (float)reader.GetDouble(35); obj.Business_Cost = (float)reader.GetDouble(36); obj.Consequence = (float)reader.GetDouble(37); obj.ConsequenceCategory = reader.GetString(38); } } } } catch { MessageBox.Show("GET DATA FAIL!", "ERROR!"); } finally { conn.Close(); conn.Dispose(); } return(obj); }
public void add(int ID, float Hydraulic_Water, float Hydraulic_Fluid, float Seepage_Velocity, float Flow_Rate_D1, float Flow_Rate_D2, float Flow_Rate_D3, float Flow_Rate_D4, float Leak_Duration_D1, float Leak_Duration_D2, float Leak_Duration_D3, float Leak_Duration_D4, float Release_Volume_Leak_D1, float Release_Volume_Leak_D2, float Release_Volume_Leak_D3, float Release_Volume_Leak_D4, float Release_Volume_Rupture, float Liquid_Height, float Volume_Fluid, float Time_Leak_Ground, float Volume_SubSoil_Leak_D1, float Volume_SubSoil_Leak_D4, float Volume_Ground_Water_Leak_D1, float Volume_Ground_Water_Leak_D4, float Barrel_Dike_Leak, float Barrel_Dike_Rupture, float Barrel_Onsite_Leak, float Barrel_Onsite_Rupture, float Barrel_Offsite_Leak, float Barrel_Offsite_Rupture, float Barrel_Water_Leak, float Barrel_Water_Rupture, float FC_Environ_Leak, float FC_Environ_Rupture, float FC_Environ, float Material_Factor, float Component_Damage_Cost, float Business_Cost, float Consequence, String ConsequenceCategory) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "INSERT INTO [dbo].[RW_CA_TANK]" + "([ID]" + ",[Hydraulic_Water]" + ",[Hydraulic_Fluid]" + ",[Seepage_Velocity]" + ",[Flow_Rate_D1]" + ",[Flow_Rate_D2]" + ",[Flow_Rate_D3]" + ",[Flow_Rate_D4]" + ",[Leak_Duration_D1]" + ",[Leak_Duration_D2]" + ",[Leak_Duration_D3]" + ",[Leak_Duration_D4]" + ",[Release_Volume_Leak_D1]" + ",[Release_Volume_Leak_D2]" + ",[Release_Volume_Leak_D3]" + ",[Release_Volume_Leak_D4]" + ",[Release_Volume_Rupture]" + ",[Liquid_Height]" + ",[Volume_Fluid]" + ",[Time_Leak_Ground]" + ",[Volume_SubSoil_Leak_D1]" + ",[Volume_SubSoil_Leak_D4]" + ",[Volume_Ground_Water_Leak_D1]" + ",[Volume_Ground_Water_Leak_D4]" + ",[Barrel_Dike_Leak]" + ",[Barrel_Dike_Rupture]" + ",[Barrel_Onsite_Leak]" + ",[Barrel_Onsite_Rupture]" + ",[Barrel_Offsite_Leak]" + ",[Barrel_Offsite_Rupture]" + ",[Barrel_Water_Leak]" + ",[Barrel_Water_Rupture]" + ",[FC_Environ_Leak]" + ",[FC_Environ_Rupture]" + ",[FC_Environ]" + ",[Material_Factor]" + ",[Component_Damage_Cost]" + ",[Business_Cost]" + ",[Consequence]" + ",[ConsequenceCategory])" + " VALUES " + "('" + ID + "'" + ",'" + Hydraulic_Water + "'" + ",'" + Hydraulic_Fluid + "'" + ",'" + Seepage_Velocity + "'" + ",'" + Flow_Rate_D1 + "'" + ",'" + Flow_Rate_D2 + "'" + ",'" + Flow_Rate_D3 + "'" + ",'" + Flow_Rate_D4 + "'" + ",'" + Leak_Duration_D1 + "'" + ",'" + Leak_Duration_D2 + "'" + ",'" + Leak_Duration_D3 + "'" + ",'" + Leak_Duration_D4 + "'" + ",'" + Release_Volume_Leak_D1 + "'" + ",'" + Release_Volume_Leak_D2 + "'" + ",'" + Release_Volume_Leak_D3 + "'" + ",'" + Release_Volume_Leak_D4 + "'" + ",'" + Release_Volume_Rupture + "'" + ",'" + Liquid_Height + "'" + ",'" + Volume_Fluid + "'" + ",'" + Time_Leak_Ground + "'" + ",'" + Volume_SubSoil_Leak_D1 + "'" + ",'" + Volume_SubSoil_Leak_D4 + "'" + ",'" + Volume_Ground_Water_Leak_D1 + "'" + ",'" + Volume_Ground_Water_Leak_D4 + "'" + ",'" + Barrel_Dike_Leak + "'" + ",'" + Barrel_Dike_Rupture + "'" + ",'" + Barrel_Onsite_Leak + "'" + ",'" + Barrel_Onsite_Rupture + "'" + ",'" + Barrel_Offsite_Leak + "'" + ",'" + Barrel_Offsite_Rupture + "'" + ",'" + Barrel_Water_Leak + "'" + ",'" + Barrel_Water_Rupture + "'" + ",'" + FC_Environ_Leak + "'" + ",'" + FC_Environ_Rupture + "'" + ",'" + FC_Environ + "'" + ",'" + Material_Factor + "'" + ",'" + Component_Damage_Cost + "'" + ",'" + Business_Cost + "'" + ",'" + Consequence + "'" + ",'" + ConsequenceCategory + "')"; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("ADD DATA FAIL!" + ex.ToString(), "ERROR!"); } finally { conn.Close(); conn.Dispose(); } }
public RW_STREAM getData(int ID) { RW_STREAM obj = new RW_STREAM(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "" + "SELECT [ID]" + ",[AmineSolution]" + ",[AqueousOperation]" + ",[AqueousShutdown]" + ",[ToxicConstituent]" + ",[Caustic]" + ",[Chloride]" + ",[CO3Concentration]" + ",[Cyanide]" + ",[ExposedToGasAmine]" + ",[ExposedToSulphur]" + ",[ExposureToAmine]" + ",[FlammableFluidID]" + ",[FlowRate]" + ",[H2S]" + ",[H2SInWater]" + ",[Hydrogen]" + ",[H2SPartialPressure]" + ",[Hydrofluoric]" + ",[MaterialExposedToClInt]" + ",[MaxOperatingPressure]" + ",[MaxOperatingTemperature]" + ",[MinOperatingPressure]" + ",[MinOperatingTemperature]" + ",[CriticalExposureTemperature]" + ",[ModelFluidID]" + ",[NaOHConcentration]" + ",[NonFlameToxicFluidID]" + ",[ReleaseFluidPercentToxic]" + ",[StoragePhase]" + ",[ToxicFluidID]" + ",[WaterpH]" + ",[TankFluidName]" + ",[FluidHeight]" + ",[FluidLeaveDikePercent]" + ",[FluidLeaveDikeRemainOnSitePercent]" + ",[FluidGoOffSitePercent]" + " FROM [rbi].[dbo].[RW_STREAM] 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.AmineSolution = reader.GetString(1); } obj.AqueousOperation = Convert.ToInt32(reader.GetBoolean(2)); obj.AqueousShutdown = Convert.ToInt32(reader.GetBoolean(3)); obj.ToxicConstituent = Convert.ToInt32(reader.GetBoolean(4)); obj.Caustic = Convert.ToInt32(reader.GetBoolean(5)); if (!reader.IsDBNull(6)) { obj.Chloride = (float)reader.GetDouble(6); } if (!reader.IsDBNull(7)) { obj.CO3Concentration = (float)reader.GetDouble(7); } obj.Cyanide = Convert.ToInt32(reader.GetBoolean(8)); obj.ExposedToGasAmine = Convert.ToInt32(reader.GetBoolean(9)); obj.ExposedToSulphur = Convert.ToInt32(reader.GetBoolean(10)); if (!reader.IsDBNull(11)) { obj.ExposureToAmine = reader.GetString(11); } if (!reader.IsDBNull(12)) { obj.FlammableFluidID = reader.GetInt32(12); } if (!reader.IsDBNull(13)) { obj.FlowRate = (float)reader.GetDouble(13); } obj.H2S = Convert.ToInt32(reader.GetBoolean(14)); if (!reader.IsDBNull(15)) { obj.H2SInWater = (float)reader.GetDouble(15); } obj.Hydrogen = Convert.ToInt32(reader.GetBoolean(16)); if (!reader.IsDBNull(17)) { obj.H2SPartialPressure = (float)reader.GetDouble(17); } obj.Hydrofluoric = Convert.ToInt32(reader.GetBoolean(18)); obj.MaterialExposedToClInt = Convert.ToInt32(reader.GetBoolean(19)); if (!reader.IsDBNull(20)) { obj.MaxOperatingPressure = (float)reader.GetDouble(20); } if (!reader.IsDBNull(21)) { obj.MaxOperatingTemperature = (float)reader.GetDouble(21); } if (!reader.IsDBNull(22)) { obj.MinOperatingPressure = (float)reader.GetDouble(22); } if (!reader.IsDBNull(23)) { obj.MinOperatingTemperature = (float)reader.GetDouble(23); } if (!reader.IsDBNull(24)) { obj.CriticalExposureTemperature = (float)reader.GetDouble(24); } if (!reader.IsDBNull(25)) { obj.ModelFluidID = reader.GetInt32(25); } if (!reader.IsDBNull(26)) { obj.NaOHConcentration = (float)reader.GetDouble(26); } if (!reader.IsDBNull(27)) { obj.NonFlameToxicFluidID = reader.GetInt32(27); } if (!reader.IsDBNull(28)) { obj.ReleaseFluidPercentToxic = (float)reader.GetDouble(28); } if (!reader.IsDBNull(29)) { obj.StoragePhase = reader.GetString(29); } if (!reader.IsDBNull(30)) { obj.ToxicFluidID = reader.GetInt32(30); } if (!reader.IsDBNull(31)) { obj.WaterpH = (float)reader.GetDouble(31); } if (!reader.IsDBNull(32)) { obj.TankFluidName = reader.GetString(32); } if (!reader.IsDBNull(33)) { obj.FluidHeight = (float)reader.GetDouble(33); } if (!reader.IsDBNull(34)) { obj.FluidLeaveDikePercent = (float)reader.GetDouble(34); } if (!reader.IsDBNull(35)) { obj.FluidLeaveDikeRemainOnSitePercent = (float)reader.GetDouble(35); } if (!reader.IsDBNull(36)) { obj.FluidGoOffSitePercent = (float)reader.GetDouble(36); } } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(obj); }
public RW_EQUIPMENT getdata(int ID) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); RW_EQUIPMENT obj = new RW_EQUIPMENT(); String sql = "Use[rbi] Select[ID]" + ",[CommissionDate]" + ",[AdminUpsetManagement]" + ",[ContainsDeadlegs]" + ",[CyclicOperation]" + ",[HighlyDeadlegInsp]" + ",[DowntimeProtectionUsed]" + ",[ExternalEnvironment]" + ",[HeatTraced]" + ",[InterfaceSoilWater]" + ",[LinerOnlineMonitoring]" + ",[MaterialExposedToClExt]" + ",[MinReqTemperaturePressurisation]" + ",[OnlineMonitoring]" + ",[PresenceSulphidesO2]" + ",[PresenceSulphidesO2Shutdown]" + ",[PressurisationControlled]" + ",[PWHT]" + ",[SteamOutWaterFlush]" + ",[ManagementFactor]" + ",[ThermalHistory]" + ",[YearLowestExpTemp]" + ",[Volume]" + ",[TypeOfSoil]" + ",[EnvironmentSensitivity]" + ",[DistanceToGroundWater]" + ",[AdjustmentSettle]" + ",[ComponentIsWelded]" + ",[TankIsMaintained]" + "From [dbo].[RW_EQUIPMENT] 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); obj.CommissionDate = reader.GetDateTime(1); obj.AdminUpsetManagement = Convert.ToInt32(reader.GetBoolean(2)); obj.ContainsDeadlegs = Convert.ToInt32(reader.GetBoolean(3)); obj.CyclicOperation = Convert.ToInt32(reader.GetBoolean(4)); obj.HighlyDeadlegInsp = Convert.ToInt32(reader.GetBoolean(5)); obj.DowntimeProtectionUsed = Convert.ToInt32(reader.GetBoolean(6)); if (!reader.IsDBNull(7)) { obj.ExternalEnvironment = reader.GetString(7); } obj.HeatTraced = Convert.ToInt32(reader.GetBoolean(8)); obj.InterfaceSoilWater = Convert.ToInt32(reader.GetBoolean(9)); obj.LinerOnlineMonitoring = Convert.ToInt32(reader.GetBoolean(10)); obj.MaterialExposedToClExt = Convert.ToInt32(reader.GetBoolean(11)); if (!reader.IsDBNull(12)) { obj.MinReqTemperaturePressurisation = (float)reader.GetDouble(12); } if (!reader.IsDBNull(13)) { obj.OnlineMonitoring = reader.GetString(13); } obj.PresenceSulphidesO2 = Convert.ToInt32(reader.GetBoolean(14)); obj.PresenceSulphidesO2Shutdown = Convert.ToInt32(reader.GetBoolean(15)); obj.PressurisationControlled = Convert.ToInt32(reader.GetBoolean(16)); obj.PWHT = Convert.ToInt32(reader.GetBoolean(17)); obj.SteamOutWaterFlush = Convert.ToInt32(reader.GetBoolean(18)); if (!reader.IsDBNull(19)) { obj.ManagementFactor = (float)reader.GetDouble(19); } if (!reader.IsDBNull(20)) { obj.ThermalHistory = reader.GetString(20); } obj.YearLowestExpTemp = Convert.ToInt32(reader.GetBoolean(21)); if (!reader.IsDBNull(22)) { obj.Volume = (float)reader.GetDouble(22); } if (!reader.IsDBNull(23)) { obj.TypeOfSoil = reader.GetString(23); } if (!reader.IsDBNull(24)) { obj.EnvironmentSensitivity = reader.GetString(24); } if (!reader.IsDBNull(25)) { obj.DistanceToGroundWater = (float)reader.GetDouble(25); } if (!reader.IsDBNull(26)) { obj.AdjustmentSettle = reader.GetString(26); } obj.ComponentIsWelded = Convert.ToInt32(reader.GetBoolean(27)); obj.TankIsMaintained = Convert.ToInt32(reader.GetBoolean(28)); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL"); } finally { conn.Close(); conn.Dispose(); } return(obj); }
public List <EQUIPMENT_REVISION_INSPECTION> getDataSource() { List <EQUIPMENT_REVISION_INSPECTION> list = new List <EQUIPMENT_REVISION_INSPECTION>(); EQUIPMENT_REVISION_INSPECTION obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE[rbi]" + "SELECT [RevisionID]" + ",[CoverageDetailID]" + ",[ComponentNumber]" + ",[CoverageID]" + ",[DMItemID]" + ",[IMTypeID]" + ",[InspectionDate]" + ",[EffectivenessCode]" + ",[CarriedOut]" + ",[CarriedOutDate]" + "FROM [rbi].[dbo].[EQUIPMENT_REVISION_INSPECTION]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new EQUIPMENT_REVISION_INSPECTION(); obj.RevisionID = reader.GetInt32(0); obj.CoverageDetailID = reader.GetInt32(1); obj.ComponentNumber = reader.GetString(2); obj.CoverageID = reader.GetInt32(3); obj.DMItemID = reader.GetInt32(4); obj.IMTypeID = reader.GetInt32(5); obj.InspectionDate = reader.GetDateTime(6); obj.EffectivenessCode = reader.GetString(7); obj.CarriedOut = reader.GetInt32(8); if (!reader.IsDBNull(9)) { obj.CarriedOutDate = reader.GetDateTime(9); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <FILE_FACILITY> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <FILE_FACILITY> list = new List <FILE_FACILITY>(); FILE_FACILITY obj = null; String sql = " Use [rbi] Select [FileID]" + ",[FacilityID]" + ",[FileDocName]" + ",[FileType]" + ",[FileDescription]" + ",[OriFileName]" + ",[FileBinary]" + ",[FileSize]" + ",[FileExt]" + ",[DateUploaded]" + "From [dbo].[FILE_FACILITY]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new FILE_FACILITY(); obj.FileID = reader.GetInt32(0); obj.FacilityID = reader.GetInt32(1); obj.FileDocName = reader.GetString(2); obj.FileType = reader.GetInt32(3); if (!reader.IsDBNull(4)) { obj.FileDescription = reader.GetString(4); } obj.OriFileName = reader.GetString(5); obj.FileBinary = (byte[])reader[6]; obj.FileSize = reader.GetString(7); obj.FileExt = reader.GetString(8); obj.DateUploaded = reader.GetDateTime(9); list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <EQUIPMENT_REVISION> getDataSource() { List <EQUIPMENT_REVISION> list = new List <EQUIPMENT_REVISION>(); EQUIPMENT_REVISION obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "SELECT [RevisionID]" + ",[EquipmentID]" + ",[RevisionXML]" + ",[RevisionNo]" + ",[IssuedBy]" + ",[IssuedDate]" + ",[ReviewedBy]" + ",[ReviewedDate]" + ",[IsReviewed]" + ",[ApprovedBy]" + ",[ApprovedDate]" + ",[IsApproved]" + ",[EndorsedBy]" + ",[EndorsedDate]" + "FROM [rbi].[dbo].[EQUIPMENT_REVISION]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new EQUIPMENT_REVISION(); obj.RevisionID = reader.GetInt32(0); obj.EquipmentID = reader.GetInt32(1); obj.RevisionXML = reader.GetString(2); obj.RevisionNo = reader.GetInt32(3); if (!reader.IsDBNull(4)) { obj.IssuedBy = reader.GetString(4); } if (!reader.IsDBNull(5)) { obj.IssuedDate = reader.GetDateTime(5); } if (!reader.IsDBNull(6)) { obj.ReviewedBy = reader.GetString(6); } if (!reader.IsDBNull(7)) { obj.ReviewedDate = reader.GetDateTime(7); } obj.IsReviewed = reader.GetInt32(8); if (!reader.IsDBNull(9)) { obj.ApprovedBy = reader.GetString(9); } if (!reader.IsDBNull(10)) { obj.ApprovedDate = reader.GetDateTime(10); } obj.IsApproved = reader.GetInt32(11); if (!reader.IsDBNull(12)) { obj.EndorsedBy = reader.GetString(12); } if (!reader.IsDBNull(13)) { obj.EndorsedDate = reader.GetDateTime(13); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void edit(int EquipmentID, String ObjectField001, String ObjectField002, String ObjectField003, String ObjectField004, String ObjectField005, String ObjectField006, String ObjectField007, String ObjectField008, String ObjectField009, String ObjectField010, String ObjectField011, String ObjectField012, String ObjectField013, String ObjectField014, String ObjectField015, String ObjectField016, String ObjectField017, String ObjectField018, String ObjectField019, String ObjectField020, String ObjectField021, String ObjectField022, String ObjectField023, String ObjectField024, String ObjectField025, String ObjectField026, String ObjectField027, String ObjectField028, String ObjectField029, String ObjectField030, String ObjectField031, String ObjectField032, String ObjectField033, String ObjectField034, String ObjectField035, String ObjectField036, String ObjectField037, String ObjectField038, String ObjectField039, String ObjectField040, String ObjectField041, String ObjectField042, String ObjectField043, String ObjectField044, String ObjectField045, String ObjectField046, String ObjectField047, String ObjectField048, String ObjectField049, String ObjectField050) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + " UPDATE[dbo].[EQUIPMENT_EXTRA_FIELDS]" + "SET[EquipmentID] ='" + EquipmentID + "'" + ",[ObjectField001] = '" + ObjectField001 + "'" + ",[ObjectField002] = '" + ObjectField002 + "'" + ",[ObjectField003] = '" + ObjectField003 + "'" + ",[ObjectField004] = '" + ObjectField004 + "'" + ",[ObjectField005] = '" + ObjectField005 + "'" + ",[ObjectField006] = '" + ObjectField006 + "'" + ",[ObjectField007] = '" + ObjectField008 + "'" + ",[ObjectField009] = '" + ObjectField009 + "'" + ",[ObjectField010] = '" + ObjectField010 + "'" + ",[ObjectField011] = '" + ObjectField011 + "'" + ",[ObjectField012] = '" + ObjectField012 + "'" + ",[ObjectField013] = '" + ObjectField013 + "'" + ",[ObjectField014] = '" + ObjectField014 + "'" + ",[ObjectField015] = '" + ObjectField015 + "'" + ",[ObjectField016] = '" + ObjectField016 + "'" + ",[ObjectField017] = '" + ObjectField017 + "'" + ",[ObjectField018] = '" + ObjectField018 + "'" + ",[ObjectField020] = '" + ObjectField020 + "'" + ",[ObjectField021] = '" + ObjectField021 + "'" + ",[ObjectField022] = '" + ObjectField022 + "'" + ",[ObjectField023] = '" + ObjectField023 + "'" + ",[ObjectField024] = '" + ObjectField024 + "'" + ",[ObjectField025] = '" + ObjectField025 + "'" + ",[ObjectField026] = '" + ObjectField026 + "'" + ",[ObjectField027] = '" + ObjectField027 + "'" + ",[ObjectField028] = '" + ObjectField028 + "'" + ",[ObjectField029] = '" + ObjectField029 + "'" + ",[ObjectField030] = '" + ObjectField030 + "'" + ",[ObjectField031] = '" + ObjectField031 + "'" + ",[ObjectField032] = '" + ObjectField032 + "'" + ",[ObjectField033] = '" + ObjectField033 + "'" + ",[ObjectField034] = '" + ObjectField034 + "'" + ",[ObjectField035] = '" + ObjectField035 + "'" + ",[ObjectField036] = '" + ObjectField036 + "'" + ",[ObjectField037] = '" + ObjectField037 + "'" + ",[ObjectField038] = '" + ObjectField038 + "'" + ",[ObjectField039] = '" + ObjectField039 + "'" + ",[ObjectField040] = '" + ObjectField040 + "'" + ",[ObjectField041] = '" + ObjectField041 + "'" + ",[ObjectField042] = '" + ObjectField042 + "'" + ",[ObjectField043] = '" + ObjectField043 + "'" + ",[ObjectField044] = '" + ObjectField044 + "'" + ",[ObjectField045] = '" + ObjectField045 + "'" + ",[ObjectField046] = '" + ObjectField046 + "'" + ",[ObjectField047] = '" + ObjectField047 + "'" + ",[ObjectField048] = '" + ObjectField048 + "'" + ",[ObjectField049] = '" + ObjectField049 + "'" + ",[ObjectField050] = '" + ObjectField050 + "'" + "WHERE [EquipmentID] ='" + EquipmentID + "'"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "EDIT FAIL!"); } finally { conn.Close(); conn.Dispose(); } }
public void add(int ID, String MaterialName, float DesignPressure, float DesignTemperature, float MinDesignTemperature, float BrittleFractureThickness, float CorrosionAllowance, float SigmaPhase, String SulfurContent, String HeatTreatment, String SteelProductForm, float ReferenceTemperature, String PTAMaterialCode, String HTHAMaterialCode, int IsPTA, int IsHTHA, int Austenitic, int Temper, int CarbonLowAlloy, int NickelBased, int ChromeMoreEqual12, float YieldStrength, float TensileStrength, float CostFactor) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "INSERT INTO [dbo].[RW_MATERIAL]" + "([ID]" + ",[MaterialName]" + ",[DesignPressure]" + ",[DesignTemperature]" + ",[MinDesignTemperature]" + ",[BrittleFractureThickness]" + ",[CorrosionAllowance]" + ",[SigmaPhase]" + ",[SulfurContent]" + ",[HeatTreatment]" + ",[SteelProductForm]" + ",[ReferenceTemperature]" + ",[PTAMaterialCode]" + ",[HTHAMaterialCode]" + ",[IsPTA]" + ",[IsHTHA]" + ",[Austenitic]" + ",[Temper]" + ",[CarbonLowAlloy]" + ",[NickelBased]" + ",[ChromeMoreEqual12]" + ",[YieldStrength]" + ",[TensileStrength]" + ",[CostFactor])" + " VALUES" + "( '" + ID + "'" + ", '" + MaterialName + "'" + ", '" + DesignPressure + "'" + ", '" + DesignTemperature + "'" + ", '" + MinDesignTemperature + "'" + ", '" + BrittleFractureThickness + "'" + ", '" + CorrosionAllowance + "'" + ", '" + SigmaPhase + "'" + ", '" + SulfurContent + "'" + ", '" + HeatTreatment + "'" + ", '" + SteelProductForm + "'" + ", '" + ReferenceTemperature + "'" + ", '" + PTAMaterialCode + "'" + ", '" + HTHAMaterialCode + "'" + ", '" + IsPTA + "'" + ", '" + IsHTHA + "'" + ", '" + Austenitic + "'" + ", '" + Temper + "'" + ", '" + CarbonLowAlloy + "'" + ", '" + NickelBased + "'" + ", '" + ChromeMoreEqual12 + "'" + ", '" + YieldStrength + "'" + ", '" + TensileStrength + "'" + ", '" + CostFactor + "')"; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "ADD FAIL!"); } finally { conn.Close(); conn.Dispose(); } }
public List <EQUIPMENT_REVISION_INSPECTION_COVERAGE> getDataSource() { List <EQUIPMENT_REVISION_INSPECTION_COVERAGE> list = new List <EQUIPMENT_REVISION_INSPECTION_COVERAGE>(); EQUIPMENT_REVISION_INSPECTION_COVERAGE obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE[rbi]" + "SELECT [RevisionID]" + ",[CoverageID]" + ",[InspPlanName]" + ",[InspPlanDate]" + ",[CoverageName]" + ",[CoverageDate]" + ",[Remarks]" + ",[Findings]" + ",[FindingRTF]" + "FROM [rbi].[dbo].[EQUIPMENT_REVISION_INSPECTION_COVERAGE]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new EQUIPMENT_REVISION_INSPECTION_COVERAGE(); obj.RevisionID = reader.GetInt32(0); obj.CoverageID = reader.GetInt32(1); obj.InspPlanName = reader.GetString(2); if (!reader.IsDBNull(3)) { obj.InspPlanDate = reader.GetDateTime(3); } obj.CoverageName = reader.GetString(4); if (!reader.IsDBNull(5)) { obj.CoverageDate = reader.GetDateTime(5); } if (!reader.IsDBNull(6)) { obj.Remarks = reader.GetString(6); } if (!reader.IsDBNull(7)) { obj.Findings = reader.GetString(7); } if (!reader.IsDBNull(8)) { obj.FindingRTF = reader.GetString(8); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public RW_MATERIAL getData(int id) { RW_MATERIAL obj = new RW_MATERIAL(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] SELECT [ID]" + ",[MaterialName]" + ",[DesignPressure]" + ",[DesignTemperature]" + ",[MinDesignTemperature]" + ",[BrittleFractureThickness]" + ",[CorrosionAllowance]" + ",[SigmaPhase]" + ",[SulfurContent]" + ",[HeatTreatment]" + ",[SteelProductForm]" + ",[ReferenceTemperature]" + ",[PTAMaterialCode]" + ",[HTHAMaterialCode]" + ",[IsPTA]" + ",[IsHTHA]" + ",[Austenitic]" + ",[Temper]" + ",[CarbonLowAlloy]" + ",[NickelBased]" + ",[ChromeMoreEqual12]" + ",[YieldStrength]" + ",[TensileStrength]" + ",[CostFactor]" + "FROM [dbo].[RW_MATERIAL] 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.MaterialName = reader.GetString(1); } if (!reader.IsDBNull(2)) { obj.DesignPressure = (float)reader.GetDouble(2); } if (!reader.IsDBNull(3)) { obj.DesignTemperature = (float)reader.GetDouble(3); } if (!reader.IsDBNull(4)) { obj.MinDesignTemperature = (float)reader.GetDouble(4); } if (!reader.IsDBNull(5)) { obj.BrittleFractureThickness = (float)reader.GetDouble(5); } if (!reader.IsDBNull(6)) { obj.CorrosionAllowance = (float)reader.GetDouble(6); } if (!reader.IsDBNull(7)) { obj.SigmaPhase = (float)reader.GetDouble(7); } if (!reader.IsDBNull(8)) { obj.SulfurContent = reader.GetString(8); } if (!reader.IsDBNull(9)) { obj.HeatTreatment = reader.GetString(9); } if (!reader.IsDBNull(10)) { obj.SteelProductForm = reader.GetString(10); } if (!reader.IsDBNull(11)) { obj.ReferenceTemperature = (float)reader.GetDouble(11); } if (!reader.IsDBNull(12)) { obj.PTAMaterialCode = reader.GetString(12); } if (!reader.IsDBNull(13)) { obj.HTHAMaterialCode = reader.GetString(13); } obj.IsPTA = Convert.ToInt32(reader.GetBoolean(14)); obj.IsHTHA = Convert.ToInt32(reader.GetBoolean(15)); obj.Austenitic = Convert.ToInt32(reader.GetBoolean(16)); obj.Temper = Convert.ToInt32(reader.GetBoolean(17)); obj.CarbonLowAlloy = Convert.ToInt32(reader.GetBoolean(18)); obj.NickelBased = Convert.ToInt32(reader.GetBoolean(19)); obj.ChromeMoreEqual12 = Convert.ToInt32(reader.GetBoolean(20)); if (!reader.IsDBNull(21)) { obj.YieldStrength = (float)reader.GetDouble(21); } if (!reader.IsDBNull(22)) { obj.TensileStrength = (float)reader.GetDouble(22); } obj.CostFactor = (float)reader.GetDouble(23); } } } } catch (Exception ex) { MessageBox.Show("GET DATA SOURCE FAIL!" + ex.ToString(), "ERROR!"); } finally { conn.Close(); conn.Dispose(); } return(obj); }
// dung file get data // dung file get list( data source) public List <RW_LF_MASTER> getDataSource() { List <RW_LF_MASTER> list = new List <RW_LF_MASTER>(); RW_LF_MASTER obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "SELECT [ID]" + ",[LF1Factor]" + ",[LF4Factor]" + ",[LF5Factor]" + ",[LF6Factor]" + ",[LF7Factor]" + ",[LF1]" + ",[LF4]" + ",[LF5]" + ",[LF6]" + ",[LF7]" + " FROM [rbi].[dbo].[RW_LF_MASTER]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_LF_MASTER(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.LF1Factor = reader.GetFloat(1); } if (!reader.IsDBNull(2)) { obj.LF4Factor = reader.GetFloat(2); } if (!reader.IsDBNull(3)) { obj.LF5Factor = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.LF6Factor = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.LF7Factor = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { obj.LF1 = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { obj.LF4 = reader.GetFloat(7); } if (!reader.IsDBNull(8)) { obj.LF5 = reader.GetFloat(8); } if (!reader.IsDBNull(9)) { obj.LF6 = reader.GetFloat(9); } if (!reader.IsDBNull(10)) { obj.LF7 = reader.GetFloat(10); } list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <EQUIPMENT_MASTER> getDataSource() { List <EQUIPMENT_MASTER> list = new List <EQUIPMENT_MASTER>(); EQUIPMENT_MASTER obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = " Use [rbi] Select [EquipmentID]" + ",[EquipmentNumber]" + ",[EquipmentTypeID]" + ",[EquipmentName]" + ",[CommissionDate]" + ",[DesignCodeID]" + ",[SiteID]" + ",[FacilityID]" + ",[ManufacturerID]" + ",[PFDNo]" + ",[ProcessDescription]" + ",[EquipmentDesc]" + ",[IsArchived]" + ",[Archived]" + ",[ArchivedBy]" + "From [rbi].[dbo].[EQUIPMENT_MASTER]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new EQUIPMENT_MASTER(); obj.EquipmentID = reader.GetInt32(0); obj.EquipmentNumber = reader.GetString(1); obj.EquipmentTypeID = reader.GetInt32(2); obj.EquipmentName = reader.GetString(3); obj.CommissionDate = reader.GetDateTime(4); obj.DesignCodeID = reader.GetInt32(5); obj.SiteID = reader.GetInt32(6); obj.FacilityID = reader.GetInt32(7); obj.ManufacturerID = reader.GetInt32(8); if (!reader.IsDBNull(9)) { obj.PFDNo = reader.GetString(9); } if (!reader.IsDBNull(10)) { obj.ProcessDescription = reader.GetString(10); } if (!reader.IsDBNull(11)) { obj.EquipmentDesc = reader.GetString(11); } obj.IsArchived = reader.GetOrdinal("IsArchived"); if (!reader.IsDBNull(13)) { obj.Archived = reader.GetDateTime(13); } if (!reader.IsDBNull(14)) { obj.ArchivedBy = reader.GetString(14); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); } return(list); }
///get datasource /// public List <RW_FULL_COF_INPUT> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_FULL_COF_INPUT> list = new List <RW_FULL_COF_INPUT>(); RW_FULL_COF_INPUT obj = null; String sql = " Use[rbi] Select[ID]" + ",[Mitigation]" + ",[DetectionType]" + ",[IsolationType]" + ",[mass_comp]" + ",[mass_inv]" + "From [dbo].[RW_FULL_COF_INPUT] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_FULL_COF_INPUT(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.Mitigation = reader.GetString(1); } if (!reader.IsDBNull(2)) { obj.DetectionType = reader.GetString(2); } if (!reader.IsDBNull(3)) { obj.IsolationType = reader.GetString(3); } if (!reader.IsDBNull(4)) { obj.mass_comp = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.mass_inv = reader.GetFloat(5); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL"); } finally { conn.Close(); } return(list); }
public void Add(int ID, String API_FLUID, String SYSTEM, String Release_Duration, String Detection_Type, String Isulation_Type, String Mitigation_System, float Equipment_Cost, float Injure_Cost, float Evironment_Cost, float Toxic_Percent, float Personal_Density, float Material_Cost, float Production_Cost, float Mass_Inventory, float Mass_Component, float Stored_Pressure, float Stored_Temp) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi] " + "INSERT INTO [dbo].[RW_INPUT_CA_LEVEL1] " + "([ID]" + ",[API_FLUID] " + ",[SYSTEM] " + ",[Release_Duration] " + ",[Detection_Type] " + ",[Isulation_Type] " + ",[Mitigation_System] " + ",[Equipment_Cost] " + ",[Injure_Cost] " + ",[Evironment_Cost] " + ",[Toxic_Percent] " + ",[Personal_Density] " + ",[Material_Cost] " + ",[Production_Cost] " + ",[Mass_Inventory] " + ",[Mass_Component] " + ",[Stored_Pressure] " + ",[Stored_Temp]) " + "VALUES " + "('" + ID + "' " + ",'" + API_FLUID + "' " + ",'" + SYSTEM + "' " + ",'" + Release_Duration + "' " + ",'" + Detection_Type + "' " + ",'" + Isulation_Type + "' " + ",'" + Mitigation_System + "'" + ",'" + Equipment_Cost + "'" + ",'" + Injure_Cost + "'" + ",'" + Evironment_Cost + "'" + ",'" + Toxic_Percent + "'" + ",'" + Personal_Density + "'" + ",'" + Material_Cost + "'" + ",'" + Production_Cost + "'" + ",'" + Mass_Inventory + "'" + ",'" + Mass_Component + "'" + ",'" + Stored_Pressure + "'" + ",'" + Stored_Temp + "') "; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ERROR!"); } finally { conn.Close(); } }
public void add(int ID, String AmineSolution, int AqueousOperation, int AqueousShutdown, int ToxicConstituent, int Caustic, float Chloride, float CO3Concentration, int Cyanide, int ExposedToGasAmine, int ExposedToSulphur, String ExposureToAmine, int FlammableFluidID, float FlowRate, int H2S, float H2SInWater, int Hydrogen, float H2SPartialPressure, int Hydrofluoric, int MaterialExposedToClInt, float MaxOperatingPressure, float MaxOperatingTemperature, float MinOperatingPressure, float MinOperatingTemperature, float CriticalExposureTemperature, int ModelFluidID, float NaOHConcentration, int NonFlameToxicFluidID, float ReleaseFluidPercentToxic, String StoragePhase, int ToxicFluidID, float WaterpH, String TankFluidName, float FluidHeight, float FluidLeaveDikePercent, float FluidLeaveDikeRemainOnSitePercent, float FluidGoOffSitePercent ) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "INSERT INTO [dbo].[RW_STREAM]" + "([ID]" + ",[AmineSolution]" + ",[AqueousOperation]" + ",[AqueousShutdown]" + ",[ToxicConstituent]" + ",[Caustic]" + ",[Chloride]" + ",[CO3Concentration]" + ",[Cyanide]" + ",[ExposedToGasAmine]" + ",[ExposedToSulphur]" + ",[ExposureToAmine]" + ",[FlammableFluidID]" + ",[FlowRate]" + ",[H2S]" + ",[H2SInWater]" + ",[Hydrogen]" + ",[H2SPartialPressure]" + ",[Hydrofluoric]" + ",[MaterialExposedToClInt]" + ",[MaxOperatingPressure]" + ",[MaxOperatingTemperature]" + ",[MinOperatingPressure]" + ",[MinOperatingTemperature]" + ",[CriticalExposureTemperature]" + ",[ModelFluidID]" + ",[NaOHConcentration]" + ",[NonFlameToxicFluidID ]" + ",[ReleaseFluidPercentToxic]" + ",[StoragePhase]" + ",[ToxicFluidID]" + ",[WaterpH]" + ",[TankFluidName]" + ",[FluidHeight]" + ",[FluidLeaveDikePercent]" + ",[FluidLeaveDikeRemainOnSitePercent]" + ",[FluidGoOffSitePercent])" + " VALUES" + "( '" + ID + "'" + ", '" + AmineSolution + "'" + ", '" + AqueousOperation + "'" + ", '" + AqueousShutdown + "'" + ", '" + ToxicConstituent + "'" + ", '" + Caustic + "'" + ", '" + Chloride + "'" + ", '" + CO3Concentration + "'" + ", '" + Cyanide + "'" + ", '" + ExposedToGasAmine + "'" + ", '" + ExposedToSulphur + "'" + ", '" + ExposureToAmine + "'" + ", '" + FlammableFluidID + "'" + ", '" + FlowRate + "'" + ", '" + H2S + "'" + ", '" + H2SInWater + "'" + ", '" + Hydrogen + "'" + ", '" + H2SPartialPressure + "'" + ", '" + Hydrofluoric + "'" + ", '" + MaterialExposedToClInt + "'" + ", '" + MaxOperatingPressure + "'" + ", '" + MaxOperatingTemperature + "'" + ", '" + MinOperatingPressure + "'" + ", '" + MinOperatingTemperature + "'" + ", '" + CriticalExposureTemperature + "'" + ", '" + ModelFluidID + "'" + ", '" + NaOHConcentration + "'" + ", '" + NonFlameToxicFluidID + "'" + ", '" + ReleaseFluidPercentToxic + "'" + ", '" + StoragePhase + "'" + ", '" + ToxicFluidID + "'" + ", '" + WaterpH + "'" + ", '" + TankFluidName + "'" + ", '" + FluidHeight + "'" + ", '" + FluidLeaveDikePercent + "'" + ", '" + FluidLeaveDikeRemainOnSitePercent + "'" + ", '" + FluidGoOffSitePercent + "')"; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString(), "ADD FAIL!"); } finally { conn.Close(); conn.Dispose(); } }
public List <API_COMPONENT_TYPE> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <API_COMPONENT_TYPE> list = new List <API_COMPONENT_TYPE>(); API_COMPONENT_TYPE obj = null; String sql = " Use [rbi] Select [APIComponentTypeID]" + ",[APIComponentTypeName]" + ",[GFFSmall]" + ",[GFFMedium]" + ",[GFFLarge]" + ",[GFFRupture]" + ",[GFFTotal]" + ",[HoleCostSmall]" + ",[HoleCostMedium]" + ",[HoleCostLarge]" + ",[HoleCostRupture]" + ",[OutageSmall]" + ",[OutageMedium]" + ",[OutageLarge]" + ",[OutageRupture]" + "From [dbo].[API_COMPONENT_TYPE]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new API_COMPONENT_TYPE(); obj.APIComponentTypeID = reader.GetInt32(0); obj.APIComponentTypeName = reader.GetString(1); obj.GFFSmall = (float)reader.GetDouble(2); obj.GFFMedium = (float)reader.GetDouble(3); obj.GFFLarge = (float)reader.GetDouble(4); obj.GFFRupture = (float)reader.GetDouble(5); obj.GFFTotal = (float)reader.GetDouble(6); obj.HoleCostSmall = (float)reader.GetDouble(7); obj.HoleCostMedium = (float)reader.GetDouble(8); obj.HoleCostLarge = (float)reader.GetDouble(9); obj.HoleCostRupture = (float)reader.GetDouble(10); obj.OutageSmall = (float)reader.GetDouble(11); obj.OutageMedium = (float)reader.GetDouble(12); obj.OutageLarge = (float)reader.GetDouble(13); obj.OutageRupture = (float)reader.GetDouble(14); list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); } return(list); }
// dung file get data // dung file get list( data source) public List <USER_PERMISSION_LIST> getDataSource() { List <USER_PERMISSION_LIST> list = new List <USER_PERMISSION_LIST>(); USER_PERMISSION_LIST obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "SELECT [PermissionID]" + ",[Category]" + ",[Permission]" + ",[Container]" + ",[Object]" + ",[ObjectType]" + ",[Action]" + ",[Active]" + ",[SortOrder]" + " FROM [rbi].[dbo].[USER_PERMISSION_LIST]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new USER_PERMISSION_LIST(); obj.PermissionID = reader.GetInt32(0); obj.Category = reader.GetString(1); obj.Permission = reader.GetString(2); if (!reader.IsDBNull(3)) { obj.Container = reader.GetString(3); } if (!reader.IsDBNull(4)) { obj.Object = reader.GetString(4); } if (!reader.IsDBNull(5)) { obj.ObjectType = reader.GetString(5); } if (!reader.IsDBNull(6)) { obj.Action = reader.GetString(6); } obj.Active = reader.GetInt32(7); obj.SortOrder = reader.GetInt32(8); list.Add(obj); } } } } catch { MessageBox.Show("GET DATA SOURCE FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }