public RW_EQUIPMENT getData(int ID)
        {
            RW_EQUIPMENT      eq     = new RW_EQUIPMENT();
            RW_ASSESSMENT_BUS assBus = new RW_ASSESSMENT_BUS();

            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;
            eq.MinReqTemperaturePressurisation = txtMinRequiredTemperature.Text != "" ? float.Parse(txtMinRequiredTemperature.Text) : 0;
            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;
            eq.Volume            = txtEquipmentVolume.Text != "" ? float.Parse(txtEquipmentVolume.Text) : 0;
            //eq.CommissionDate =
            return(eq);
        }
        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.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;

            if (temUnit == "DEG_C")
            {
                eq.MinReqTemperaturePressurisation = txtMinRequiredTemperature.Text != "" ? float.Parse(txtMinRequiredTemperature.Text) : 0;
            }
            else if (temUnit == "DEG_F")
            {
                eq.MinReqTemperaturePressurisation = txtMinRequiredTemperature.Text != "" ? (float)convUnit.FahToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0;                          // mai
            }
            else
            {
                eq.MinReqTemperaturePressurisation = txtMinRequiredTemperature.Text != "" ? (float)convUnit.KenvinToCel(double.Parse(txtMinRequiredTemperature.Text)) : 0;  // mai
            }
            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;
            double equipVolume = 0;

            if (volUnit == "M3")
            {
                equipVolume = txtEquipmentVolume.Text != "" ? float.Parse(txtEquipmentVolume.Text) : 0;
            }
            else
            {
                equipVolume = txtEquipmentVolume.Text != "" ? (float.Parse(txtEquipmentVolume.Text) * convUnit.ft3) : 0; // mai
            }
            eq.Volume = (float)equipVolume;
            //eq.CommissionDate =
            return(eq);
        }
