private void InitialloadGrid() { try { List <GetProductStock> GridList = new List <GetProductStock>(); BusinessObjects.GetProductStock spObj = new GetProductStock(); GridList = spObj.getProdAlongWithStockQuantity_All(con); List <M_Product_BS> cObjList = new List <M_Product_BS>(); BusinessObjects.M_Product_BS cObj = new M_Product_BS(); cObjList = cObj.GetProducts(con); //MessageBox.Show(cObjList.Count.ToString()); //this is to set the category name List <Category_BS> catList = new List <Category_BS>(); Category_BS catObj = new Category_BS(); catList = catObj.GetCategory(con); foreach (Category_BS itemCat in catList) { foreach (GetProductStock itemProd in GridList) { if (itemProd.category == itemCat.ID) { itemProd.catObj = itemCat; } } } int i = 0; tblProduct.Rows.Clear(); foreach (GetProductStock item in GridList) { if (item.TotalQuantity > 3) { continue; } tblProduct.Rows.Add(); tblProduct.Rows[i].Cells[0].Value = item.ID; tblProduct.Rows[i].Cells[1].Value = item.name; tblProduct.Rows[i].Cells[2].Value = item.catObj.name; tblProduct.Rows[i].Cells[3].Value = item.cost; tblProduct.Rows[i].Cells[4].Value = item.unitPrice; tblProduct.Rows[i].Cells[5].Value = item.warranty; tblProduct.Rows[i].Cells[6].Value = item.TotalQuantity; i++; } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void autoComplete() { try { txtInvoiceSearch.AutoCompleteMode = AutoCompleteMode.Suggest; txtInvoiceSearch.AutoCompleteSource = AutoCompleteSource.CustomSource; txtSNameSearch.AutoCompleteMode = AutoCompleteMode.Suggest; txtSNameSearch.AutoCompleteSource = AutoCompleteSource.CustomSource; txtPNameSearch.AutoCompleteMode = AutoCompleteMode.Suggest; txtPNameSearch.AutoCompleteSource = AutoCompleteSource.CustomSource; txtSupName.AutoCompleteMode = AutoCompleteMode.Suggest; txtSupName.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection stringColl = new AutoCompleteStringCollection(); AutoCompleteStringCollection stringColl2 = new AutoCompleteStringCollection(); AutoCompleteStringCollection stringColl3 = new AutoCompleteStringCollection(); M_Product_BS product = new M_Product_BS(); ProductList = product.GetProducts(con); foreach (BusinessObjects.M_Product_BS item in ProductList) { stringColl.Add(item.name); } //retreive stock data Stock sc = new Stock(); StockList = sc.GetStockList(con); foreach (BusinessObjects.Stock item in StockList) { stringColl2.Add(item.sup_name); stringColl3.Add(item.invoice_no.ToString()); } txtPNameSearch.AutoCompleteCustomSource = stringColl; txtSNameSearch.AutoCompleteCustomSource = stringColl2; txtInvoiceSearch.AutoCompleteCustomSource = stringColl3; txtSupName.AutoCompleteCustomSource = stringColl2; BusinessObjects.Category_BS catObj = new BusinessObjects.Category_BS(); CategoryList = catObj.GetCategory(con); cmbECategory.DataSource = null; cmbECategory.DataSource = CategoryList; cmbECategory.DisplayMember = "name"; cmbECategory.ValueMember = "ID"; } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void loadGrid(List <GetProductStock> List_) { try { GridList = List_; BusinessObjects.M_Product_BS cObj = new M_Product_BS(); cObjList = cObj.GetProducts(con); //this is to set the category name foreach (Category_BS itemCat in catList) { foreach (GetProductStock itemProd in GridList) { if (itemProd.category == itemCat.ID) { itemProd.catObj = itemCat; } } } int i = 0; tblProduct.Rows.Clear(); foreach (GetProductStock item in GridList) { tblProduct.Rows.Add(); tblProduct.Rows[i].Cells[0].Value = item.ID; tblProduct.Rows[i].Cells[1].Value = item.name; tblProduct.Rows[i].Cells[2].Value = item.catObj.name; tblProduct.Rows[i].Cells[3].Value = item.cost; tblProduct.Rows[i].Cells[4].Value = item.unitPrice; tblProduct.Rows[i].Cells[5].Value = item.warranty; tblProduct.Rows[i].Cells[6].Value = item.TotalQuantity; tblProduct.Rows[i].Cells[7].Value = item.date_; i++; } // autoComplete(); } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void InitialloadGrid() { try { BusinessObjects.GetProductStock spObj = new GetProductStock(); BusinessObjects.M_Product_BS cObj = new M_Product_BS(); cObjList = cObj.GetProducts(con); Category_BS catObj = new Category_BS(); catList = catObj.GetCategory(con); } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void loadGrid() { try { BusinessObjects.M_Product_BS cObj = new M_Product_BS(); cObjList = cObj.GetProducts(con); //MessageBox.Show(cObjList.Count.ToString()); Category_BS catObj = new Category_BS(); catList = catObj.GetCategory(con); foreach (Category_BS itemCat in catList) { foreach (M_Product_BS itemProd in cObjList) { if (itemProd.category == itemCat.ID) { itemProd.catObj = itemCat; } } } int i = 0; tblProduct.Rows.Clear(); //MessageBox.Show(cObjList.Count.ToString()); foreach (M_Product_BS item in cObjList) { tblProduct.Rows.Add(); tblProduct.Rows[i].Cells[0].Value = item.ID; tblProduct.Rows[i].Cells[1].Value = item.name; tblProduct.Rows[i].Cells[2].Value = item.catObj.name; tblProduct.Rows[i].Cells[3].Value = item.cost; tblProduct.Rows[i].Cells[4].Value = item.unitPrice; tblProduct.Rows[i].Cells[5].Value = item.warranty; tblProduct.Rows[i].Cells[6].Value = "Edit"; i++; } autoComplete(); } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void autoComplete() { try { txtReceiptNo.AutoCompleteMode = AutoCompleteMode.Suggest; txtReceiptNo.AutoCompleteSource = AutoCompleteSource.CustomSource; txtProductName.AutoCompleteMode = AutoCompleteMode.Suggest; txtProductName.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection stringColl = new AutoCompleteStringCollection(); AutoCompleteStringCollection stringColl2 = new AutoCompleteStringCollection(); BusinessObjects.M_Product_BS p = new M_Product_BS(); BusinessObjects.Sales_BM s = new Sales_BM(); List <M_Product_BS> PList = new List <M_Product_BS>(); List <Sales_BM> SList = new List <Sales_BM>(); PList = p.GetProducts(con); SList = s.getSales(con); SalesList_Public = SList; foreach (M_Product_BS item in PList) { // stringColl.Add(item.ID.ToString()); stringColl.Add(item.name); } foreach (Sales_BM item in SList) { stringColl2.Add(item.sales_id.ToString()); } txtProductName.AutoCompleteCustomSource = stringColl; txtReceiptNo.AutoCompleteCustomSource = stringColl2; } catch (Exception ex) { MetroMessageBox.Show(this, "! System Error . Code 104. " + ex.Message, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void autoComplete() { try { txtPID.AutoCompleteMode = AutoCompleteMode.Suggest; txtPID.AutoCompleteSource = AutoCompleteSource.CustomSource; txtPName.AutoCompleteMode = AutoCompleteMode.Suggest; txtPName.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection stringColl = new AutoCompleteStringCollection(); AutoCompleteStringCollection stringColl2 = new AutoCompleteStringCollection(); BusinessObjects.M_Product_BS cObj = new M_Product_BS(); cObjList = cObj.GetProducts(con); Category_BS catObj = new Category_BS(); catList = catObj.GetCategory(con); foreach (M_Product_BS item in cObjList) { stringColl.Add(item.ID.ToString()); stringColl2.Add(item.name); } txtPID.AutoCompleteCustomSource = stringColl; txtPName.AutoCompleteCustomSource = stringColl2; cmbPCat.DataSource = null; cmbPCat.DataSource = catList; cmbPCat.DisplayMember = "name"; cmbPCat.ValueMember = "ID"; } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }