コード例 #1
0
        public RW_EQUIPMENT getData(int ID, string temUnit, string volUnit)
        {
            RW_EQUIPMENT      eq       = new RW_EQUIPMENT();
            RW_ASSESSMENT_BUS assBus   = new RW_ASSESSMENT_BUS();
            BUS_UNITS         convUnit = new BUS_UNITS();

            eq.ID = ID;
            eq.AdminUpsetManagement   = chkAministrativeControl.Checked ? 1 : 0;
            eq.ContainsDeadlegs       = chkContainsDeadlegs.Checked ? 1 : 0;
            eq.CyclicOperation        = chkCylicOperation.Checked ? 1 : 0;
            eq.HighlyDeadlegInsp      = chkHighlyEffectiveInspection.Checked ? 1 : 0;
            eq.DowntimeProtectionUsed = chkDowntimeProtection.Checked ? 1 : 0;
            eq.ExternalEnvironment    = cbExternalEnvironment.Text;
            eq.HeatTraced             = chkHeatTraced.Checked ? 1 : 0;
            eq.InterfaceSoilWater     = chkInterfaceSoilWater.Checked ? 1 : 0;
            eq.LinerOnlineMonitoring  = chkLinerOnlineMonitoring.Checked ? 1 : 0;
            eq.MaterialExposedToClExt = chkMaterialExposedFluid.Checked ? 1 : 0;
            double minReqTem = 0;

            if (temUnit == "DEG_C")
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? double.Parse(txtMinRequiredTemperature.Text) : 0;
            }
            else if (temUnit == "DEG_F")
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? convUnit.FahToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0;                          // mai
            }
            else
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? convUnit.KenvinToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0;  // mai
            }
            eq.MinReqTemperaturePressurisation = (float)minReqTem;
            eq.OnlineMonitoring            = cbOnlineMonitoring.Text;
            eq.PresenceSulphidesO2         = chkPresenceSulphideOperation.Checked ? 1 : 0;
            eq.PresenceSulphidesO2Shutdown = chkPresenceSulphideShutdown.Checked ? 1 : 0;
            eq.PressurisationControlled    = chkPressurisationControlled.Checked ? 1 : 0;
            eq.PWHT = chkPWHT.Checked ? 1 : 0;
            eq.SteamOutWaterFlush = chkSteamedOutPriorWaterFlushing.Checked ? 1 : 0;
            int   equipmentID = assBus.getEquipmentID(ID);
            float FMS         = busFacility.getFMS(busEquipmentMaster.getFacilityID(equipmentID));

            eq.ManagementFactor  = FMS;
            eq.ThermalHistory    = cbThermalHistory.Text;
            eq.YearLowestExpTemp = chkEquipmentOperatingManyYear.Checked ? 1 : 0;
            double equipVolume = 0;

            if (volUnit == "m3")
            {
                equipVolume = txtEquipmentVolume.Text != "" ? float.Parse(txtEquipmentVolume.Text) : 0;
            }
            else
            {
                equipVolume = txtMinRequiredTemperature.Text != "" ? (float.Parse(txtEquipmentVolume.Text) * convUnit.ft3) : 0; // mai
            }
            eq.Volume = (float)equipVolume;
            //eq.CommissionDate =
            return(eq);
        }
