예제 #1
0
        public RW_ASSESSMENT getAssessmentDate()
        {
            RW_ASSESSMENT ass = new RW_ASSESSMENT();

            ass.AssessmentDate = Convert.ToDateTime(sheetComponent[8]);
            Debug.WriteLine("assessment date " + ass.AssessmentDate);
            return(ass);
        }
        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;
                }
            }
        }
예제 #3
0
        public RW_ASSESSMENT getData(int ID)
        {
            RW_ASSESSMENT_BUS assBus = new RW_ASSESSMENT_BUS();

            int[]         temp = assBus.getEquipmentID_ComponentID(ID);
            RW_ASSESSMENT ass  = new RW_ASSESSMENT();

            ass.AssessmentDate     = dateAssessmentDate.DateTime;
            ass.RiskAnalysisPeriod = txtRiskAnalysisPeriod.Text != "" ? int.Parse(txtRiskAnalysisPeriod.Text) : 0;
            ass.IsEquipmentLinked  = chkRiskLinksEquipmentRisk.Checked ? 1 : 0;
            ass.RecordType         = cbReportTemplate.Text;
            ass.ProposalName       = txtAssessmentName.Text;
            ass.AdoptedDate        = DateTime.Now;
            ass.RecommendedDate    = DateTime.Now;
            ass.EquipmentID        = temp[0];
            ass.ComponentID        = temp[1];
            return(ass);
        }
