Пример #1
0
        public void ShowDataOutputCA(int ID)
        {
            //RW_CA_TANK_BUS busTank = new RW_CA_TANK_BUS();
            //RW_CA_TANK ca = busTank.getData(ID);
            //txtCA.Text = ca.ConsequenceCategory;
            //txtFC.Text = ca.Consequence.ToString();
            RW_CA_LEVEL_1_BUS busCA = new RW_CA_LEVEL_1_BUS();
            RW_CA_LEVEL_1     ca    = busCA.getData(ID);

            txtCAcmd.Text     = ca.CA_cmd.ToString();
            txtCAinj.Text     = ca.CA_inj_flame.ToString();
            txtFCcmd.Text     = ca.FC_cmd.ToString();
            txtFCinj.Text     = ca.FC_inj.ToString();
            txtFCaffa.Text    = ca.FC_affa.ToString();
            txtFCprod.Text    = ca.FC_prod.ToString();
            txtFCenviron.Text = ca.FC_envi.ToString();
        }
        public RW_CA_LEVEL_1 getData(int ID)
        {
            RW_CA_LEVEL_1 obj  = new RW_CA_LEVEL_1();
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            String sql = "USE [rbi] " +
                         "SELECT [Release_Phase]" +
                         ",[fact_di]" +
                         ",[fact_mit]" +
                         ",[fact_ait]" +
                         ",[CA_cmd]" +
                         ",[CA_inj_flame]" +
                         ",[CA_inj_toxic]" +
                         ",[CA_inj_ntnf]" +
                         ",[FC_cmd]" +
                         ",[FC_affa]" +
                         ",[FC_prod]" +
                         ",[FC_inj]" +
                         ",[FC_envi]" +
                         ",[FC_total]" +
                         ",[FCOF_Category]" +
                         " FROM [rbi].[dbo].[RW_CA_LEVEL1] WHERE [ID] ='" + ID + "'";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj.ID            = ID;
                            obj.Release_Phase = reader.GetString(0);
                            obj.fact_di       = (float)reader.GetDouble(1);
                            obj.fact_mit      = (float)reader.GetDouble(2);
                            obj.fact_ait      = (float)reader.GetDouble(3);
                            obj.CA_cmd        = (float)reader.GetDouble(4);
                            obj.CA_inj_flame  = (float)reader.GetDouble(5);
                            obj.CA_inj_toxic  = (float)reader.GetDouble(6);
                            obj.CA_inj_ntnf   = (float)reader.GetDouble(7);
                            obj.FC_cmd        = (float)reader.GetDouble(8);
                            obj.FC_affa       = (float)reader.GetDouble(9);
                            obj.FC_prod       = (float)reader.GetDouble(10);
                            obj.FC_inj        = (float)reader.GetDouble(11);
                            obj.FC_envi       = (float)reader.GetDouble(12);
                            obj.FC_total      = (float)reader.GetDouble(13);
                            obj.FCOF_Category = reader.GetString(14);
                        }
                    }
                }
            }
            catch
            {
                obj.ID = 0;
                //MessageBox.Show("GET DATA FAIL!", "ERROR!");
            }
            finally
            {
                conn.Close();
            }
            return(obj);
        }
Пример #3
0
 public void delete(RW_CA_LEVEL_1 obj)
 {
     DAL.detele(obj.ID);
 }
Пример #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);
        }
Пример #5
0
 public void edit(RW_CA_LEVEL_1 obj)
 {
     DAL.edit(obj.ID, obj.Release_Phase, obj.fact_di, obj.fact_mit, obj.fact_ait, obj.CA_cmd, obj.CA_inj_flame, obj.CA_inj_toxic, obj.CA_inj_ntnf, obj.FC_cmd, obj.FC_affa, obj.FC_prod, obj.FC_inj, obj.FC_envi, obj.FC_total, obj.FCOF_Category);
 }