Esempio n. 1
0
 public static void fillBranchCombo(System.Windows.Forms.ComboBox cmb, string bank)
 {
     cmb.Items.Clear();
     try
     {
         CompanyBankDB      dbrecord = new CompanyBankDB();
         List <companybank> details  = dbrecord.getBranch(bank);
         foreach (companybank det in details)
         {
             //cmb.Items.Add(det.companyID + "-" + det.companyname);
             Structures.ComboBoxItem cbitem =
                 new Structures.ComboBoxItem(det.BranchName, det.RowID.ToString());
             cmb.Items.Add(cbitem);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
Esempio n. 2
0
        public static ListView getBankListView(int CompID)
        {
            ListView lv = new ListView();

            try
            {
                lv.View               = View.Details;
                lv.LabelEdit          = true;
                lv.AllowColumnReorder = true;
                lv.CheckBoxes         = true;
                lv.FullRowSelect      = true;
                lv.GridLines          = true;
                lv.Sorting            = System.Windows.Forms.SortOrder.Ascending;
                CompanyBankDB      cadb   = new CompanyBankDB();
                List <companybank> caList = cadb.getCompBankListForIO(CompID);
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Row Id", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Bank Id", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Branch Name", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Account Type", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Account Code", -2, HorizontalAlignment.Left);
                //lv.Columns[1].Width = 0;
                foreach (companybank ca in caList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(ca.RowID.ToString());
                    item1.SubItems.Add(ca.BankID.ToString());
                    item1.SubItems.Add(ca.BranchName.ToString());
                    item1.SubItems.Add(ca.AccountType.ToString());
                    item1.SubItems.Add(ca.AccountCode.ToString());
                    lv.Items.Add(item1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(lv);
        }