void loadSoldTable() { DateTime sDate = Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")); DateTime eDate = Convert.ToDateTime(DateTime.Now.AddDays(+1).ToString("MM/dd/yyyy")); //eDate.ToString("dd-MMM-yyyy") //DateTime sDate = DateTime.ParseExact(sDates, "MM/dd/yyyy", CultureInfo.InvariantCulture); // DateTime eDate = DateTime.ParseExact(eDates, "MM/dd/yyyy", CultureInfo.InvariantCulture); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithSalesQuantity_ByDate(con, sDate, eDate); int i = 0; gridSOldItem.Rows.Clear(); foreach (GetProductStock item in ListItem) { gridSOldItem.Rows.Add(); gridSOldItem.Rows[i].Cells[1].Value = item.name; gridSOldItem.Rows[i].Cells[0].Value = item.ID; gridSOldItem.Rows[i].Cells[2].Value = item.cost; gridSOldItem.Rows[i].Cells[3].Value = item.unitPrice; gridSOldItem.Rows[i].Cells[4].Value = item.TotalQuantity; i++; } }
void setOutofStockandLowStock() { try { int LowStockcount = 0; int outOfStockcount = 0; BusinessObjects.stock_product stoProduct = new stock_product(); outOfStockcount = stoProduct.GetOutOfStock(con); BusinessObjects.GetProductStock spObj = new GetProductStock(); List <GetProductStock> avalibilityList = new List <GetProductStock>(); avalibilityList = spObj.getProdAlongWithStockQuantity_All(con); foreach (var item in avalibilityList) { if (item.TotalQuantity < 5) { LowStockcount++; } } lblOutOfStock.Text = outOfStockcount.ToString() + " Prods"; lblLowStock.Text = LowStockcount.ToString() + " Prods"; } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbAutoSuggest_SelectedIndexChanged(object sender, EventArgs e) { return; //MessageBox.Show("Comes selected index change"); try { if (!checkAutoSuggestCMBClick) { checkAutoSuggestCMBClick = false; return; } checkAutoSuggestCMBClick = false; if (cmbAutoSuggest.Text.Length > 0) { string pname = cmbAutoSuggest.SelectedItem.ToString(); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithStockQuantity_ByProdName(con, pname); loadGrid(ListItem); } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtPID_TextChanged(object sender, EventArgs e) { try { DateTime sDate = Convert.ToDateTime(dateStart.Text); DateTime eDate = Convert.ToDateTime(dateEnd.Text); //DateTime sDate = DateTime.ParseExact(dateStart.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); //DateTime eDate = DateTime.ParseExact(dateEnd.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); if (txtPID.Text.Length > 0) { int pid = Convert.ToInt32(txtPID.Text); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithSalesQuantity_ByProdID(con, pid, sDate, eDate); loadGrid(ListItem); } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbPCat_SelectedIndexChanged(object sender, EventArgs e) { try{ if (checkSelectedIndexChange) { Category_BS cat = new Category_BS(); cat = (Category_BS)cmbPCat.SelectedItem; // MessageBox.Show(cat.ID.ToString()); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithStockQuantity_ByCatID(con, cat.ID); loadGrid(ListItem); checkSelectedIndexChange = false; } else { checkSelectedIndexChange = false; } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "System Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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 InitialloadGrid() { try { BusinessObjects.GetProductStock spObj = new GetProductStock(); GridList = spObj.getProdAlongWithSalesQuantity_ByAll(con); //MessageBox.Show(cObjList.Count.ToString()); //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 txtPName_TextChanged(object sender, EventArgs e) { try { if (txtPName.Text.Length > 0) { string pname = txtPName.Text; List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithStockQuantity_ByProdName(con, pname); loadGrid(ListItem); } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbPCat_SelectedIndexChanged(object sender, EventArgs e) { try { //DateTime sDate = DateTime.ParseExact(dateStart.ToString(), "yyyy/MM/dd", null); //DateTime eDate = DateTime.ParseExact(dateEnd.ToString(), "yyyy/MM/dd", null); if (checkSelectedIndexChange) { //DateTime sDate = Convert.ToDateTime(dateStart.Text); //DateTime eDate = Convert.ToDateTime(dateEnd.Text); DateTime sDate = DateTime.ParseExact(dateStart.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); DateTime eDate = DateTime.ParseExact(dateEnd.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); Category_BS cat = new Category_BS(); cat = (Category_BS)cmbPCat.SelectedItem; List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); //MessageBox.Show(cat.ID.ToString()); ListItem = lObj.getProdAlongWithSalesQuantity_ByCatID(con, cat.ID, sDate, eDate); checkSelectedIndexChange = false; loadGrid(ListItem); } else { checkSelectedIndexChange = false; } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSearch_Click(object sender, EventArgs e) { try { //DateTime sDate = Convert.ToDateTime(dateStart.Text); //DateTime eDate = Convert.ToDateTime(dateEnd.Text); DateTime sDate = DateTime.ParseExact(dateStart.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); DateTime eDate = DateTime.ParseExact(dateEnd.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithSalesQuantity_ByDate(con, sDate, eDate); loadGrid(ListItem); } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtPID_TextChanged(object sender, EventArgs e) { try { if (txtPID.Text.Length > 0) { int pid = Convert.ToInt32(txtPID.Text); List <GetProductStock> ListItem = new List <GetProductStock>(); GetProductStock lObj = new GetProductStock(); ListItem = lObj.getProdAlongWithStockQuantity_ByProdID(con, pid); loadGrid(ListItem); } } catch (Exception ex) { MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }