コード例 #1
0
        public EQUIPMENT_MASTER getData(int eqID)
        {
            EQUIPMENT_MASTER obj = new EQUIPMENT_MASTER();
            SqlConnection    con = MSSQLDBUtils.GetDBConnection();

            con.Open();
            String sql = "select EquipmentNumber,EquipmentTypeID,EquipmentName,CommissionDate,DesignCodeID,SiteID,FacilityID,ManufacturerID,PFDNo,ProcessDescription,EquipmentDesc from rbi.dbo.EQUIPMENT_MASTER where EquipmentID = '" + eqID + "'";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = sql;
                cmd.Connection  = con;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj.EquipmentNumber = reader.GetString(0);
                            obj.EquipmentTypeID = reader.GetInt32(1);
                            obj.EquipmentName   = reader.GetString(2);
                            obj.CommissionDate  = reader.GetDateTime(3);
                            obj.DesignCodeID    = reader.GetInt32(4);
                            obj.SiteID          = reader.GetInt32(5);
                            obj.FacilityID      = reader.GetInt32(6);
                            obj.ManufacturerID  = reader.GetInt32(7);
                            if (!reader.IsDBNull(8))
                            {
                                obj.PFDNo = reader.GetString(8);
                            }
                            if (!reader.IsDBNull(9))
                            {
                                obj.ProcessDescription = reader.GetString(9);
                            }
                            if (!reader.IsDBNull(10))
                            {
                                obj.EquipmentDesc = reader.GetString(10);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Get DateTime Fail------->" + ex.ToString(), "Get Data Fail");
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
            return(obj);
        }
コード例 #2
0
        public EQUIPMENT_MASTER getDataEquipmentMaster()
        {
            EQUIPMENT_MASTER eqMaster = new EQUIPMENT_MASTER();

            foreach (FACILITY f in listFacility)
            {
                if (f.FacilityName == cbFacility.Text)
                {
                    eqMaster.FacilityID = f.FacilityID;
                }
            }
            foreach (SITES s in listSite)
            {
                if (s.SiteName == cbSite.Text)
                {
                    eqMaster.SiteID = s.SiteID;
                }
            }
            foreach (EQUIPMENT_TYPE e in listEquipType)
            {
                if (e.EquipmentTypeName == cbEquipmentType.Text)
                {
                    eqMaster.EquipmentTypeID = e.EquipmentTypeID;
                }
            }
            foreach (DESIGN_CODE d in listDesignCode)
            {
                if (d.DesignCode == cbDesignCode.Text)
                {
                    eqMaster.DesignCodeID = d.DesignCodeID;
                }
            }
            foreach (MANUFACTURER m in listManufacture)
            {
                if (m.ManufacturerName == cbManufacturer.Text)
                {
                    eqMaster.ManufacturerID = m.ManufacturerID;
                }
            }
            eqMaster.EquipmentNumber    = txtEquipmentNumber.Text;
            eqMaster.EquipmentName      = txtEquipmentName.Text;
            eqMaster.CommissionDate     = dateCommission.DateTime;
            eqMaster.PFDNo              = txtPDFNo.Text;
            eqMaster.ProcessDescription = txtProcessDescription.Text;
            eqMaster.EquipmentDesc      = txtDescription.Text;
            eqMaster.IsArchived         = 1;
            eqMaster.Archived           = DateTime.Now;
            return(eqMaster);
        }
コード例 #3
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;
            for (int i = 0; i < itemsAssessmentMethod.Length; i++)
            {
                if (ass.AssessmentMethod == i)
                {
                    cbAsessmentMethod.SelectedIndex = i + 1;
                    break;
                }
            }
        }
コード例 #4
0
        private EQUIPMENT_MASTER getDataEquipmentMaster()
        {
            EQUIPMENT_MASTER eqMaster = new EQUIPMENT_MASTER();

            if (doubleEditClicked)
            {
                eqMaster.EquipmentID = this.EquipmentID;
            }
            eqMaster.SiteID             = siteBus.getIDbyName(cbSite.Text);
            eqMaster.FacilityID         = faciBus.getIDbyName_SiteID(eqMaster.SiteID, cbFacility.Text);
            eqMaster.EquipmentTypeID    = equipType.getIDbyName(cbEquipmentType.Text);
            eqMaster.DesignCodeID       = designCodeBus.getIDbyName(cbDesignCode.Text);
            eqMaster.ManufacturerID     = manuBus.getIDbyName(cbManufacturer.Text);
            eqMaster.EquipmentNumber    = txtEquipmentNumber.Text;
            eqMaster.EquipmentName      = txtEquipmentName.Text;
            eqMaster.CommissionDate     = dateCommission.DateTime;
            eqMaster.PFDNo              = txtPDFNo.Text;
            eqMaster.ProcessDescription = txtProcessDescription.Text;
            eqMaster.EquipmentDesc      = txtDescription.Text;
            eqMaster.IsArchived         = 1;
            eqMaster.Archived           = DateTime.Now;
            return(eqMaster);
        }