예제 #4
0
        public RW_ASSESSMENT getData(int ID)
        {
            RW_ASSESSMENT ass  = new RW_ASSESSMENT();
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            String sql = "select ProposalName,AssessmentDate,RiskAnalysisPeriod from rbi.dbo.RW_ASSESSMENT 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)
                        {
                            ass.ProposalName       = reader.GetString(0);
                            ass.AssessmentDate     = reader.GetDateTime(1);
                            ass.RiskAnalysisPeriod = reader.GetInt32(2);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "GET DATA FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(ass);
        }
예제 #5
0
        public List <RW_ASSESSMENT> getDataSource()
        {
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            List <RW_ASSESSMENT> list = new List <RW_ASSESSMENT>();
            RW_ASSESSMENT        obj  = null;
            String sql = " Use [rbi] Select [ID]" +
                         ",[EquipmentID]" +
                         ",[ComponentID]" +
                         ",[AssessmentDate]" +
                         ",[AssessmentMethod]" +
                         ",[RiskAnalysisPeriod]" +
                         ",[IsEquipmentLinked]" +
                         ",[RecordType]" +
                         ",[ProposalNo]" +
                         ",[RevisionNo]" +
                         ",[IsRecommend]" +
                         ",[ProposalOrRevision]" +
                         ",[AdoptedBy]" +
                         ",[AdoptedDate]" +
                         ",[RecommendedBy]" +
                         ",[RecommendedDate]" +
                         ",[ProposalName]" +
                         "From [dbo].[RW_ASSESSMENT]  ";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj             = new RW_ASSESSMENT();
                            obj.ID          = reader.GetInt32(0);
                            obj.EquipmentID = reader.GetInt32(1);
                            obj.ComponentID = reader.GetInt32(2);
                            if (!reader.IsDBNull(3))
                            {
                                obj.AssessmentDate = reader.GetDateTime(3);
                            }
                            if (!reader.IsDBNull(4))
                            {
                                obj.AssessmentMethod = reader.GetInt32(4);
                            }
                            if (!reader.IsDBNull(5))
                            {
                                obj.RiskAnalysisPeriod = reader.GetInt32(5);
                            }
                            obj.IsEquipmentLinked = reader.GetOrdinal("IsEquipmentLinked");
                            if (!reader.IsDBNull(7))
                            {
                                obj.RecordType = reader.GetString(7);
                            }
                            if (!reader.IsDBNull(8))
                            {
                                obj.ProposalNo = reader.GetInt32(8);
                            }
                            if (!reader.IsDBNull(9))
                            {
                                obj.RevisionNo = reader.GetInt32(9);
                            }
                            obj.IsRecommend = reader.GetOrdinal("IsRecommend");
                            if (!reader.IsDBNull(11))
                            {
                                obj.ProposalOrRevision = reader.GetString(11);
                            }
                            if (!reader.IsDBNull(12))
                            {
                                obj.AdoptedBy = reader.GetString(12);
                            }
                            if (!reader.IsDBNull(13))
                            {
                                obj.AdoptedDate = reader.GetDateTime(13);
                            }
                            if (!reader.IsDBNull(14))
                            {
                                obj.RecommendedBy = reader.GetString(14);
                            }
                            if (!reader.IsDBNull(15))
                            {
                                obj.RecommendedDate = reader.GetDateTime(15);
                            }
                            if (!reader.IsDBNull(16))
                            {
                                obj.ProposalName = reader.GetString(16);
                            }
                            list.Add(obj);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "GET DATA FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }
예제 #6
0
        public RW_ASSESSMENT getTopDatabyComponentID(int ComponentID)
        {
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            string sql = "Select TOP 1 [ID]" +
                         ",[EquipmentID]" +
                         ",[ComponentID]" +
                         ",[AssessmentDate]" +
                         ",[AssessmentMethod]" +
                         ",[RiskAnalysisPeriod]" +
                         ",[IsEquipmentLinked]" +
                         ",[RecordType]" +
                         ",[ProposalNo]" +
                         ",[RevisionNo]" +
                         ",[IsRecommend]" +
                         ",[ProposalOrRevision]" +
                         ",[AdoptedBy]" +
                         ",[AdoptedDate]" +
                         ",[RecommendedBy]" +
                         ",[RecommendedDate]" +
                         ",[ProposalName]" +
                         "from rbi.dbo.RW_ASSESSMENT where ComponentID = '" + ComponentID + "'";
            RW_ASSESSMENT obj = new RW_ASSESSMENT();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, conn);
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj             = new RW_ASSESSMENT();
                            obj.ID          = reader.GetInt32(0);
                            obj.EquipmentID = reader.GetInt32(1);
                            obj.ComponentID = reader.GetInt32(2);
                            if (!reader.IsDBNull(3))
                            {
                                obj.AssessmentDate = reader.GetDateTime(3);
                            }
                            if (!reader.IsDBNull(4))
                            {
                                obj.AssessmentMethod = reader.GetInt32(4);
                            }
                            if (!reader.IsDBNull(5))
                            {
                                obj.RiskAnalysisPeriod = reader.GetInt32(5);
                            }
                            obj.IsEquipmentLinked = reader.GetOrdinal("IsEquipmentLinked");
                            if (!reader.IsDBNull(7))
                            {
                                obj.RecordType = reader.GetString(7);
                            }
                            if (!reader.IsDBNull(8))
                            {
                                obj.ProposalNo = reader.GetInt32(8);
                            }
                            if (!reader.IsDBNull(9))
                            {
                                obj.RevisionNo = reader.GetInt32(9);
                            }
                            obj.IsRecommend = reader.GetOrdinal("IsRecommend");
                            if (!reader.IsDBNull(11))
                            {
                                obj.ProposalOrRevision = reader.GetString(11);
                            }
                            if (!reader.IsDBNull(12))
                            {
                                obj.AdoptedBy = reader.GetString(12);
                            }
                            if (!reader.IsDBNull(13))
                            {
                                obj.AdoptedDate = reader.GetDateTime(13);
                            }
                            if (!reader.IsDBNull(14))
                            {
                                obj.RecommendedBy = reader.GetString(14);
                            }
                            if (!reader.IsDBNull(15))
                            {
                                obj.RecommendedDate = reader.GetDateTime(15);
                            }
                            if (!reader.IsDBNull(16))
                            {
                                obj.ProposalName = reader.GetString(16);
                            }
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Get ID fail." + ex.ToString());
            }
            return(obj);
        }
 public void delete(RW_ASSESSMENT obj)
 {
     DAL.delete(obj.ID);
 }
 public void edit(RW_ASSESSMENT obj)
 {
     DAL.edit(obj.ID, obj.EquipmentID, obj.ComponentID, obj.AssessmentDate, obj.AssessmentMethod, obj.RiskAnalysisPeriod, obj.IsEquipmentLinked, obj.RecordType, obj.ProposalNo, obj.RevisionNo, obj.IsRecommend, obj.ProposalOrRevision, obj.AdoptedBy, obj.AdoptedDate, obj.RecommendedBy, obj.RecommendedDate, obj.ProposalName);
 }
예제 #9
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
        }