コード例 #2
0
        public RW_EQUIPMENT getData(int ID, string temUnit, string volUnit)
        {
            RW_EQUIPMENT eq = new RW_EQUIPMENT();

            eq.ID = ID;
            eq.AdminUpsetManagement   = chkAministrativeControl.Checked ? 1 : 0;
            eq.CyclicOperation        = chkCylicOperation.Checked ? 1 : 0;
            eq.DowntimeProtectionUsed = chkDowntimeProtection.Checked ? 1 : 0;
            eq.ExternalEnvironment    = cbAdjustmentSettlement.Text;
            eq.HeatTraced             = chkHeatTraced.Checked ? 1 : 0;
            eq.InterfaceSoilWater     = chkInterfaceSoilWater.Checked ? 1 : 0;
            eq.LinerOnlineMonitoring  = chkLinerOnlineMonitoring.Checked ? 1 : 0;
            eq.MaterialExposedToClExt = chkMaterialExposedFluid.Checked ? 1 : 0;
            //eq.MinReqTemperaturePressurisation = txtMinRequiredTemperature.Text != "" ? float.Parse(txtMinRequiredTemperature.Text) : 0;
            double minReqTem = 0; // hiếu

            if (temUnit == "DEG_C")
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? double.Parse(txtMinRequiredTemperature.Text) : 0;
            }
            else if (temUnit == "DEG_F")
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? convUnit.FahToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0;                          // mai
            }
            else
            {
                minReqTem = txtMinRequiredTemperature.Text != "" ? convUnit.KenvinToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0; // mai
            }
            eq.MinReqTemperaturePressurisation = (float)minReqTem;                                                                         //hiếu
            eq.OnlineMonitoring            = cbOnlineMonitoring.Text;
            eq.PresenceSulphidesO2         = chkPresenceSulphideOperation.Checked ? 1 : 0;
            eq.PresenceSulphidesO2Shutdown = chkPresenceSulphideShutdown.Checked ? 1 : 0;
            eq.PressurisationControlled    = chkPressurisationControlled.Checked ? 1 : 0;
            eq.PWHT = chkPWHT.Checked ? 1 : 0;
            eq.SteamOutWaterFlush = chkSteamedOutPriorWaterFlushing.Checked ? 1 : 0;
            eq.ManagementFactor   = (float)numSystemManagementFactor.Value;
            eq.ThermalHistory     = cbThermalHistory.Text;
            eq.YearLowestExpTemp  = chkEquipmentOperatingManyYear.Checked ? 1 : 0;
            if (volUnit == "m3")
            {
                eq.Volume = txtEquipmentVolume.Text != "" ? float.Parse(txtEquipmentVolume.Text) : 0;
            }
            else
            {
                eq.Volume = txtMinRequiredTemperature.Text != "" ? (float)(double.Parse(txtEquipmentVolume.Text) * convUnit.ft3) : 0;  // mai
            }
            eq.TypeOfSoil             = cbTypeSoild.Text;
            eq.EnvironmentSensitivity = cbEnvironmentalSensitivity.Text;
            eq.AdjustmentSettle       = cbAdjustmentSettlement.Text;
            eq.ComponentIsWelded      = chkComponentWelded.Checked ? 1 : 0;
            eq.TankIsMaintained       = chkTankMaintainedAccordance.Checked ? 1 : 0;
            //tank shell
            //tank bottom
            eq.DistanceToGroundWater = txtDistanceGroundWater.Text != "" ? float.Parse(txtDistanceGroundWater.Text) : 0;
            return(eq);
        }
コード例 #3
0
        public RW_INPUT_CA_LEVEL_1 getDataforCA(int id, string temperatureUnit, string pressureUnit)//thao
        {
            RW_INPUT_CA_LEVEL_1 ca       = new RW_INPUT_CA_LEVEL_1();
            BUS_UNITS           convUnit = new BUS_UNITS();

            ca.ID = id;
            switch (temperatureUnit)
            {
            case "DEG_C":
                ca.Stored_Temp = txtMinimumOperatingTemp.Text != "" ? float.Parse(txtMinimumOperatingTemp.Text) + 273 : 0;
                break;

            case "DEG_F":
                ca.Stored_Temp = txtMinimumOperatingTemp.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMinimumOperatingTemp.Text)) + 273 : 0;
                break;

            case "K":
                ca.Stored_Temp = txtMinimumOperatingTemp.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMinimumOperatingTemp.Text)) + 273 : 0;
                break;
            }
            switch (pressureUnit)
            {
            case "psi":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * 6.895f : 0;
                break;

            case "KSI":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.ksi * 6.895f : 0;
                break;

            case "bar":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.bar * 6.895f : 0;
                break;

            case "MPa":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.MPa * 6.895f : 0;
                break;

            case "NpM2":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.NpM2 * 6.895f : 0;
                break;

            case "NpCM2":
                ca.Stored_Pressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.NpCM2 * 6.895f : 0;
                break;
            }
            return(ca);
        }