コード例 #5
0
        public List <EQUIPMENT_MASTER> getDataSource()
        {
            List <EQUIPMENT_MASTER> list = new List <EQUIPMENT_MASTER>();
            EQUIPMENT_MASTER        obj  = null;
            SqlConnection           conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            String sql = " Use [rbi] Select [EquipmentID]" +
                         ",[EquipmentNumber]" +
                         ",[EquipmentTypeID]" +
                         ",[EquipmentName]" +
                         ",[CommissionDate]" +
                         ",[DesignCodeID]" +
                         ",[SiteID]" +
                         ",[FacilityID]" +
                         ",[ManufacturerID]" +
                         ",[PFDNo]" +
                         ",[ProcessDescription]" +
                         ",[EquipmentDesc]" +
                         ",[IsArchived]" +
                         ",[Archived]" +
                         ",[ArchivedBy]" +
                         "From [rbi].[dbo].[EQUIPMENT_MASTER]";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj                 = new EQUIPMENT_MASTER();
                            obj.EquipmentID     = reader.GetInt32(0);
                            obj.EquipmentNumber = reader.GetString(1);
                            obj.EquipmentTypeID = reader.GetInt32(2);
                            obj.EquipmentName   = reader.GetString(3);
                            obj.CommissionDate  = reader.GetDateTime(4);
                            obj.DesignCodeID    = reader.GetInt32(5);
                            obj.SiteID          = reader.GetInt32(6);
                            obj.FacilityID      = reader.GetInt32(7);
                            obj.ManufacturerID  = reader.GetInt32(8);
                            if (!reader.IsDBNull(9))
                            {
                                obj.PFDNo = reader.GetString(9);
                            }
                            if (!reader.IsDBNull(10))
                            {
                                obj.ProcessDescription = reader.GetString(10);
                            }
                            if (!reader.IsDBNull(11))
                            {
                                obj.EquipmentDesc = reader.GetString(11);
                            }
                            obj.IsArchived = reader.GetOrdinal("IsArchived");
                            if (!reader.IsDBNull(13))
                            {
                                obj.Archived = reader.GetDateTime(13);
                            }
                            if (!reader.IsDBNull(14))
                            {
                                obj.ArchivedBy = reader.GetString(14);
                            }
                            list.Add(obj);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "GET DATA FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }
コード例 #6
0
 public void delete(EQUIPMENT_MASTER obj)
 {
     DAL.delete(obj.EquipmentID);
 }
コード例 #7
0
 public void edit(EQUIPMENT_MASTER obj)
 {
     DAL.edit(obj.EquipmentID, obj.EquipmentNumber, obj.EquipmentTypeID, obj.EquipmentName, obj.CommissionDate, obj.DesignCodeID, obj.SiteID, obj.FacilityID, obj.ManufacturerID, obj.PFDNo, obj.ProcessDescription, obj.EquipmentDesc, obj.IsArchived, obj.Archived, obj.ArchivedBy);
 }
コード例 #8
0
        private void ShowDatatoControl(int ID)
        {
            EQUIPMENT_MASTER eq = equipMasterBus.getData(ID);
            //lay toan bo equipment type name
            List <string> eqTypeName = equipType.getListEquipmentTypeName();

            txtEquipmentNumber.Text = eq.EquipmentNumber;
            cbEquipmentType.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < eqTypeName.Count; i++)
            {
                cbEquipmentType.Properties.Items.Add(eqTypeName[i], i, i);
                if (eqTypeName[i] == equipType.getEquipmentTypeName(eq.EquipmentTypeID))
                {
                    cbEquipmentType.SelectedIndex = i + 1;
                }
            }
            txtEquipmentName.Text = eq.EquipmentName;
            //Site
            List <string> listSite = siteBus.getListSiteName();

            cbSite.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < listSite.Count; i++)
            {
                cbSite.Properties.Items.Add(listSite[i], i, i);
                if (siteBus.getSiteName(eq.SiteID) == listSite[i])
                {
                    cbSite.SelectedIndex = i + 1;
                }
            }
            cbSite.Enabled = false;

            //Facility
            List <string> listFacility = faciBus.getListFacilityName(eq.SiteID);

            cbFacility.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < listFacility.Count; i++)
            {
                cbFacility.Properties.Items.Add(listFacility[i], i, i);
                if (listFacility[i] == faciBus.getFacilityName(eq.FacilityID))
                {
                    cbFacility.SelectedIndex = i + 1;
                }
            }
            cbFacility.Enabled = false;

            //Design Code
            List <string> listDesignCode = designCodeBus.getListDesignCodeName();

            cbDesignCode.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < listDesignCode.Count; i++)
            {
                cbDesignCode.Properties.Items.Add(listDesignCode[i], i, i);
                if (listDesignCode[i] == designCodeBus.getDesignCodeName(eq.DesignCodeID))
                {
                    cbDesignCode.SelectedIndex = i + 1;
                }
            }
            //Manu
            List <string> listManu = manuBus.getListManufactureName();

            cbManufacturer.Properties.Items.Add("", -1, -1);
            for (int i = 0; i < listManu.Count; i++)
            {
                cbManufacturer.Properties.Items.Add(listManu[i], i, i);
                if (listManu[i] == manuBus.getManuName(eq.ManufacturerID))
                {
                    cbManufacturer.SelectedIndex = i + 1;
                }
            }
            dateCommission.DateTime    = eq.CommissionDate;
            txtPDFNo.Text              = eq.PFDNo;
            txtProcessDescription.Text = eq.ProcessDescription;
            txtDescription.Text        = eq.EquipmentDesc;
        }
コード例 #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
        }