Пример #1
0
        public static string fillBankBranchGridViewComboNew(DataGridViewComboBoxCell cmb, string bank)
        {
            string firstValue = "";

            ////cmb.Items.Clear();
            try
            {
                cmb.Items.Clear();
                BankBranchDB      bankbranchdb = new BankBranchDB();
                List <bankbranch> BankBranches = bankbranchdb.getBankBranches();
                List <Structures.GridViewComboBoxItem> ItemList =
                    new List <Structures.GridViewComboBoxItem>();
                foreach (bankbranch branch in BankBranches)
                {
                    if (branch.BankID.Equals(bank) && branch.status == 1)
                    {
                        Structures.GridViewComboBoxItem ch =
                            new Structures.GridViewComboBoxItem(branch.BranchName, branch.BranchID.ToString());
                        cmb.Items.Add(ch);
                        //cmb.Items.Add(branch.BankID + "-" + branch.BranchName);
                        if (firstValue.Length == 0)
                        {
                            firstValue = branch.BranchID.ToString();// + "-" + branch.BranchName;
                        }
                    }
                }
                cmb.DisplayMember = "Name";  // Name Property will show(Editing)
                cmb.ValueMember   = "Value"; // Value Property will save(Saving)
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(firstValue);
        }
Пример #2
0
        public static string fillBankBranchCombo(DataGridViewComboBoxCell cmb, string bank)
        {
            string firstValue = "";

            ////cmb.Items.Clear();
            try
            {
                BankBranchDB      bankbranchdb = new BankBranchDB();
                List <bankbranch> BankBranches = bankbranchdb.getBankBranches();
                foreach (bankbranch branch in BankBranches)
                {
                    if (branch.BankID.Equals(bank) && branch.status == 1)
                    {
                        cmb.Items.Add(branch.BranchID + "-" + branch.BranchName);
                        if (firstValue.Length == 0)
                        {
                            firstValue = branch.BranchID + "-" + branch.BranchName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(firstValue);
        }