コード例 #1
0
        private void loadOfficeSalesCombo()
        {
            conDB = new ConnectionDB();
            SalesOfficeModel office = new SalesOfficeModel();

            string queryString = "SELECT ID, officename, description FROM dbfh.tblsalesoffice WHERE isDeleted = 0";

            MySqlDataReader reader = conDB.getSelectConnection(queryString, null);

            cmbSalesOffice.Items.Clear();
            while (reader.Read())
            {
                office.ID          = reader["ID"].ToString();
                office.OfficeName  = reader["officename"].ToString();
                office.Description = reader["description"].ToString();
                cmbSalesOffice.Items.Add(office);
                office = new SalesOfficeModel();
            }

            conDB.closeConnection();
        }
コード例 #2
0
        private void loadOfficeSalesCombo(DirectSalesModel dsm)
        {
            try
            {
                conDB = new ConnectionDB();
                SalesOfficeModel office = new SalesOfficeModel();

                string queryString = "SELECT ID, officename, description FROM dbfh.tblsalesoffice WHERE isDeleted = 0";

                MySqlDataReader reader = conDB.getSelectConnection(queryString, null);
                cmbSalesOffice.Items.Clear();
                while (reader.Read())
                {
                    office.ID          = reader["ID"].ToString();
                    office.OfficeName  = reader["officename"].ToString();
                    office.Description = reader["description"].ToString();

                    cmbSalesOffice.Items.Add(office);

                    office = new SalesOfficeModel();
                }

                foreach (SalesOfficeModel so in cmbSalesOffice.Items)
                {
                    if (dsm.OfficeSalesID.Equals(so.ID))
                    {
                        cmbSalesOffice.SelectedItem = so;
                    }
                }
                conDB.closeConnection();
            }
            catch (Exception ex)
            {
                conDB.writeLogFile("LOAD SALES OFFICE COMBO" + "-" + ex.StackTrace + " || " + ex.Message);
            }
        }