Exemple #1
0
 //Grid View Combobox column
 public static void fillCatalogValueGridViewComboNew(System.Windows.Forms.DataGridViewComboBoxCell cmb, string catalogvalue)
 {
     try
     {
         cmb.Items.Clear();
         CatalogueValueDB      dbrecord                  = new CatalogueValueDB();
         List <cataloguevalue> CatalogueValues           = dbrecord.getCatalogueValues();
         List <Structures.GridViewComboBoxItem> ItemList =
             new List <Structures.GridViewComboBoxItem>();
         foreach (cataloguevalue catval in CatalogueValues)
         {
             if (catval.catalogueID.Equals(catalogvalue) && catval.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(catval.description, catval.catalogueValueID);
                 cmb.Items.Add(ch);
             }
         }
         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");
     }
 }
Exemple #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);
        }
Exemple #3
0
 public static void fillOfficeIDGridViewComboNew(DataGridViewComboBoxCell cmb)
 {
     cmb.Items.Clear();
     try
     {
         OfficeDB      officedb = new OfficeDB();
         List <office> Offices  = officedb.getOffices();
         foreach (office off in Offices)
         {
             if (off.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(off.name, off.OfficeID);
                 cmb.Items.Add(ch);
                 //cmb.Items.Add(off.OfficeID + "-" + off.name);
             }
         }
         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");
     }
 }
Exemple #4
0
 public static void fillStockItemGridViewComboNew(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         StockItemDB      stockitemdb = new StockItemDB();
         List <stockitem> StockItems  = stockitemdb.getStockItems();
         //foreach (stockitem si in StockItems)
         //{
         //    //if (CategoryName.Length > 0 && CategoryName != si.Category)
         //    //{
         //    //    continue;
         //    //}
         //    if (si.status == 1)
         //    {
         //        cmb.Items.Add(si.StockItemID + "-" + si.Name);
         //    }
         //}
         foreach (stockitem si in StockItems)
         {
             if (si.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(si.Name, si.StockItemID);
                 cmb.Items.Add(ch);
             }
         }
         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");
     }
 }
Exemple #5
0
 public static void fillTaxCodeGridViewCombo(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         TaxCodeDB      tcdb     = new TaxCodeDB();
         List <taxcode> TaxCodes = tcdb.getTaxCode();
         foreach (taxcode tc in TaxCodes)
         {
             if (tc.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(tc.Description, tc.TaxCode);
                 cmb.Items.Add(ch);
             }
         }
         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");
     }
 }