void DisplayProducts() { dgvProducts.Rows.Clear(); foreach (var item in HelperProduct.GetProductModelList()) { dgvProducts.Rows.Add(item.proName, item.Cate.cateName, item.prePrice, item.salePrice, item.quantity, item.Cate.explanation); } }
private void FormDisplayProducts_Load(object sender, EventArgs e) { var list = HelperProduct.GetProductModelList(); foreach (var item in list) { dgvProducts.Rows.Add(item.productID, item.proName, item.SubCate.subCateName, item.Cate.cateName, item.proPrice, item.quantity); } }
public void Yenile() { dataGridView1.Rows.Clear(); List <ProductModel> productmodel = HelperProduct.GetProductModelList(); foreach (var item in productmodel) { if (item.IsActive == true) { dataGridView1.Rows.Add(item.productID, item.productName, item.Supplier.companyName, item.category.categoryName, item.unitPrice, item.dateOfAdded, item.stock, item.stringDiscounted); } } }
private void BtListCategories_Click(object sender, EventArgs e) { dgvSellPro.Visible = true; lblSelectPro.Visible = true; dgvSellPro.Rows.Clear(); foreach (var item in HelperProduct.GetProductModelList()) { if (item.Cate.cateName == cbCategoryList.GetItemText(cbCategoryList.SelectedItem)) { dgvSellPro.Rows.Add(item.proName, item.salePrice, item.Cate.explanation); } } }
private void BtAddPro_Click(object sender, EventArgs e) { bool result = Helper.I(tbProName.Text) || Helper.I(tbPrePrice.Text) || Helper.I(tbSalePrice.Text) || Helper.I(tbStock.Text); if (result) { MessageBox.Show("Tüm alanları doldurunuz!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { List <string> list = new List <string>(); foreach (var item in HelperProduct.GetProductModelList()) { list.Add(item.proName); } if (list.Contains(tbProName.Text)) { MessageBox.Show("Bu ürün sistemde kayıtlıdır!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Products pro = new Products { proName = tbProName.Text, prePrice = Convert.ToDouble(tbPrePrice.Text), salePrice = Convert.ToDouble(tbSalePrice.Text), quantity = Convert.ToInt32(tbStock.Text), addDate = DateTime.Now.Date, cateID = Convert.ToInt32(cbCategory.SelectedValue) }; r = Helper.CRUD(null, null, pro, null, null, EntityState.Added, "product"); if (r.isSuccess) { tbProName.Clear(); cbCategory.SelectedIndex = 0; tbPrePrice.Clear(); tbSalePrice.Clear(); tbStock.Clear(); DisplayProducts(); } } } }