Ejemplo n.º 3
0
        public List <RiskSummary> getData()
        {
            RW_ASSESSMENT_BUS  assBus          = new RW_ASSESSMENT_BUS();
            List <int>         allIDAssessment = assBus.getAllID();
            List <RiskSummary> dataRisk        = new List <RiskSummary>();

            for (int i = 0; i < allIDAssessment.Count; i++)
            {
                RiskSummary     risk    = new RiskSummary();
                RW_FULL_POF_BUS busPoF  = new RW_FULL_POF_BUS();
                RW_FULL_POF     fullPoF = busPoF.getData(allIDAssessment[i]);
                //RW_CA_LEVEL_1_BUS busCA = new RW_CA_LEVEL_1_BUS();
                //RW_CA_LEVEL_1 CA = busCA.getData(allIDAssessment[i]);
                //get EquipmentID ----> get EquipmentTypeName and APIComponentType
                int equipmentID = assBus.getEquipmentID(allIDAssessment[i]);
                EQUIPMENT_MASTER_BUS eqMaBus        = new EQUIPMENT_MASTER_BUS();
                EQUIPMENT_TYPE_BUS   eqTypeBus      = new EQUIPMENT_TYPE_BUS();
                String equipmentTypename            = eqTypeBus.getEquipmentTypeName(eqMaBus.getEquipmentTypeID(equipmentID));
                COMPONENT_MASTER_BUS   comMasterBus = new COMPONENT_MASTER_BUS();
                API_COMPONENT_TYPE_BUS apiBus       = new API_COMPONENT_TYPE_BUS();
                int    apiID = comMasterBus.getAPIComponentTypeID(equipmentID);
                String API_ComponentType_Name      = apiBus.getAPIComponentTypeName(apiID);
                RW_INPUT_CA_LEVEL_1_BUS busInputCA = new RW_INPUT_CA_LEVEL_1_BUS();
                RW_INPUT_CA_LEVEL_1     inputCA    = busInputCA.getData(allIDAssessment[i]);

                SITES_BUS         busSite       = new SITES_BUS();
                FACILITY_BUS      busFacility   = new FACILITY_BUS();
                RW_ASSESSMENT_BUS busAssessment = new RW_ASSESSMENT_BUS();

                risk.SitesName       = busSite.getSiteName(eqMaBus.getSiteID(equipmentID));
                risk.FacilityName    = busFacility.getFacilityName(eqMaBus.getFacilityID(equipmentID));
                risk.AssessmentName  = busAssessment.getAssessmentName(allIDAssessment[i]);
                risk.EquipmentName   = eqMaBus.getEquipmentName(equipmentID);
                risk.EquipmentNumber = eqMaBus.getEquipmentNumber(equipmentID);    //Equipment Name or Equipment Number can dc gan lai
                risk.EquipmentDesc   = eqMaBus.getEquipmentDesc(equipmentID);      //Equipment Description gan lai
                risk.EquipmentType   = equipmentTypename;                          //Equipment type
                risk.ComponentName   = comMasterBus.getComponentName(equipmentID); //component name
                risk.RepresentFluid  = inputCA.API_FLUID;                          //Represent fluid
                risk.FluidPhase      = inputCA.SYSTEM;                             //fluid phase
                risk.currentRisk     = 0;                                          //current risk
                //risk.cofcatFlammable = CA.CA_inj_flame; //cofcat. Flammable
                //risk.cofcatPeople = CA.FC_inj;//cofcat people
                //risk.cofcatAsset = CA.FC_prod;//cofcat assessment
                //risk.cofcatEnv = CA.FC_envi;//cofcat envroment
                //risk.cofcatReputation = 0; //cof reputation
                //risk.cofcatCombined = CA.FC_total; //combined
                //risk.componentMaterialGrade; //component material glade
                risk.initThinningPoF   = fullPoF.ThinningAP1;                                             //Thinning POF
                risk.initEnvCracking   = fullPoF.SCCAP1;                                                  //Cracking env
                risk.initOtherPoF      = fullPoF.HTHA_AP1 + fullPoF.BrittleAP1;                           //OtherPOF
                risk.initPoF           = risk.initThinningPoF + risk.initEnvCracking + risk.initOtherPoF; //Init POF
                risk.extThinningPoF    = fullPoF.ExternalAP1;                                             //Ext Thinning POF
                risk.extEnvCrackingPoF = 0;                                                               //ExtEnv Cracking
                risk.extOtherPoF       = 0;                                                               //Ext Other POF
                risk.extPoF            = risk.extThinningPoF + risk.extEnvCrackingPoF + risk.extOtherPoF; //Ext POF
                risk.PoF = risk.initPoF + risk.extPoF;                                                    //POF
                //risk.CurrentRiskCalculation = fullPoF.PoFAP1 * CA.FC_total; //Current risk
                //risk.futureRisk = fullPoF.PoFAP2 * CA.FC_total;
                dataRisk.Add(risk);
            }
            return(dataRisk);
        }
        private void btnRestoreInspectionPlan_Click(object sender, EventArgs e)
        {
            WaitForm2 wf = new WaitForm2();

            wf.Show();
            dtgvInsHis.Rows.Clear();

            RW_ASSESSMENT_BUS              rwAssBus    = new RW_ASSESSMENT_BUS();
            INSPECTION_COVERAGE_BUS        insCovBus   = new INSPECTION_COVERAGE_BUS();
            INSPECTION_PLAN_BUS            inPlanBus   = new INSPECTION_PLAN_BUS();
            INSPECTION_COVERAGE_DETAIL_BUS insCovDeBus = new INSPECTION_COVERAGE_DETAIL_BUS();
            DM_ITEMS_BUS dmItemsBus     = new DM_ITEMS_BUS();
            List <int>   listIDCoverage = insCovBus.getlistIDbyEquipmentIDandComponentID(rwAssBus.getEquipmentID(IDAss), rwAssBus.getComponentID(IDAss));

            foreach (int i in listIDCoverage)
            {
                List <int> listIDDetal = insCovDeBus.getIDbyCoverageID(i);
                foreach (int j in listIDDetal)
                {
                    INSPECTION_COVERAGE_DETAIL insCovDe = insCovDeBus.getDataSourcebyID(j);
                    dtgvInsHis.Rows.Add(inPlanBus.getPlanName(insCovBus.getPlanIDbyID(i)), insCovDe.InspectionDate.ToShortDateString(), dmItemsBus.getDMDescriptionbyDMItemID(insCovDe.DMItemID), insCovDe.InspectionSummary, "...", insCovDe.EffectivenessCode, insCovDe.IsCarriedOut, insCovDe.CarriedOutDate.ToShortDateString(), "Delete");
                }
            }
            int n = dtgvInsHis.RowCount;

            for (int i = 0; i < n; i++)
            {
                dtgvInsHis.Rows[i].ReadOnly          = true;
                dtgvInsHis.Rows[i].Cells[6].ReadOnly = false;
                dtgvInsHis.Rows[i].Cells[5].ReadOnly = false;
                dtgvInsHis.Rows[i].Cells[8].ReadOnly = false;
                dtgvInsHis.Rows[i].Cells[3].ReadOnly = false;
            }
            wf.Close();
        }