示例#1
0
        public static ListView getSLListView()
        {
            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;
                EmployeePostingDB      edb     = new EmployeePostingDB();
                List <employeeposting> EMPList = EmployeePostingDB.getEmployeePostingList();
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Id", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Name", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Type", -2, HorizontalAlignment.Left);
                ////lv.Columns.Add("Office Name", -2, HorizontalAlignment.Left);
                ////lv.Columns[3].Width = 0;
                ////lv.Columns[4].Width = 0;
                foreach (employeeposting emp in EMPList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(emp.empID.ToString());
                    item1.SubItems.Add(emp.empName.ToString());
                    item1.SubItems.Add("Employee");
                    ////item1.SubItems.Add(emp.officeName.ToString());
                    lv.Items.Add(item1);
                }
                CustomerDB      cdb      = new CustomerDB();
                List <customer> CustList = cdb.getCustomers("", 6);
                foreach (customer cust in CustList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(cust.CustomerID.ToString());
                    item1.SubItems.Add(cust.name.ToString());
                    item1.SubItems.Add("Party");
                    lv.Items.Add(item1);
                }
                BankBranchDB      bankDB   = new BankBranchDB();
                List <bankbranch> BankList = bankDB.getBankBranches();
                foreach (bankbranch bank in BankList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(bank.BranchID.ToString());
                    item1.SubItems.Add(bank.BranchName.ToString());
                    item1.SubItems.Add("Bank");
                    lv.Items.Add(item1);
                }
            }
            catch (Exception ex)
            {
            }
            return(lv);
        }
示例#2
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);
        }
示例#3
0
        public static ListView getBankDetailListView()
        {
            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;
                BankBranchDB      bankDB   = new BankBranchDB();
                List <bankbranch> BankList = bankDB.getBankBranches();
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Branch Id", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Branch Name", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Bank Id", -2, HorizontalAlignment.Left);
                foreach (bankbranch bank in BankList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(bank.BranchID.ToString());
                    item1.SubItems.Add(bank.BranchName.ToString());
                    item1.SubItems.Add(bank.BankID.ToString());
                    lv.Items.Add(item1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(lv);
        }
示例#4
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);
        }