public static void fillStatusCatalogueCombo(System.Windows.Forms.ComboBox cmb, string DocID) { cmb.Items.Clear(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select ID, Description from StatusCatalogue where DocumentID='" + DocID + "'" + " and Status = 1 order by ID,Description asc"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = reader.GetInt32(0); string desc = reader.GetString(1); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(desc, id.ToString()); cmb.Items.Add(cbitem); } conn.Close(); } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillCustomerForProjectComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { List <customerforproject> cfps = getCustomerForProject(); foreach (customerforproject cfp in cfps) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(cfp.name, cfp.code); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
//27-02-2018 public static void fillMenuGroupCombo(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { List <menuitem> DocItems = getMenuItemsHeader(); foreach (menuitem doc in DocItems) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(doc.menugrp, doc.menugrp); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show("fillMenuItemComboNew() : Error"); } }
public static void fillCustomerComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { CustomerDB dbrecord = new CustomerDB(); List <customer> Customers = dbrecord.getCustomers("", 6); foreach (customer cust in Customers) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(cust.name, cust.CustomerID); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillLeaveComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { List <Leave> leaves = fillleavecombo(); foreach (Leave le in leaves) { ////cmb.Items.Add(off.OfficeID + "-" + off.name); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(le.description, le.leaveID); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillMenuItemComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { DocumentDB dbrecord = new DocumentDB(); List <document> DocItems = dbrecord.getDocuments(); foreach (document doc in DocItems) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(doc.DocumentName, doc.DocumentID); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show("fillMenuItemComboNew() : Error"); } }
public static void fillCustomerGroupValueCombo(System.Windows.Forms.ComboBox cmb, int level) { cmb.Items.Clear(); try { CustomerGroupDB sgdb = new CustomerGroupDB(); List <customergroup> ValueList = sgdb.getCustomerGroupDetails(level); foreach (customergroup sg in ValueList) { //cmb.Items.Add(sg.GroupCode + "-" + sg.GroupDescription); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(sg.GroupDescription, sg.GroupCode); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillCurrencyComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { CurrencyDB dbrecord = new CurrencyDB(); List <currency> Currencies = dbrecord.getCurrencies(); foreach (currency curr in Currencies) { ////////cmb.Items.Add(curr.CurrencyID + "-" + curr.name); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(curr.name, curr.CurrencyID); cmb.Items.Add(cbitem); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
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"); } }
public static void fillAccountCodeComboNew(ComboBox cmb, string type) { cmb.Items.Clear(); try { AccountDayBookCodeDB acDB = new AccountDayBookCodeDB(); accountdaybook adb = new accountdaybook(); List <accountdaybook> ACDEtail = acDB.getAccountDayBookDetailWRTBookType(type); foreach (accountdaybook accode in ACDEtail) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(accode.Name, accode.AccountCode); cmb.Items.Add(cbitem); /////cmb.Items.Add(accode.AccountCode + "-" + accode.Name); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static int getComboIndex(System.Windows.Forms.ComboBox cmb, string val) { int intex = 0; try { foreach (var item in cmb.Items) { Structures.ComboBoxItem cbitem = (Structures.ComboBoxItem)item; if (cbitem.HiddenValue == val) { return(intex); } intex++; } } catch (Exception ex) { } return(-1); }
public static void fillRegionComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { RegionDB dbrecord = new RegionDB(); List <region> Regions = dbrecord.getRegions(); foreach (region reg in Regions) { if (reg.status == 1) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(reg.name, reg.regionID); cmb.Items.Add(cbitem); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillCatalogValueComboNew(System.Windows.Forms.ComboBox cmb, string catalogvalue) { cmb.Items.Clear(); try { CatalogueValueDB dbrecord = new CatalogueValueDB(); List <cataloguevalue> CatalogueValues = dbrecord.getCatalogueValues(); foreach (cataloguevalue catval in CatalogueValues) { if (catval.catalogueID.Equals(catalogvalue) && catval.status == 1) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(catval.description, catval.catalogueValueID); cmb.Items.Add(cbitem); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillStateComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { StateDB sdb = new StateDB(); List <state> stList = sdb.getStateList(); foreach (state stat in stList) { if (stat.Status == 1) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(stat.StateName, stat.StateCode); cmb.Items.Add(cbitem); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillCompanyIDComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { CompanyDetailDB dbrecord = new CompanyDetailDB(); List <cmpnydetails> details = dbrecord.getdetails(); foreach (cmpnydetails det in details) { if (det.status == 1) { //cmb.Items.Add(det.companyID + "-" + det.companyname); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(det.companyname, det.companyID.ToString()); cmb.Items.Add(cbitem); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillOfficeComboNew(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { OfficeDB officedb = new OfficeDB(); List <office> Offices = officedb.getOffices(); foreach (office off in Offices) { if (off.status == 1) { ////cmb.Items.Add(off.OfficeID + "-" + off.name); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(off.name, off.OfficeID); cmb.Items.Add(cbitem); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillLocationComboNew(ComboBox cmb) { StoreEmpMappingDB smpdb = new StoreEmpMappingDB(); List <storeempmapping> LocList = smpdb.getStockEmpMapping(); foreach (storeempmapping smp in LocList) { Boolean status = true; foreach (Structures.ComboBoxItem itm in cmb.Items) { if ((itm.HiddenValue + "-" + itm.ToString()).Equals(smp.StoreLocationID + "-" + smp.Description)) { status = false; } } if (status) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(smp.Description, smp.StoreLocationID); cmb.Items.Add(cbitem); //cmb.Items.Add(smp.StoreLocationID + "-" + smp.Description); } } }
public static void fillCatalogValueComboNew2(System.Windows.Forms.ComboBox cmb, System.Windows.Forms.ComboBox cmb2, System.Windows.Forms.ComboBox cmb3, System.Windows.Forms.Label Label) { cmb.Items.Clear(); cmb2.Items.Clear(); cmb3.Items.Clear(); try { CatalogueValueDB dbrecord = new CatalogueValueDB(); List <cataloguevalue> CatalogueValues = dbrecord.getCatalogueValues().Where(W => W.catalogueID == "POType").ToList(); List <documentreceiver> ListL2 = new List <documentreceiver>(); List <documentreceiver> ListL3 = new List <documentreceiver>(); List <documentreceiver> ListL = Main.DocumentReceivers.Where(W => W.Status == 1).ToList(); OfficeDB obj2 = new OfficeDB(); DocumentDB obj3 = new DocumentDB(); var Ofices = obj2.getOffices().Where(W => W.status == 1).ToList(); string DocName = ""; foreach (var itm in ListL) { documentreceiver obj = new documentreceiver(); DocName = itm.DocumentID; DocName = DocName.Replace("POSERVICEINWARD", "Service PO"); DocName = DocName.Replace("PAFSERVICEINWARD", "ServicePAF"); DocName = DocName.Replace("POPRODUCTINWARD", "Product PO"); DocName = DocName.Replace("PAFPRODUCTINWARD", "ProductPAF"); obj.DocumentName = DocName; obj.OfficeID = itm.OfficeID; obj.OfficeName = itm.OfficeName; obj.DocumentID = itm.DocumentID; ListL2.Add(obj); } string[] Str = new string[4]; ////int i = 0; foreach (var itm in CatalogueValues) { documentreceiver obj = new documentreceiver(); DocName = itm.description; DocName = DocName.Replace("Service PO", "POSERVICEINWARD"); DocName = DocName.Replace("ServicePAF", "PAFSERVICEINWARD"); DocName = DocName.Replace("Product PO", "POPRODUCTINWARD"); DocName = DocName.Replace("ProductPAF", "PAFPRODUCTINWARD"); obj.DocumentID = DocName; obj.DocumentName = itm.description; ListL3.Add(obj); } var abcsd = from Ca in CatalogueValues join Ll in ListL2 on Ca.description equals Ll.DocumentName select new { DocumentName = Ca.description, DocumentID = Ll.DocumentID, Ofice = Ll.OfficeID, OficeName = Ll.OfficeName }; var Off = from Ca in Ofices join Ll in abcsd on Ca.OfficeID equals Ll.Ofice select Ca; // cmb.Items.AddRange(ListL.ToArray()); foreach (var itm in abcsd.GroupBy(x => x.DocumentName).Select(y => y.FirstOrDefault()).ToList()) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(itm.DocumentName, itm.DocumentID); cmb.Items.Add(cbitem); } var Abcd2 = abcsd.GroupBy(x => x.Ofice).Select(y => y.FirstOrDefault()).ToList(); foreach (var itm in Abcd2) { Structures.ComboBoxItem cbitem2 = new Structures.ComboBoxItem(itm.OficeName, itm.Ofice); cmb2.Items.Add(cbitem2); } foreach (var itm in Ofices.GroupBy(G => G.RegionID)) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(itm.Key, itm.Select(s => s.RegionName).FirstOrDefault()); cmb3.Items.Add(cbitem); } if (ListL.Count <= 0) { Label.Text = "1"; var Documents = obj3.getDocuments().Where(W => W.DocumentStatus == 1).ToList(); var results = from x in Documents join Ll in ListL3 on x.DocumentID equals Ll.DocumentID select new { DocumntId = x.DocumentID, documntname = Ll.DocumentName }; foreach (var itm in results) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(itm.documntname, itm.DocumntId); cmb.Items.Add(cbitem); } foreach (var itm in Ofices) { Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem(itm.name, itm.OfficeID); cmb2.Items.Add(cbitem); } // offli = Ofices.ToList(); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }