public void showDatatoControl(int ID)
        {
            EQUIPMENT_TYPE_BUS     eqTypeBus          = new EQUIPMENT_TYPE_BUS();
            EQUIPMENT_MASTER_BUS   equipmentMasterBus = new EQUIPMENT_MASTER_BUS();
            DESIGN_CODE_BUS        designCodeBus      = new DESIGN_CODE_BUS();
            SITES_BUS              siteBus            = new SITES_BUS();
            FACILITY_BUS           facilityBus        = new FACILITY_BUS();
            MANUFACTURER_BUS       manuBus            = new MANUFACTURER_BUS();
            RW_ASSESSMENT_BUS      rwAssBus           = new RW_ASSESSMENT_BUS();
            COMPONENT_MASTER_BUS   comMaBus           = new COMPONENT_MASTER_BUS();
            COMPONENT_TYPE__BUS    comTypeBus         = new COMPONENT_TYPE__BUS();
            API_COMPONENT_TYPE_BUS apiComponentBus    = new API_COMPONENT_TYPE_BUS();

            int[]            equipmentID_componentID = rwAssBus.getEquipmentID_ComponentID(ID);
            EQUIPMENT_MASTER eqMa  = equipmentMasterBus.getData(equipmentID_componentID[0]);
            COMPONENT_MASTER comMa = comMaBus.getData(equipmentID_componentID[1]);
            RW_ASSESSMENT    ass   = rwAssBus.getData(ID);

            txtAssessmentName.Text      = ass.ProposalName;
            dateAssessmentDate.DateTime = ass.AssessmentDate;
            txtRiskAnalysisPeriod.Text  = ass.RiskAnalysisPeriod.ToString();

            txtEquipmentNumber.Text    = eqMa.EquipmentNumber;
            txtEquipmentType.Text      = eqTypeBus.getEquipmentTypeName(eqMa.EquipmentTypeID);
            txtSites.Text              = siteBus.getSiteName(eqMa.SiteID);
            txtDesignCode.Text         = designCodeBus.getDesignCodeName(eqMa.DesignCodeID);
            txtFacility.Text           = facilityBus.getFacilityName(eqMa.FacilityID);
            txtManufacturer.Text       = manuBus.getManuName(eqMa.ManufacturerID);
            dateComissionDate.DateTime = eqMa.CommissionDate;
            txtEquipmentName.Text      = eqMa.EquipmentName;
            txtProcessDesciption.Text  = eqMa.ProcessDescription;

            txtComponentNumber.Text           = comMa.ComponentNumber;
            txtComponentType.Text             = comTypeBus.getComponentTypeName(comMa.ComponentTypeID);
            txtAPIComponentType.Text          = apiComponentBus.getAPIComponentTypeName(comMa.APIComponentTypeID);
            txtComponentName.Text             = comMa.ComponentName;
            chkRiskLinksEquipmentRisk.Checked = comMa.IsEquipmentLinked == 1 ? true : false;
            for (int i = 0; i < itemsAssessmentMethod.Length; i++)
            {
                if (ass.AssessmentMethod == i)
                {
                    cbAsessmentMethod.SelectedIndex = i + 1;
                    break;
                }
            }
        }
