private void BindDataList() { DataList.Rows.Clear(); Product[] product = Product.ViewProducts(MyShopConfigration.Products); if (product != null) { if (product.Length == 1) { DataList.Rows.Add(); } else { DataList.Rows.Add(product.Length - 1); } for (int i = 0; i < product.Length; i++) { DataList.Rows[i].Cells[0].Value = product[i].Id; DataList.Rows[i].Cells[1].Value = product[i].CompanyName; DataList.Rows[i].Cells[2].Value = product[i].Name; DataList.Rows[i].Cells[3].Value = product[i].Quntity; DataList.Rows[i].Cells[4].Value = product[i].Price; DataList.Rows[i].Cells[5].Value = product[i].ManDate; DataList.Rows[i].Cells[6].Value = product[i].ExpDate; DataList.Rows[i].Cells[7].Value = product[i].Features; } } }
public void Reset() { string[] tempCustmors = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors); Customer[] custmoers = Customer.ViewCustmoers(MyShopConfigration.Custmors); string[] tempBills = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill); string[] tempProducts = SysRegedit.GetSubKeyNames(MyShopConfigration.Products); Product[] products = Product.ViewProducts(MyShopConfigration.Products); try { for (int i = 0; i < custmoers.Length; i++) { SysRegedit.DeleteSubKey(MyShopConfigration.Custmors, tempCustmors[i]); } } catch (Exception) { } try { for (int i = 0; i < products.Length; i++) { SysRegedit.DeleteSubKey(MyShopConfigration.Products, tempProducts[i]); } } catch (Exception) { } string[] billId = Bill.LoadId(); Bill[] bill = new Bill[Bill.TotalBillCount()]; string[] subKeyNames = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill); for (int i = 0; i < bill.Length; i++) { bill[i] = Bill.ViewBill(billId[i].Remove(billId[i].IndexOf('.'))); for (int j = 0; j < bill[i].Products.Count; j++) { SysRegedit.DeleteSubKey(MyShopConfigration.Bill + "\\" + subKeyNames[i], bill[i].Products[j].Name); } SysRegedit.DeleteSubKey(MyShopConfigration.Bill, subKeyNames[i]); } SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Settings"); SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Login"); SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Customers"); SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Products"); SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Bill"); }
public void BindProduct() { product = Product.ViewProducts(MyShopConfigration.Products); try { for (int i = 0; i < product.Length; i++) { if (product[i].Quntity >= 1) { comProduct.Items.Add(product[i].Name); } } } catch (Exception) { } }
private void btnDelete_Click(object sender, EventArgs e) { Product.DeleteProduct(Product.ViewProducts(MyShopConfigration.Products), Convert.ToInt32(txtProductsId.Text)); BindDataList(); }