コード例 #4
0
        public RW_STREAM getDataforStream(int ID, string temperatureUnit, string pressureUnit, string flowRateUnit)
        {
            RW_STREAM str      = new RW_STREAM();
            BUS_UNITS convUnit = new BUS_UNITS();

            str.ID = ID;
            if (flowRateUnit == "m3/hr")
            {
                str.FlowRate = txtFlowRate.Text != "" ? float.Parse(txtFlowRate.Text) : 0;
            }
            else
            {
                str.FlowRate = txtFlowRate.Text != "" ? float.Parse(txtFlowRate.Text) * (float)convUnit.ft3 : 0;
            }
            switch (temperatureUnit)
            {
            case "DEG_C":
                str.MaxOperatingTemperature     = txtMaximumOperatingTemp.Text != "" ? float.Parse(txtMaximumOperatingTemp.Text) : 0;
                str.MinOperatingTemperature     = txtMinimumOperatingTemp.Text != "" ? float.Parse(txtMinimumOperatingTemp.Text) : 0;
                str.CriticalExposureTemperature = txtCriticalExposure.Text != "" ? float.Parse(txtCriticalExposure.Text) : 0;
                break;

            case "DEG_F":
                str.MaxOperatingTemperature     = txtMaximumOperatingTemp.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMaximumOperatingTemp.Text)) : 0;
                str.MinOperatingTemperature     = txtMinimumOperatingTemp.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMinimumOperatingTemp.Text)) : 0;
                str.CriticalExposureTemperature = txtCriticalExposure.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtCriticalExposure.Text)) : 0;
                break;

            case "K":
                str.MaxOperatingTemperature     = txtMaximumOperatingTemp.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMaximumOperatingTemp.Text)) : 0;
                str.MinOperatingTemperature     = txtMinimumOperatingTemp.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMinimumOperatingTemp.Text)) : 0;
                str.CriticalExposureTemperature = txtCriticalExposure.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtCriticalExposure.Text)) : 0;
                break;
            }
            switch (pressureUnit)
            {
            case "psi":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) : 0;
                break;

            case "KSI":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) * (float)convUnit.ksi : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.ksi : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) * (float)convUnit.ksi : 0;
                break;

            case "bar":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) * (float)convUnit.bar : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.bar : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) * (float)convUnit.bar : 0;
                break;

            case "MPa":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) * (float)convUnit.MPa : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.MPa : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) * (float)convUnit.MPa : 0;
                break;

            case "NpM2":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) * (float)convUnit.NpM2 : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.NpM2 : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) * (float)convUnit.NpM2 : 0;
                break;

            case "NpCM2":
                str.MaxOperatingPressure = txtMaxOperatingPressure.Text != "" ? float.Parse(txtMaxOperatingPressure.Text) * (float)convUnit.NpCM2 : 0;
                str.MinOperatingPressure = txtMinOperatingPressure.Text != "" ? float.Parse(txtMinOperatingPressure.Text) * (float)convUnit.NpCM2 : 0;
                str.H2SPartialPressure   = txtOperatingHydrogen.Text != "" ? float.Parse(txtOperatingHydrogen.Text) * (float)convUnit.NpCM2 : 0;
                break;
            }

            return(str);
        }
コード例 #5
0
        public RW_MATERIAL getData(int ID, string temUnit, string pressureUnit, string stressUnit, string thicknessUnit, string corrosionUnit)
        {
            RW_MATERIAL ma       = new RW_MATERIAL();
            BUS_UNITS   convUnit = new BUS_UNITS();

            ma.ID           = ID;
            ma.MaterialName = txtMaterial.Text;
            switch (temUnit)
            {
            case "DEG_C":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? float.Parse(txtMaxDesignTemperature.Text) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? float.Parse(txtMinDesignTemperature.Text) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? float.Parse(txtReferenceTemperature.Text) : 0;
                break;

            case "DEG_F":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMaxDesignTemperature.Text)) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMinDesignTemperature.Text)) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtReferenceTemperature.Text)) : 0;
                break;

            case "K":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMaxDesignTemperature.Text)) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMinDesignTemperature.Text)) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtReferenceTemperature.Text)) : 0;
                break;
            }

            switch (pressureUnit)
            {
            case "psi":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) : 0;
                break;

            case "KSI":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.ksi : 0;
                break;

            case "bar":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.bar : 0;
                break;

            case "MPa":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.MPa : 0;
                break;

            case "N/m2":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.NpM2 : 0;
                break;

            case "N/cm2":
                ma.DesignPressure = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.NpCM2 : 0;
                break;
            }

            switch (stressUnit)
            {
            case "psi":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) : 0;
                break;

            case "KSI":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) * (float)convUnit.ksi : 0;
                break;

            case "bar":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) * (float)convUnit.bar : 0;
                break;

            case "MPa":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) * (float)convUnit.MPa : 0;
                break;

            case "N/m2":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) * (float)convUnit.NpM2 : 0;
                break;

            case "N/cm2":
                ma.AllowableStress = txtAllowableStress.Text != "" ? float.Parse(txtAllowableStress.Text) * (float)convUnit.NpCM2 : 0;
                break;
            }

            switch (corrosionUnit)
            {
            case "mm":
                ma.CorrosionAllowance = txtCorrosionAllowance.Text != "" ? float.Parse(txtCorrosionAllowance.Text) : 0;
                break;

            case "mil":
                ma.CorrosionAllowance = txtCorrosionAllowance.Text != "" ? float.Parse(txtCorrosionAllowance.Text) * (float)convUnit.mil : 0;
                break;
            }

            switch (thicknessUnit)
            {
            case "mm":
                ma.BrittleFractureThickness = txtBrittleFracture.Text != "" ? float.Parse(txtBrittleFracture.Text) : 0;
                break;

            case "in":
                ma.BrittleFractureThickness = txtBrittleFracture.Text != "" ? float.Parse(txtBrittleFracture.Text) * (float)convUnit.inch : 0;
                break;

            case "m":
                ma.BrittleFractureThickness = txtBrittleFracture.Text != "" ? float.Parse(txtBrittleFracture.Text) * (float)convUnit.meter : 0;
                break;
            }
            ma.SulfurContent     = cbSulfurContent.Text;
            ma.HeatTreatment     = cbHeatTreatment.Text;
            ma.PTAMaterialCode   = cbPTAMaterialGrade.Text;
            ma.IsPTA             = chkIsPTASeverity.Checked ? 1 : 0;
            ma.Austenitic        = chkAusteniticSteel.Checked ? 1 : 0;
            ma.CarbonLowAlloy    = chkCarbonLowAlloySteel.Checked ? 1 : 0;
            ma.NickelBased       = chkNickelAlloy.Checked ? 1 : 0;
            ma.ChromeMoreEqual12 = chkChromium.Checked ? 1 : 0;
            ma.CostFactor        = txtMaterialCostFactor.Text != "" ? float.Parse(txtMaterialCostFactor.Text) : 0;
            return(ma);
        }