Esempio n. 2
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 btnImport_Click(object sender, EventArgs e)
        {
            SplashScreenManager.ShowForm(typeof(WaitForm2));
            // data from file
            SITES_BUS                 busSite         = new SITES_BUS();
            FACILITY_BUS              busFacility     = new FACILITY_BUS();
            MANUFACTURER_BUS          busManufacture  = new MANUFACTURER_BUS();
            DESIGN_CODE_BUS           busDesign       = new DESIGN_CODE_BUS();
            EQUIPMENT_MASTER_BUS      busEqMaster     = new EQUIPMENT_MASTER_BUS();
            COMPONENT_MASTER_BUS      busComMaster    = new COMPONENT_MASTER_BUS();
            RW_ASSESSMENT_BUS         busAss          = new RW_ASSESSMENT_BUS();
            RW_EQUIPMENT_BUS          busEq           = new RW_EQUIPMENT_BUS();
            RW_COMPONENT_BUS          buscom          = new RW_COMPONENT_BUS();
            RW_EXTCOR_TEMPERATURE_BUS busExcort       = new RW_EXTCOR_TEMPERATURE_BUS();
            RW_STREAM_BUS             busStream       = new RW_STREAM_BUS();
            RW_MATERIAL_BUS           busMaterial     = new RW_MATERIAL_BUS();
            RW_COATING_BUS            busCoat         = new RW_COATING_BUS();
            RW_INPUT_CA_LEVEL_1_BUS   busInputCA      = new RW_INPUT_CA_LEVEL_1_BUS();
            FACILITY_RISK_TARGET_BUS  busRiskTarget   = new FACILITY_RISK_TARGET_BUS();
            Bus_PLANT_PROCESS_Excel   busExcelProcess = new Bus_PLANT_PROCESS_Excel();

            busExcelProcess.path = txtPathFileExcel.Text;
            List <SITES> listSite = busExcelProcess.getAllSite();

            foreach (SITES s in listSite)
            {
                if (!busSite.checkExist(s.SiteName))
                {
                    busSite.add(s);
                }
                else
                {
                    busSite.edit(s);
                }
            }

            List <FACILITY> listFacility = busExcelProcess.getFacility();

            foreach (FACILITY f in listFacility)
            {
                if (busFacility.checkExist(f.FacilityName))
                {
                    busFacility.edit(f);
                }
                else
                {
                    busFacility.add(f);
                    int FaciID = busFacility.getLastFacilityID();
                    FACILITY_RISK_TARGET riskTarget = new FACILITY_RISK_TARGET();
                    riskTarget.FacilityID = FaciID;
                    busRiskTarget.add(riskTarget);
                }
            }

            List <string> manufacture = busExcelProcess.getAllManufacture();

            for (int i = 0; i < manufacture.Count; i++)
            {
                MANUFACTURER manu = new MANUFACTURER();
                manu.ManufacturerID   = busManufacture.getIDbyName(manufacture[i]);
                manu.ManufacturerName = manufacture[i];
                if (busManufacture.getIDbyName(manufacture[i]) == 0)
                {
                    busManufacture.add(manu);
                }
                else
                {
                    busManufacture.edit(manu);
                }
            }

            List <String> designcode = busExcelProcess.getAllDesigncode();

            for (int i = 0; i < designcode.Count; i++)
            {
                DESIGN_CODE design = new DESIGN_CODE();
                design.DesignCodeID  = busDesign.getIDbyName(designcode[i]);
                design.DesignCode    = designcode[i];
                design.DesignCodeApp = "";
                if (design.DesignCodeID == 0)
                {
                    busDesign.add(design);
                }
                else
                {
                    busDesign.edit(design);
                }
            }

            List <EQUIPMENT_MASTER> listEpMaster = busExcelProcess.getEquipmentMaster();

            foreach (EQUIPMENT_MASTER eqM in listEpMaster)
            {
                if (busEqMaster.check(eqM.EquipmentNumber))
                {
                    busEqMaster.edit(eqM);
                }
                else
                {
                    busEqMaster.add(eqM);
                }
            }

            List <COMPONENT_MASTER> listComMaster = busExcelProcess.getComponentMaster();

            foreach (COMPONENT_MASTER comM in listComMaster)
            {
                if (busComMaster.checkExist(comM.ComponentNumber))
                {
                    busComMaster.edit(comM);
                }
                else
                {
                    busComMaster.add(comM);
                }
            }

            List <RW_ASSESSMENT> listRW_Assessment = busExcelProcess.getAssessment();
            List <int>           editExcel         = new List <int>();
            List <int>           addExcel          = new List <int>();

            foreach (RW_ASSESSMENT rwAss in listRW_Assessment)
            {
                //kiem tra xem Proposal add bang file Excel hay add bang tay
                List <int[]> ID_checkAddbyExcel = busAss.getCheckAddExcel_ID(rwAss.ComponentID, rwAss.EquipmentID);
                if (ID_checkAddbyExcel.Count != 0)
                {
                    for (int i = 0; i < ID_checkAddbyExcel.Count; i++)
                    {
                        if (ID_checkAddbyExcel[i][0] != 0) //kiem tra xem co phai Assessment nay duoc them tu file Excel ko, !=0 la them tu file Excel
                        {
                            rwAss.ID = ID_checkAddbyExcel[i][1];
                            editExcel.Add(rwAss.ID);
                            busAss.edit(rwAss);
                        }
                    }
                }
                else
                {
                    rwAss.AddByExcel = 1;
                    busAss.add(rwAss);
                    int assID = busAss.getLastID();
                    addExcel.Add(assID);
                    RW_INPUT_CA_LEVEL_1 inputCA = new RW_INPUT_CA_LEVEL_1();
                    inputCA.ID = assID;
                    busInputCA.add(inputCA);
                }
            }

            List <RW_EQUIPMENT> listRw_eq = busExcelProcess.getRwEquipment();

            for (int i = 0; i < listRw_eq.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_eq[i].ID == editExcel[j])
                        {
                            busEq.edit(listRw_eq[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_eq[i].ID == addExcel[j])
                        {
                            busEq.add(listRw_eq[i]);
                        }
                    }
                }
            }

            List <RW_COMPONENT> listRw_com = busExcelProcess.getRwComponent();

            for (int i = 0; i < listRw_com.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_com[i].ID == editExcel[j])
                        {
                            buscom.edit(listRw_com[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_com[i].ID == addExcel[j])
                        {
                            buscom.add(listRw_com[i]);
                        }
                    }
                }
            }

            List <RW_EXTCOR_TEMPERATURE> listRw_extcor = busExcelProcess.getRwExtTemp();

            //MessageBox.Show(listRw_extcor.Count.ToString());
            for (int i = 0; i < listRw_extcor.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_extcor[i].ID == editExcel[j])
                        {
                            //MessageBox.Show("add file excel");
                            busExcort.edit(listRw_extcor[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_extcor[i].ID == addExcel[j])
                        {
                            //MessageBox.Show("add file excel");
                            busExcort.add(listRw_extcor[i]);
                        }
                    }
                }
            }

            List <RW_STREAM> listRw_stream = busExcelProcess.getRwStream();

            for (int i = 0; i < listRw_stream.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_stream[i].ID == editExcel[j])
                        {
                            busStream.edit(listRw_stream[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_stream[i].ID == addExcel[j])
                        {
                            busStream.add(listRw_stream[i]);
                        }
                    }
                }
            }

            List <RW_MATERIAL> listRw_material = busExcelProcess.getRwMaterial();

            for (int i = 0; i < listRw_material.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_material[i].ID == editExcel[j])
                        {
                            busMaterial.edit(listRw_material[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_material[i].ID == addExcel[j])
                        {
                            busMaterial.add(listRw_material[i]);
                        }
                    }
                }
            }

            List <RW_COATING> listRw_coat = busExcelProcess.getRwCoating();

            for (int i = 0; i < listRw_coat.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (listRw_coat[i].ID == editExcel[j])
                        {
                            busCoat.edit(listRw_coat[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (listRw_coat[i].ID == addExcel[j])
                        {
                            busCoat.add(listRw_coat[i]);
                        }
                    }
                }
            }
            ButtonOKClicked = true;
            SplashScreenManager.CloseForm();
            MessageBox.Show("All data have been saved! You need to add Risk Target in Facility!", "Cortek RBI", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            this.Close();
        }
        private void btnImport_Click(object sender, EventArgs e)
        {
            SplashScreenManager.ShowForm(typeof(WaitForm2));
            SITES_BUS                 busSite        = new SITES_BUS();
            FACILITY_BUS              busFacility    = new FACILITY_BUS();
            MANUFACTURER_BUS          busManufacture = new MANUFACTURER_BUS();
            DESIGN_CODE_BUS           busDesignCode  = new DESIGN_CODE_BUS();
            FACILITY_RISK_TARGET_BUS  busRiskTarget  = new FACILITY_RISK_TARGET_BUS();
            EQUIPMENT_MASTER_BUS      busEquipMaster = new EQUIPMENT_MASTER_BUS();
            COMPONENT_MASTER_BUS      busCompMaster  = new COMPONENT_MASTER_BUS();
            RW_ASSESSMENT_BUS         busAss         = new RW_ASSESSMENT_BUS();
            RW_EQUIPMENT_BUS          busEquip       = new RW_EQUIPMENT_BUS();
            RW_COMPONENT_BUS          busCom         = new RW_COMPONENT_BUS();
            RW_EXTCOR_TEMPERATURE_BUS busExtcor      = new RW_EXTCOR_TEMPERATURE_BUS();
            RW_STREAM_BUS             busStream      = new RW_STREAM_BUS();
            RW_MATERIAL_BUS           busMaterial    = new RW_MATERIAL_BUS();
            RW_COATING_BUS            busCoating     = new RW_COATING_BUS();
            RW_INPUT_CA_TANK_BUS      busInputCATank = new RW_INPUT_CA_TANK_BUS();
            Bus_PLANT_PROCESS_Excel   busExcel       = new Bus_PLANT_PROCESS_Excel();

            busExcel.path = txtPathFileExcel.Text;
            //Sites
            List <SITES> lstSite = busExcel.getAllSite();

            foreach (SITES s in lstSite)
            {
                if (!busSite.checkExist(s.SiteName))
                {
                    busSite.add(s);
                }
                else
                {
                    busSite.edit(s);
                }
            }

            //Facility
            List <FACILITY> lstFacility = busExcel.getFacility();

            foreach (FACILITY f in lstFacility)
            {
                if (busFacility.checkExist(f.FacilityName))
                {
                    busFacility.edit(f);
                }
                else
                {
                    busFacility.add(f);
                    int FaciID = busFacility.getLastFacilityID();
                    FACILITY_RISK_TARGET riskTarget = new FACILITY_RISK_TARGET();
                    riskTarget.FacilityID = FaciID;
                    busRiskTarget.add(riskTarget);
                }
            }

            //Manufacture
            List <string> manufacture = busExcel.getAllManufacture();

            for (int i = 0; i < manufacture.Count; i++)
            {
                MANUFACTURER manu = new MANUFACTURER();
                manu.ManufacturerID   = busManufacture.getIDbyName(manufacture[i]);
                manu.ManufacturerName = manufacture[i];
                if (busManufacture.getIDbyName(manufacture[i]) == 0)
                {
                    busManufacture.add(manu);
                }
                else
                {
                    busManufacture.edit(manu);
                }
            }

            //Design Code
            List <string> designCode = busExcel.getAllDesigncode();

            for (int i = 0; i < designCode.Count; i++)
            {
                DESIGN_CODE design = new DESIGN_CODE();
                design.DesignCodeID  = busDesignCode.getIDbyName(designCode[i]);
                design.DesignCode    = designCode[i];
                design.DesignCodeApp = "";
                if (design.DesignCodeID == 0)
                {
                    busDesignCode.add(design);
                }
                else
                {
                    busDesignCode.edit(design);
                }
            }

            //Equipment Master
            List <EQUIPMENT_MASTER> lstEquipMaster = busExcel.getEquipmentMaster();

            foreach (EQUIPMENT_MASTER eq in lstEquipMaster)
            {
                if (busEquipMaster.check(eq.EquipmentNumber))
                {
                    busEquipMaster.edit(eq);
                }
                else
                {
                    busEquipMaster.add(eq);
                }
            }

            //Component Master
            List <COMPONENT_MASTER> lstCompMaster = busExcel.getComponentMaster();

            foreach (COMPONENT_MASTER com in lstCompMaster)
            {
                if (busCompMaster.checkExist(com.ComponentNumber))
                {
                    com.ComponentID = busCompMaster.getIDbyName(com.ComponentNumber);
                    busCompMaster.edit(com);
                }
                else
                {
                    busCompMaster.add(com);
                }
            }

            //Rw Assessment
            List <RW_ASSESSMENT> lstAssessment = busExcel.getAssessment();
            List <int>           editExcel     = new List <int>();
            List <int>           addExcel      = new List <int>();

            foreach (RW_ASSESSMENT ass in lstAssessment)
            {
                List <int[]> ID_checkAddbyExcel = busAss.getCheckAddExcel_ID(ass.ComponentID, ass.EquipmentID);
                if (ID_checkAddbyExcel.Count != 0)
                {
                    for (int i = 0; i < ID_checkAddbyExcel.Count; i++)
                    {
                        if (ID_checkAddbyExcel[i][0] != 0) //kiem tra xem co phai Assessment nay duoc them tu file Excel ko
                        {
                            ass.ID = ID_checkAddbyExcel[i][1];
                            editExcel.Add(ass.ID);
                            busAss.edit(ass);
                        }
                    }
                }
                else
                {
                    ass.AddByExcel = 1;
                    busAss.add(ass);
                    int assID = busAss.getLastID();
                    addExcel.Add(assID);
                    RW_INPUT_CA_TANK inputCATank = new RW_INPUT_CA_TANK();
                    inputCATank.ID = assID;
                    busInputCATank.add(inputCATank);
                }
            }

            //RW Equipment
            List <RW_EQUIPMENT> lstEquipment = busExcel.getRwEquipmentTank();

            for (int i = 0; i < lstEquipment.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstEquipment[i].ID == editExcel[j])
                        {
                            busEquip.edit(lstEquipment[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstEquipment[i].ID == addExcel[j])
                        {
                            busEquip.add(lstEquipment[i]);
                        }
                    }
                }
            }

            //RW Component
            List <RW_COMPONENT> lstComponent = busExcel.getRwComponentTank();

            for (int i = 0; i < lstComponent.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstComponent[i].ID == editExcel[j])
                        {
                            busCom.edit(lstComponent[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstComponent[i].ID == addExcel[j])
                        {
                            busCom.add(lstComponent[i]);
                        }
                    }
                }
            }

            //RW Extcor temperature
            List <RW_EXTCOR_TEMPERATURE> lstExtcor = busExcel.getRwExtTemp();

            for (int i = 0; i < lstExtcor.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstExtcor[i].ID == editExcel[j])
                        {
                            busExtcor.edit(lstExtcor[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstExtcor[i].ID == addExcel[j])
                        {
                            busExtcor.add(lstExtcor[i]);
                        }
                    }
                }
            }

            //RW Stream
            List <RW_STREAM> lstStream = busExcel.getRwStreamTank();

            for (int i = 0; i < lstStream.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstStream[i].ID == editExcel[j])
                        {
                            busStream.edit(lstStream[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstStream[i].ID == addExcel[j])
                        {
                            busStream.add(lstStream[i]);
                        }
                    }
                }
            }

            //RW Material
            List <RW_MATERIAL> lstMaterial = busExcel.getRwMaterialTank();

            for (int i = 0; i < lstMaterial.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstMaterial[i].ID == editExcel[j])
                        {
                            busMaterial.edit(lstMaterial[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstMaterial[i].ID == addExcel[j])
                        {
                            busMaterial.add(lstMaterial[i]);
                        }
                    }
                }
            }

            //RW Coating
            List <RW_COATING> lstCoating = busExcel.getRwCoating();

            for (int i = 0; i < lstCoating.Count; i++)
            {
                if (editExcel.Count != 0)
                {
                    for (int j = 0; j < editExcel.Count; j++)
                    {
                        if (lstCoating[i].ID == editExcel[j])
                        {
                            busCoating.edit(lstCoating[i]);
                        }
                    }
                }
                if (addExcel.Count != 0)
                {
                    for (int j = 0; j < addExcel.Count; j++)
                    {
                        if (lstCoating[i].ID == addExcel[j])
                        {
                            busCoating.add(lstCoating[i]);
                        }
                    }
                }
            }
            ButtonOKClicked = true;
            SplashScreenManager.CloseForm();
            MessageBox.Show("All data have been saved! You need to add Risk Target in Facility!", "Cortek RBI", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            this.Close();
        }
