Ejemplo n.º 1
0
        private void FillBranchComboBox(string strStateCode)
        {
            objData = new StaffLevel();
            try
            {
                DataTable dt = objData.GetStateBranchesDS(CommonData.CompanyCode, strStateCode, CommonData.BranchCode).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    //DataRow dr = dt.NewRow();
                    //dr[0] = "--Select--";
                    //dr[1] = "--Select--";
                    //dt.Rows.InsertAt(dr, 0);

                    cbBranches.DataSource    = dt;
                    cbBranches.DisplayMember = "branch_name";
                    cbBranches.ValueMember   = "branch_code";
                }
                cbBranches.SelectedValue = CommonData.BranchCode;
                dt = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Group To Destination", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                objData = null;
            }
        }
        private void FillBranchComboBox(string strStateCode)
        {
            objData = new StaffLevel();
            try
            {
                strStateCode = cbStates.SelectedValue.ToString();
                DataTable dt = objData.GetStateBranchesDS(CommonData.CompanyCode, strStateCode, CommonData.BranchCode).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = "Select";
                    dr[1] = "Select";
                    dt.Rows.InsertAt(dr, 0);

                    cbBranches.DataSource    = dt;
                    cbBranches.DisplayMember = "branch_name";
                    cbBranches.ValueMember   = "branch_code";
                }
                cbBranches.SelectedValue = CommonData.BranchCode;
                dt = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objData = null;
            }
        }