private void PopulateComboBoxes()
        {
            Employee           emp    = new Employee();
            EmployeeCollection empCol = new EmployeeCollection();
            SalesPerson        sp     = new SalesPerson();

            // DataSet ds = null;
            try
            {
                //Employee combo box.
                //ds = emp.GetAllEmployeesDataSet();
                empCol         = emp.GetAllEmployeesCollection();
                emp.EmployeeID = 0;
                emp.FullName   = "<Select One>";
                emp.FirstName  = "";
                emp.LastName   = "";
                empCol.Insert(0, emp);
                cmbEmployeeName.DataSource    = empCol;
                cmbEmployeeName.DisplayMember = "FullName";
                cmbEmployeeName.ValueMember   = "EmployeeID";

                //DataTable dt = ds.Tables[0];
                //DataRow dr = dt.NewRow();
                //dr["EmployeeID"] = "0";
                //dr["FullName"] = "<Select One>";
                //dt.Rows.InsertAt(dr, 0);
                //cmbEmployeeName.DataSource = dt;
                //cmbEmployeeName.DisplayMember = "FullName";
                //cmbEmployeeName.ValueMember = "EmployeeID";

                //sale person comb box
                DataSet   dsSalePerson = sp.GetAllSalesPersonViewDataSet();
                DataTable dtSalePerson = dsSalePerson.Tables[0];
                DataRow   drSalePerson = dtSalePerson.NewRow();
                drSalePerson["SalesPersonID"] = "0";
                drSalePerson["FullName"]      = "<Select One>";
                dtSalePerson.Rows.InsertAt(drSalePerson, 0);
                cmbSalesPerson.DataSource    = dtSalePerson;
                cmbSalesPerson.DisplayMember = "FullName";
                cmbSalesPerson.ValueMember   = "SalesPersonID";
                foreach (DataRow drow in dtSalePerson.Rows)
                {
                    string item = drow["SalesPersonID"].ToString();
                    string name = drow["FullName"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MICS", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
            }
            finally
            {
                //ds = null;
            }
        }
        private void PopulateGrids()
        {
            SalesPerson           sp   = new SalesPerson();
            SalesTerritoryHistory hist = new SalesTerritoryHistory();
            DataSet ds = null;

            try
            {
                //sale person grid
                ds = sp.GetAllSalesPersonViewDataSet();
                DataTable dt = ds.Tables[0];
                dt.Columns.Remove("FirstName");
                dt.Columns.Remove("LastName");
                dt.Columns.Remove("MiddleName");
                dt.Columns[0].ColumnName = "ID";
                dt.Columns[1].ColumnName = "Name";
                dt.Columns[2].ColumnName = "Quota";
                dt.Columns[3].ColumnName = "Bonus";
                dt.Columns[4].ColumnName = "Commission";
                dgSalesPerson.DataSource = dt;

                //sale territory grid
                ds = hist.GetSalesTerritoryBySalesPerson();
                dtTerritoryList                                  = ds.Tables[0];
                dgTerritoryList.DataSource                       = dtTerritoryList;
                dgTerritoryList.Columns["ID"].Visible            = false;
                dgTerritoryList.Columns["territoryid"].Visible   = false;
                dgTerritoryList.Columns["SalesPersonID"].Visible = false;
                //ds = hist.GetSalesTerritoryHistoryViewDataSet();
                //dt = ds.Tables[0];
                //int i = 0;
                //TerritoryHistId = new int[dT.Rows.Count];
                //foreach (DataRow dr in dt.Rows
                //{
                //    TerritoryHistId[i+] = Int32.Parse(dr["ID"].ToString());
                //}
                //dt.Columns.Remove("SalesPersonID");
                //dt.Columns.Remove("ID");
                //dt.Columns[0].ColumnName = "ID";
                //dt.Columns[1].ColumnName = "Territory";
                //dt.Columns[2].ColumnName = "Sale Person";
                //dt.Columns[3].ColumnName = "Start Date";
                //dt.Columns[4].ColumnName = "End Date";
                //dgTerritoryList.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MICS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
            }
        }