Esempio n. 6
0
        public void showDatatoControl(int ID)
        {
            EQUIPMENT_TYPE_BUS     eqTypeBus          = new EQUIPMENT_TYPE_BUS();
            EQUIPMENT_MASTER_BUS   equipmentMasterBus = new EQUIPMENT_MASTER_BUS();
            DESIGN_CODE_BUS        designCodeBus      = new DESIGN_CODE_BUS();
            SITES_BUS              siteBus            = new SITES_BUS();
            FACILITY_BUS           facilityBus        = new FACILITY_BUS();
            MANUFACTURER_BUS       manuBus            = new MANUFACTURER_BUS();
            RW_ASSESSMENT_BUS      rwAssBus           = new RW_ASSESSMENT_BUS();
            COMPONENT_MASTER_BUS   comMaBus           = new COMPONENT_MASTER_BUS();
            COMPONENT_TYPE__BUS    comTypeBus         = new COMPONENT_TYPE__BUS();
            API_COMPONENT_TYPE_BUS apiComponentBus    = new API_COMPONENT_TYPE_BUS();

            int[]            equipmentID_componentID = rwAssBus.getEquipmentID_ComponentID(ID);
            EQUIPMENT_MASTER eqMa  = equipmentMasterBus.getData(equipmentID_componentID[0]);
            COMPONENT_MASTER comMa = comMaBus.getData(equipmentID_componentID[1]);
            RW_ASSESSMENT    ass   = rwAssBus.getData(ID);

            txtAssessmentName.Text      = ass.ProposalName;
            dateAssessmentDate.DateTime = ass.AssessmentDate;
            txtRiskAnalysisPeriod.Text  = ass.RiskAnalysisPeriod.ToString();

            txtEquipmentNumber.Text    = eqMa.EquipmentNumber;
            txtEquipmentType.Text      = eqTypeBus.getEquipmentTypeName(eqMa.EquipmentTypeID);
            txtSites.Text              = siteBus.getSiteName(eqMa.SiteID);
            txtDesignCode.Text         = designCodeBus.getDesignCodeName(eqMa.DesignCodeID);
            txtFacility.Text           = facilityBus.getFacilityName(eqMa.FacilityID);
            txtManufacturer.Text       = manuBus.getManuName(eqMa.ManufacturerID);
            dateComissionDate.DateTime = eqMa.CommissionDate;
            txtEquipmentName.Text      = eqMa.EquipmentName;
            txtProcessDesciption.Text  = eqMa.ProcessDescription;

            txtComponentNumber.Text           = comMa.ComponentNumber;
            txtComponentType.Text             = comTypeBus.getComponentTypeName(comMa.ComponentTypeID);
            txtAPIComponentType.Text          = apiComponentBus.getAPIComponentTypeName(comMa.APIComponentTypeID);
            txtComponentName.Text             = comMa.ComponentName;
            chkRiskLinksEquipmentRisk.Checked = comMa.IsEquipmentLinked == 1 ? true : false;
            //foreach(RW_ASSESSMENT a in listAssessment)
            //{
            //    if(a.ID == ID)
            //    {
            //        txtAssessmentName.Text = a.ProposalName;
            //        ProposalName = a.ProposalName;
            //        dateAssessmentDate.DateTime = a.AssessmentDate;
            //        txtRiskAnalysisPeriod.Text = a.RiskAnalysisPeriod.ToString();
            //        foreach (EQUIPMENT_MASTER e in listEquipmentMaster)
            //        {
            //            if (e.EquipmentID == a.EquipmentID)
            //            {
            //                txtEquipmentNumber.Text = e.EquipmentNumber;
            //                dateComissionDate.DateTime = e.CommissionDate;
            //                txtEquipmentName.Text = e.EquipmentName;
            //                foreach (EQUIPMENT_TYPE t in listEquipmentType)
            //                {
            //                    if (t.EquipmentTypeID == e.EquipmentTypeID)
            //                        txtEquipmentType.Text = t.EquipmentTypeName;
            //                }
            //                foreach (DESIGN_CODE d in listDesignCode)
            //                {
            //                    if (d.DesignCodeID == e.DesignCodeID)
            //                        txtDesignCode.Text = d.DesignCode;
            //                }
            //                foreach (FACILITY f in listFacility)
            //                {
            //                    if (e.FacilityID == f.FacilityID)
            //                        txtFacility.Text = f.FacilityName;
            //                }
            //                foreach (SITES s in listSite)
            //                {
            //                    if (s.SiteID == e.SiteID)
            //                        txtSites.Text = s.SiteName;
            //                }
            //                foreach (MANUFACTURER m in listManu)
            //                {
            //                    if (m.ManufacturerID == e.ManufacturerID)
            //                        txtManufacturer.Text = m.ManufacturerName;
            //                }
            //            }
            //            break;
            //        }
            //        foreach (COMPONENT_MASTER c in listComMa)
            //        {
            //            if (c.ComponentID == a.ComponentID)
            //            {
            //                txtComponentNumber.Text = c.ComponentNumber;
            //                foreach (COMPONENT_TYPE t in listComponentType)
            //                {
            //                    if (c.ComponentTypeID == t.ComponentTypeID)
            //                    {
            //                        txtComponentType.Text = t.ComponentTypeName;
            //                    }
            //                }
            //                txtComponentName.Text = c.ComponentName;
            //                foreach (API_COMPONENT_TYPE a1 in listAPICom)
            //                {
            //                    if (a1.APIComponentTypeID == c.APIComponentTypeID)
            //                    {
            //                        txtAPIComponentType.Text = a1.APIComponentTypeName;
            //                    }
            //                }
            //            }
            //            break;
            //        }

            //}
            //foreach (RW_ASSESSMENT a in listAssessment)
            //{
            //    if (a.ID == assID)
            //    {
            //        txtAssessmentName.Text = a.ProposalName;
            //    }
            //}
            //đổ dữ liệu lên control cho Equipment
        }
Esempio n. 7
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);
        }