Esempio n. 1
0
        private List <RW_INSPECTION_DETAIL> getDataInspectionHistory()
        {
            RW_INSPECTION_HISTORY_BUS   busInspHis  = new RW_INSPECTION_HISTORY_BUS();
            List <RW_INSPECTION_DETAIL> listInspHis = busInspHis.getDataSource();
            List <RW_INSPECTION_DETAIL> listData    = new List <RW_INSPECTION_DETAIL>();
            EQUIPMENT_MASTER_BUS        busEqMaster = new EQUIPMENT_MASTER_BUS();
            SITES_BUS    busSite     = new SITES_BUS();
            FACILITY_BUS busFacility = new FACILITY_BUS();

            foreach (RW_INSPECTION_DETAIL inspHis in listInspHis)
            {
                int eqID = inspHis.EquipmentID;
                RW_INSPECTION_DETAIL rwInspHis = inspHis;
                rwInspHis.SiteName     = busSite.getSiteName(busEqMaster.getSiteID(eqID));
                rwInspHis.FacilityName = busFacility.getFacilityName(busEqMaster.getFacilityID(eqID));
                listData.Add(rwInspHis);
            }
            return(listData);
        }
        private List <RW_INSPECTION_HISTORY> getData()
        {
            RW_INSPECTION_HISTORY_BUS    busInspHis  = new RW_INSPECTION_HISTORY_BUS();
            List <RW_INSPECTION_HISTORY> listInspHis = busInspHis.getDataSource();
            List <RW_INSPECTION_HISTORY> listData    = new List <RW_INSPECTION_HISTORY>();
            EQUIPMENT_MASTER_BUS         busEqMaster = new EQUIPMENT_MASTER_BUS();
            SITES_BUS    busSite     = new SITES_BUS();
            FACILITY_BUS busFacility = new FACILITY_BUS();

            foreach (RW_INSPECTION_HISTORY inspHis in listInspHis)
            {
                String eqNumber = inspHis.EquipmentNumber;
                int    eqID     = busEqMaster.getIDbyNumber(inspHis.EquipmentNumber);
                RW_INSPECTION_HISTORY rwInspHis = inspHis;
                rwInspHis.SiteName     = busSite.getSiteName(busEqMaster.getSiteID(eqID));
                rwInspHis.FacilityName = busFacility.getFacilityName(busEqMaster.getFacilityID(eqID));
                listData.Add(rwInspHis);
            }
            return(listData);
        }
        private void ShowDataToControl(int ID)
        {
            COMPONENT_MASTER com = componentMaster_Bus.getData(ID);
            int eqID             = componentMaster_Bus.getEquipmentID(ID);
            //Equipment Number
            List <string> eqNum = equipmentBus.getListEquipmentNumber();

            cbEquipmentNumber.Properties.Items.Clear();
            cbEquipmentNumber.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < eqNum.Count; i++)
            {
                cbEquipmentNumber.Properties.Items.Add(eqNum[i], i, i);
                if (eqNum[i] == equipmentBus.getEquipmentNumber(eqID))
                {
                    cbEquipmentNumber.SelectedIndex = i + 1;
                }
            }
            cbEquipmentNumber.Enabled = false;
            //Equipment Type
            EQUIPMENT_TYPE_BUS eqTypeBus = new EQUIPMENT_TYPE_BUS();

            txtEquipmentType.Text     = eqTypeBus.getEquipmentTypeName(equipmentBus.getEquipmentTypeID(eqID));
            txtEquipmentType.ReadOnly = true;
            txtEquipmentType.Enabled  = false;
            //Sites
            cbSites.Properties.Items.Add(siteBus.getSiteName(equipmentBus.getSiteID(eqID)), 0, 0);
            cbSites.SelectedIndex = 0;
            cbSites.Enabled       = false;
            //Facility
            int faciID = equipmentBus.getFacilityID(eqID);

            cbFacility.Properties.Items.Add(facilityBus.getFacilityName(faciID), 0, 0);
            cbFacility.SelectedIndex = 0;
            cbFacility.Enabled       = false;
            //Component Number
            txtComponentNumber.Text = componentMaster_Bus.getComponentNumber(ID);

            //<lọc dữ liệu cho trường hợp tank>
            int _equipmentTypeID = equipmentBus.getEqTypeID(ID);

            if (_equipmentTypeID == 11)
            {
                string[] componentTypeName = { "Fixed Roof", "Floating Roof", "Shell", "Tank Bottom" };
                string[] APIcomp           = { "COURSE-1", "COURSE-10", "COURSE-2", "COURSE-3", "COURSE-4", "COURSE-5", "COURSE-6", "COURSE-7", "COURSE-8", "COURSE-9", "TANKBOTTOM" };
                cbComponentType.Properties.Items.Clear();
                cbComponentType.Properties.Items.Add("", -1, -1);
                for (int i = 0; i < componentTypeName.Length; i++)
                {
                    cbComponentType.Properties.Items.Add(componentTypeName[i], i, i);
                    if (componentTypeName[i] == componentBus.getComponentTypeName(componentMaster_Bus.getComponentTypeID(ID)))
                    {
                        cbComponentType.SelectedIndex = i + 1;
                    }
                }
                cbAPIComponentType.Properties.Items.Clear();
                cbAPIComponentType.Properties.Items.Add("", -1, -1);
                for (int i = 0; i < APIcomp.Length; i++)
                {
                    cbAPIComponentType.Properties.Items.Add(APIcomp[i], i, i);
                    if (APIcomp[i] == API_BUS.getAPIComponentTypeName(componentMaster_Bus.getAPIComponentTypeID(eqID)))
                    {
                        cbAPIComponentType.SelectedIndex = i + 1;
                    }
                }
            }
            else
            {
                //get data for API component
                listAPIComponent = API_BUS.getDataSource();
                cbAPIComponentType.Properties.Items.Clear();
                cbAPIComponentType.Properties.Items.Add("", -1, -1);
                for (int i = 0; i < listAPIComponent.Count; i++)
                {
                    cbAPIComponentType.Properties.Items.Add(listAPIComponent[i].APIComponentTypeName, i, i);
                    if (listAPIComponent[i].APIComponentTypeName == API_BUS.getAPIComponentTypeName(componentMaster_Bus.getAPIComponentTypeID(eqID)))
                    {
                        cbAPIComponentType.SelectedIndex = i + 1;
                    }
                }
                //get data for component type
                listComponent = componentBus.getDataSource();
                cbComponentType.Properties.Items.Clear();
                cbComponentType.Properties.Items.Add("", -1, -1);
                for (int i = 0; i < listComponent.Count; i++)
                {
                    cbComponentType.Properties.Items.Add(listComponent[i].ComponentTypeName, i, i);
                    if (listComponent[i].ComponentTypeName == componentBus.getComponentTypeName(componentMaster_Bus.getComponentTypeID(ID)))
                    {
                        cbComponentType.SelectedIndex = i + 1;
                    }
                }
            }
            //</lọc data cho tank>
            txtComponentName.Text = componentMaster_Bus.getComponentName(ID);
            chkLinks.Checked      = com.IsEquipmentLinked == 1 ? true : false;
            txtDescription.Text   = com.ComponentDesc;
        }
Esempio n. 4
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);
        }