private void ShowDataToForm(int ID, string temperatureUnit, string pressureUnit, string flowRateUnit) { RW_STREAM_BUS SteamBus = new RW_STREAM_BUS(); RW_EXTCOR_TEMPERATURE_BUS tempBus = new RW_EXTCOR_TEMPERATURE_BUS(); RW_STREAM objSteam = SteamBus.getData(ID); RW_EXTCOR_TEMPERATURE extTemp = tempBus.getData(ID); BUS_UNITS convUnit = new BUS_UNITS(); switch (temperatureUnit) { case "DEG_C": txtMaximumOperatingTemp.Text = objSteam.MaxOperatingTemperature.ToString(); txtMinimumOperatingTemp.Text = objSteam.MinOperatingTemperature.ToString(); txtCriticalExposure.Text = objSteam.CriticalExposureTemperature.ToString(); break; case "DEG_F": txtMaximumOperatingTemp.Text = convUnit.CelToFah(objSteam.MaxOperatingTemperature).ToString(); txtMinimumOperatingTemp.Text = convUnit.CelToFah(objSteam.MinOperatingTemperature).ToString(); txtCriticalExposure.Text = convUnit.CelToFah(objSteam.CriticalExposureTemperature).ToString(); Console.WriteLine("Hha"); break; case "K": txtMaximumOperatingTemp.Text = convUnit.CelToKenvin(objSteam.MaxOperatingTemperature).ToString(); txtMinimumOperatingTemp.Text = convUnit.CelToKenvin(objSteam.MinOperatingTemperature).ToString(); txtCriticalExposure.Text = convUnit.CelToKenvin(objSteam.CriticalExposureTemperature).ToString(); break; } switch (pressureUnit) { case "psi": txtMaxOperatingPressure.Text = objSteam.MaxOperatingPressure.ToString(); txtMinOperatingPressure.Text = objSteam.MinOperatingPressure.ToString(); txtOperatingHydrogen.Text = objSteam.H2SPartialPressure.ToString(); break; case "KSI": txtMaxOperatingPressure.Text = (objSteam.MaxOperatingPressure / convUnit.ksi).ToString(); txtMinOperatingPressure.Text = (objSteam.MinOperatingPressure / convUnit.ksi).ToString(); txtOperatingHydrogen.Text = (objSteam.H2SPartialPressure / convUnit.ksi).ToString(); break; case "bar": txtMaxOperatingPressure.Text = (objSteam.MaxOperatingPressure / convUnit.bar).ToString(); txtMinOperatingPressure.Text = (objSteam.MinOperatingPressure / convUnit.bar).ToString(); txtOperatingHydrogen.Text = (objSteam.H2SPartialPressure / convUnit.bar).ToString(); break; case "MPa": txtMaxOperatingPressure.Text = (objSteam.MaxOperatingPressure / convUnit.MPa).ToString(); txtMinOperatingPressure.Text = (objSteam.MinOperatingPressure / convUnit.MPa).ToString(); txtOperatingHydrogen.Text = (objSteam.H2SPartialPressure / convUnit.MPa).ToString(); break; case "N/m2": txtMaxOperatingPressure.Text = (objSteam.MaxOperatingPressure / convUnit.NpM2).ToString(); txtMinOperatingPressure.Text = (objSteam.MinOperatingPressure / convUnit.NpM2).ToString(); txtOperatingHydrogen.Text = (objSteam.H2SPartialPressure / convUnit.NpM2).ToString(); break; case "N/cm2": txtMaxOperatingPressure.Text = (objSteam.MaxOperatingPressure / convUnit.NpCM2).ToString(); txtMinOperatingPressure.Text = (objSteam.MinOperatingPressure / convUnit.NpCM2).ToString(); txtOperatingHydrogen.Text = (objSteam.H2SPartialPressure / convUnit.NpCM2).ToString(); break; } switch (flowRateUnit) { case "ft3/hr": txtFlowRate.Text = (objSteam.FlowRate / convUnit.ft3).ToString(); break; case "m3/hr": txtFlowRate.Text = objSteam.FlowRate.ToString(); break; } txtOp12.Text = extTemp.Minus12ToMinus8.ToString(); txtOp8.Text = extTemp.Minus8ToPlus6.ToString(); txtOp6.Text = extTemp.Plus6ToPlus32.ToString(); txtOp32.Text = extTemp.Plus32ToPlus71.ToString(); txtOp71.Text = extTemp.Plus71ToPlus107.ToString(); txtOp107.Text = extTemp.Plus107ToPlus121.ToString(); txtOp121.Text = extTemp.Plus121ToPlus135.ToString(); txtOp135.Text = extTemp.Plus135ToPlus162.ToString(); txtOp162.Text = extTemp.Plus162ToPlus176.ToString(); txtOp176.Text = extTemp.MoreThanPlus176.ToString(); }
public void ShowDataToControl(int ID, string temUnit, string volumeUnit) { RW_EQUIPMENT_BUS bus = new RW_EQUIPMENT_BUS(); RW_EQUIPMENT eq = bus.getData(ID); chkAministrativeControl.Checked = Convert.ToBoolean(eq.AdminUpsetManagement); chkCylicOperation.Checked = Convert.ToBoolean(eq.CyclicOperation); chkDowntimeProtection.Checked = Convert.ToBoolean(eq.DowntimeProtectionUsed); for (int i = 0; i < itemsAdjustmentSettlement.Length; i++) { if (eq.ExternalEnvironment == itemsAdjustmentSettlement[i]) { cbAdjustmentSettlement.SelectedIndex = i + 1; break; } } chkHeatTraced.Checked = Convert.ToBoolean(eq.HeatTraced); chkInterfaceSoilWater.Checked = Convert.ToBoolean(eq.InterfaceSoilWater); chkLinerOnlineMonitoring.Checked = Convert.ToBoolean(eq.LinerOnlineMonitoring); chkMaterialExposedFluid.Checked = Convert.ToBoolean(eq.MaterialExposedToClExt); if (temUnit == "DEG_C") { txtMinRequiredTemperature.Text = eq.MinReqTemperaturePressurisation.ToString(); } else if (temUnit == "DEG_F") { txtMinRequiredTemperature.Text = (convUnit.CelToFah(eq.MinReqTemperaturePressurisation)).ToString(); // mai } else { txtMinRequiredTemperature.Text = (convUnit.CelToKenvin(eq.MinReqTemperaturePressurisation)).ToString(); // mai } for (int i = 0; i < itemsOnlineMonitoring.Length; i++) { if (eq.OnlineMonitoring == itemsOnlineMonitoring[i]) { cbOnlineMonitoring.SelectedIndex = i + 1; break; } } chkPresenceSulphideOperation.Checked = Convert.ToBoolean(eq.PresenceSulphidesO2); chkPresenceSulphideShutdown.Checked = Convert.ToBoolean(eq.PresenceSulphidesO2Shutdown); chkPressurisationControlled.Checked = Convert.ToBoolean(eq.PressurisationControlled); chkPWHT.Checked = Convert.ToBoolean(eq.PWHT); chkSteamedOutPriorWaterFlushing.Checked = Convert.ToBoolean(eq.SteamOutWaterFlush); numSystemManagementFactor.Value = (decimal)eq.ManagementFactor; for (int i = 0; i < itemsThermalHistory.Length; i++) { if (eq.ThermalHistory == itemsThermalHistory[i]) { cbThermalHistory.SelectedIndex = i + 1; break; } } chkEquipmentOperatingManyYear.Checked = Convert.ToBoolean(eq.YearLowestExpTemp); if (volumeUnit == "m3") { txtEquipmentVolume.Text = eq.Volume.ToString(); //mai } else if (volumeUnit == "ft3") { txtEquipmentVolume.Text = (eq.Volume / convUnit.ft3).ToString(); // mai } for (int i = 0; i < itemsExternalEnvironment.Length; i++) { if (eq.ExternalEnvironment == itemsExternalEnvironment[i]) { cbExternalEnviroment.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsTypeSoil.Length; i++) { if (eq.TypeOfSoil == itemsTypeSoil[i]) { cbTypeSoild.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsEnvironmental.Length; i++) { if (eq.EnvironmentSensitivity == itemsEnvironmental[i]) { cbEnvironmentalSensitivity.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsAdjustmentSettlement.Length; i++) { if (eq.AdjustmentSettle == itemsAdjustmentSettlement[i]) { cbAdjustmentSettlement.SelectedIndex = i + 1; break; } } chkComponentWelded.Checked = Convert.ToBoolean(eq.ComponentIsWelded); chkTankMaintainedAccordance.Checked = Convert.ToBoolean(eq.TankIsMaintained); txtDistanceGroundWater.Text = eq.DistanceToGroundWater.ToString(); }
public void ShowDatatoControl(int ID, string temUnit, string volumeUnit) { RW_EQUIPMENT_BUS eqBus = new RW_EQUIPMENT_BUS(); BUS_UNITS convUnit = new BUS_UNITS(); List <RW_EQUIPMENT> listEq = eqBus.getDataSource(); foreach (RW_EQUIPMENT e in listEq) { if (e.ID == ID) { chkAministrativeControl.Checked = e.AdminUpsetManagement == 1 ? true : false; chkHighlyEffectiveInspection.Checked = e.HighlyDeadlegInsp == 1 ? true : false; chkDowntimeProtection.Checked = e.DowntimeProtectionUsed == 1 ? true : false; chkHeatTraced.Checked = e.HeatTraced == 1 ? true : false; chkInterfaceSoilWater.Checked = e.InterfaceSoilWater == 1 ? true : false; chkEquipmentOperatingManyYear.Checked = e.YearLowestExpTemp == 1 ? true : false; chkMaterialExposedFluid.Checked = e.MaterialExposedToClExt == 1 ? true : false; chkPresenceSulphideOperation.Checked = e.PresenceSulphidesO2 == 1 ? true : false; chkContainsDeadlegs.Checked = e.ContainsDeadlegs == 1 ? true : false; chkCylicOperation.Checked = e.CyclicOperation == 1 ? true : false; chkSteamedOutPriorWaterFlushing.Checked = e.SteamOutWaterFlush == 1 ? true : false; chkPWHT.Checked = e.PWHT == 1 ? true : false; chkLinerOnlineMonitoring.Checked = e.LinerOnlineMonitoring == 1 ? true : false; chkPresenceSulphideShutdown.Checked = e.PresenceSulphidesO2Shutdown == 1 ? true : false; if (temUnit == "DEG_C") { txtMinRequiredTemperature.Text = e.MinReqTemperaturePressurisation.ToString(); } else if (temUnit == "DEG_F") { txtMinRequiredTemperature.Text = (convUnit.CelToFah(e.MinReqTemperaturePressurisation)).ToString(); } else { txtMinRequiredTemperature.Text = (convUnit.CelToKenvin(e.MinReqTemperaturePressurisation)).ToString(); } for (int i = 0; i < itemsExternalEnvironment.Length; i++) { if (itemsExternalEnvironment[i] == e.ExternalEnvironment) { cbExternalEnvironment.SelectedIndex = i + 1; } } for (int j = 0; j < itemsOnlineMonitoring.Length; j++) { if (itemsOnlineMonitoring[j] == e.OnlineMonitoring) { cbOnlineMonitoring.SelectedIndex = j + 1; } } for (int i = 0; i < itemsThermalHistory.Length; i++) { if (itemsThermalHistory[i] == e.ThermalHistory) { cbThermalHistory.SelectedIndex = i + 1; } } if (volumeUnit == "m3") { txtEquipmentVolume.Text = e.Volume.ToString(); } else if (volumeUnit == "ft3") { txtEquipmentVolume.Text = (e.Volume * convUnit.ft3).ToString(); } } } }
public void ShowDataToControl(int ID, string temUnit, string pressureUnit, string stressUnit, string thicknessUnit, string corrosionUnit) { RW_MATERIAL_BUS BUS = new RW_MATERIAL_BUS(); RW_MATERIAL obj = BUS.getData(ID); RW_INPUT_CA_TANK_BUS busTank = new RW_INPUT_CA_TANK_BUS(); BUS_UNITS convUnit = new BUS_UNITS(); float tank = busTank.getProductionCost(ID); switch (temUnit) { case "DEG_C": txtMaxDesignTemperature.Text = obj.DesignTemperature.ToString(); txtMinDesignTemperature.Text = obj.MinDesignTemperature.ToString(); txtReferenceTemperature.Text = obj.ReferenceTemperature.ToString(); break; case "DEG_F": txtMaxDesignTemperature.Text = (convUnit.CelToFah(obj.DesignTemperature)).ToString(); txtMinDesignTemperature.Text = (convUnit.CelToFah(obj.MinDesignTemperature)).ToString(); txtReferenceTemperature.Text = (convUnit.CelToFah(obj.ReferenceTemperature)).ToString(); break; case "K": txtMaxDesignTemperature.Text = (convUnit.CelToKenvin(obj.DesignTemperature)).ToString(); txtMinDesignTemperature.Text = (convUnit.CelToKenvin(obj.MinDesignTemperature)).ToString(); txtReferenceTemperature.Text = (convUnit.CelToKenvin(obj.ReferenceTemperature)).ToString(); break; } switch (pressureUnit) { case "psi": txtDesignPressure.Text = obj.DesignPressure.ToString(); break; case "KSI": txtDesignPressure.Text = (obj.DesignPressure / convUnit.ksi).ToString(); break; case "bar": txtDesignPressure.Text = (obj.DesignPressure / convUnit.bar).ToString(); break; case "MPa": txtDesignPressure.Text = (obj.DesignPressure / convUnit.MPa).ToString(); break; case "N/m2": txtDesignPressure.Text = (obj.DesignPressure / convUnit.NpM2).ToString(); break; case "N/cm2": txtDesignPressure.Text = (obj.DesignPressure / convUnit.NpCM2).ToString(); break; } switch (thicknessUnit) { case "mm": txtBrittleFracture.Text = obj.BrittleFractureThickness.ToString(); break; case "in": txtBrittleFracture.Text = (obj.BrittleFractureThickness / convUnit.inch).ToString(); break; case "m": txtBrittleFracture.Text = (obj.BrittleFractureThickness / convUnit.meter).ToString(); break; } switch (corrosionUnit) { case "mm": txtCorrosionAllowance.Text = obj.CorrosionAllowance.ToString(); break; case "mil": txtCorrosionAllowance.Text = (obj.CorrosionAllowance / convUnit.mil).ToString(); break; } switch (stressUnit) { case "psi": txtAllowableStress.Text = obj.AllowableStress.ToString(); break; case "KSI": txtAllowableStress.Text = (obj.AllowableStress / convUnit.ksi).ToString(); break; case "bar": txtAllowableStress.Text = (obj.AllowableStress / convUnit.bar).ToString(); break; case "MPa": txtAllowableStress.Text = (obj.AllowableStress / convUnit.MPa).ToString(); break; case "N/m2": txtAllowableStress.Text = (obj.AllowableStress / convUnit.NpM2).ToString(); break; case "N/cm2": txtAllowableStress.Text = (obj.AllowableStress / convUnit.NpCM2).ToString(); break; } txtMaterial.Text = obj.MaterialName; for (int i = 0; i < itemsSulfurContent.Length; i++) { if (obj.SulfurContent == itemsSulfurContent[i]) { cbSulfurContent.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsHeatTreatment.Length; i++) { if (obj.HeatTreatment == itemsHeatTreatment[i]) { cbHeatTreatment.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsPTAMterial.Length; i++) { if (obj.PTAMaterialCode == itemsPTAMterial[i]) { cbPTAMaterialGrade.SelectedIndex = i + 1; break; } } chkIsPTASeverity.Checked = Convert.ToBoolean(obj.IsPTA); chkAusteniticSteel.Checked = Convert.ToBoolean(obj.Austenitic); chkCarbonLowAlloySteel.Checked = Convert.ToBoolean(obj.CarbonLowAlloy); chkNickelAlloy.Checked = Convert.ToBoolean(obj.NickelBased); chkChromium.Checked = Convert.ToBoolean(obj.ChromeMoreEqual12); txtMaterialCostFactor.Text = obj.CostFactor.ToString(); txtProductionCost.Text = tank.ToString(); }
public void ShowDatatoControl(int id, string temperatureUnit, string pressureUnit, string corrosionUnit) { RW_MATERIAL_BUS BUS = new RW_MATERIAL_BUS(); RW_MATERIAL obj = BUS.getData(id); BUS_UNITS convUnit = new BUS_UNITS(); txtMaterial.Text = obj.MaterialName; switch (temperatureUnit) { case "DEG_C": txtMaxDesignTemperature.Text = obj.DesignTemperature.ToString(); txtMinDesignTemperature.Text = obj.MinDesignTemperature.ToString(); txtReferenceTemperature.Text = obj.ReferenceTemperature.ToString(); break; case "DEG_F": txtMaxDesignTemperature.Text = (convUnit.CelToFah(obj.DesignTemperature)).ToString(); txtMinDesignTemperature.Text = (convUnit.CelToFah(obj.MinDesignTemperature)).ToString(); txtReferenceTemperature.Text = (convUnit.CelToFah(obj.ReferenceTemperature)).ToString(); break; case "K": txtMaxDesignTemperature.Text = (convUnit.CelToKenvin(obj.DesignTemperature)).ToString(); txtMinDesignTemperature.Text = (convUnit.CelToKenvin(obj.MinDesignTemperature)).ToString(); txtReferenceTemperature.Text = (convUnit.CelToKenvin(obj.ReferenceTemperature)).ToString(); break; } switch (pressureUnit) { case "PSI": txtDesignPressure.Text = (obj.DesignPressure / convUnit.psi).ToString(); txtYieldStrength.Text = (obj.YieldStrength / convUnit.psi).ToString(); txtTensileStrength.Text = (obj.TensileStrength / convUnit.psi).ToString(); break; case "KSI": txtDesignPressure.Text = (obj.DesignPressure / convUnit.ksi).ToString(); txtYieldStrength.Text = (obj.YieldStrength / convUnit.ksi).ToString(); txtTensileStrength.Text = (obj.TensileStrength / convUnit.ksi).ToString(); break; case "BAR": txtDesignPressure.Text = (obj.DesignPressure / convUnit.bar).ToString(); txtYieldStrength.Text = (obj.YieldStrength / convUnit.bar).ToString(); txtTensileStrength.Text = (obj.TensileStrength / convUnit.bar).ToString(); break; case "MPA": txtDesignPressure.Text = (obj.DesignPressure).ToString(); txtYieldStrength.Text = (obj.YieldStrength).ToString(); txtTensileStrength.Text = (obj.TensileStrength).ToString(); break; case "NM2": txtDesignPressure.Text = (obj.DesignPressure / convUnit.NpM2).ToString(); txtYieldStrength.Text = (obj.YieldStrength / convUnit.NpM2).ToString(); txtTensileStrength.Text = (obj.TensileStrength / convUnit.NpM2).ToString(); break; case "NCM2": txtDesignPressure.Text = (obj.DesignPressure / convUnit.NpCM2).ToString(); txtYieldStrength.Text = (obj.YieldStrength / convUnit.NpCM2).ToString(); txtTensileStrength.Text = (obj.TensileStrength / convUnit.NpCM2).ToString(); break; } switch (corrosionUnit) { case "MM": txtCorrosionAllowance.Text = obj.CorrosionAllowance.ToString(); break; case "MIL": txtCorrosionAllowance.Text = (obj.CorrosionAllowance / convUnit.mil).ToString(); break; } txtSigmaPhase.Text = obj.SigmaPhase.ToString(); for (int i = 0; i < itemsSulfurContent.Length; i++) { if (obj.SulfurContent == itemsSulfurContent[i]) { cbSulfurContent.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsPTAMterial.Length; i++) { if (obj.PTAMaterialCode == itemsPTAMterial[i]) { cbPTAMaterialGrade.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsHTHAMaterial.Length; i++) { if (obj.HTHAMaterialCode == itemsHTHAMaterial[i]) { cbHTHAMaterial.SelectedIndex = i + 1; break; } } chkIsPTASeverity.Checked = Convert.ToBoolean(obj.IsPTA); chkIsHTHASeverity.Checked = Convert.ToBoolean(obj.IsHTHA); chkAusteniticSteel.Checked = Convert.ToBoolean(obj.Austenitic); chkSusceptibleTemper.Checked = Convert.ToBoolean(obj.Temper); chkCarbonLowAlloySteel.Checked = Convert.ToBoolean(obj.CarbonLowAlloy); chkNickelAlloy.Checked = Convert.ToBoolean(obj.NickelBased); chkChromium.Checked = Convert.ToBoolean(obj.ChromeMoreEqual12); txtTensileStrength.Text = obj.TensileStrength.ToString(); txtYieldStrength.Text = obj.YieldStrength.ToString(); txtMaterialCostFactor.Text = obj.CostFactor.ToString(); }