コード例 #6
0
        public RW_MATERIAL getData(int ID, string temUnit, string pressureUnit, string corrosionUnit)
        {
            RW_MATERIAL ma       = new RW_MATERIAL();
            BUS_UNITS   convUnit = new BUS_UNITS();

            ma.ID           = ID;
            ma.MaterialName = txtMaterial.Text;
            switch (temUnit)
            {
            case "DEG_C":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? float.Parse(txtMaxDesignTemperature.Text) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? float.Parse(txtMinDesignTemperature.Text) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? float.Parse(txtReferenceTemperature.Text) : 0;
                break;

            case "DEG_F":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMaxDesignTemperature.Text)) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtMinDesignTemperature.Text)) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? (float)convUnit.FahToCel(float.Parse(txtReferenceTemperature.Text)) : 0;
                break;

            case "K":
                ma.DesignTemperature    = txtMaxDesignTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMaxDesignTemperature.Text)) : 0;
                ma.MinDesignTemperature = txtMinDesignTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtMinDesignTemperature.Text)) : 0;
                ma.ReferenceTemperature = txtReferenceTemperature.Text != "" ? (float)convUnit.KenvinToCel(float.Parse(txtReferenceTemperature.Text)) : 0;
                break;
            }

            switch (pressureUnit)
            {
            case "PSI":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) * (float)convUnit.psi : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) * (float)convUnit.psi : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.psi : 0;
                break;

            case "KSI":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) * (float)convUnit.ksi : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) * (float)convUnit.ksi : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.ksi : 0;
                break;

            case "BAR":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) * (float)convUnit.bar : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) * (float)convUnit.bar : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.bar : 0;
                break;

            case "MPA":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) : 0;
                break;

            case "NM2":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) * (float)convUnit.NpM2 : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) * (float)convUnit.NpM2 : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.NpM2 : 0;
                break;

            case "NCM2":
                ma.YieldStrength   = txtYieldStrength.Text != "" ? float.Parse(txtYieldStrength.Text) * (float)convUnit.NpCM2 : 0;
                ma.TensileStrength = txtTensileStrength.Text != "" ? float.Parse(txtTensileStrength.Text) * (float)convUnit.NpCM2 : 0;
                ma.DesignPressure  = txtDesignPressure.Text != "" ? float.Parse(txtDesignPressure.Text) * (float)convUnit.NpCM2 : 0;
                break;
            }

            switch (corrosionUnit)
            {
            case "mm":
                ma.CorrosionAllowance = txtCorrosionAllowance.Text != "" ? float.Parse(txtCorrosionAllowance.Text) : 0;
                break;

            case "mil":
                ma.CorrosionAllowance = txtCorrosionAllowance.Text != "" ? float.Parse(txtCorrosionAllowance.Text) * (float)convUnit.mil : 0;
                break;
            }

            ma.SulfurContent     = cbSulfurContent.Text;
            ma.PTAMaterialCode   = cbPTAMaterialGrade.Text;
            ma.IsPTA             = chkIsPTASeverity.Checked ? 1 : 0;
            ma.Austenitic        = chkAusteniticSteel.Checked ? 1 : 0;
            ma.CarbonLowAlloy    = chkCarbonLowAlloySteel.Checked ? 1 : 0;
            ma.NickelBased       = chkNickelAlloy.Checked ? 1 : 0;
            ma.ChromeMoreEqual12 = chkChromium.Checked ? 1 : 0;
            ma.CostFactor        = txtMaterialCostFactor.Text != "" ? float.Parse(txtMaterialCostFactor.Text) : 0;
            return(ma);
        }