public static void DeleteProduct(Product[] product, int id) { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Products); for (int i = 0; i < product.Length; i++) { if (id == Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Id"))) { SysRegedit.DeleteSubKey(MyShopConfigration.Products, temp[i]); break; } } }
public static void DeleteCustomer(Customer[] customer, int id) { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors); for (int i = 0; i < customer.Length; i++) { if (id == Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Id"))) { SysRegedit.DeleteSubKey(MyShopConfigration.Custmors, temp[i]); //return true; break; } } }
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 static Customer[] ViewCustmoers(string root) { try { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors); Customer[] custmoer = new Customer[temp.Length]; for (int i = 0; i < temp.Length; i++) { custmoer[i] = new Customer(); custmoer[i].Id = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Id")); custmoer[i].Name = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Name"); custmoer[i].Address = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Address"); custmoer[i].PIN = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "PIN")); custmoer[i].Mobile = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Mobile"); custmoer[i].Email = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Email"); } return(custmoer); } catch (Exception) { return(null); } }
public static string IDGeneration(string subRoot) { string[] subKeynames = SysRegedit.GetSubKeyNames(subRoot); try { if (subKeynames.Length == 0 || subKeynames == null) { return("0"); } } catch (Exception) { return("0"); } string a = string.Empty; for (int i = 0; i < subKeynames.Length; i++) { a = subKeynames[i].Substring(0, subKeynames[i].IndexOf('.')); } return(a); }
public static Product[] ViewProducts(string root) { try { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Products); Product[] product = new Product[temp.Length]; for (int i = 0; i < temp.Length; i++) { product[i] = new Product(); product[i].Id = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Id")); product[i].Name = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Name"); product[i].Price = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Price")); product[i].ExpDate = Convert.ToString(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "ExpDate")); product[i].ManDate = Convert.ToString(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "ManDate")); product[i].CompanyName = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "CompanyName"); product[i].Quntity = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Quntity")); product[i].Features = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Features"); } return(product); } catch (Exception) { return(null); } }