public static Bill ViewBill(string id) { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill); string billName; Bill bill = new Bill(); for (int i = 0; i < temp.Length; i++) { if (id == SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Id")) { bill.Id = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Id")); bill.BillDateTime = SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "BillDateTime"); bill.Name = SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Name"); bill.Address = SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Address"); bill.PIN = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "PIN")); bill.Email = SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Email"); bill.Mobile = SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "Mobile"); bill.TotalItems = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "TotalItems")); bill.TotalPrice = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Bill, temp[i], "TotalPrice")); string [] productNames = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill + "\\" + temp[i]); for (int j = 0; j < productNames.Length; j++) { Product tempProduct = new Product(); tempProduct.Name = SysRegedit.ReadReg(MyShopConfigration.Bill + "\\" + temp[i], productNames[j], "Name"); tempProduct.CompanyName = SysRegedit.ReadReg(MyShopConfigration.Bill + "\\" + temp[i], productNames[j], "CompanyName"); tempProduct.Price = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Bill + "\\" + temp[i], productNames[j], "Price")); tempProduct.Quntity = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Bill + "\\" + temp[i], productNames[j], "Quntity")); bill.Products.Add(tempProduct); } } } return(bill); }
private bool AddNewBill(int id, Bill newBill, List <Product> products) { SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "BillDateTime", DateTime.Now.ToString()); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Id", id.ToString()); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Name", Name); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Address", Address); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "PIN", PIN.ToString()); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Mobile", Mobile); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Email", Email); string[] ProductNameAndId = SysRegedit.GetSubKeyNames(MyShopConfigration.Products); for (int i = 0; i < products.Count; i++) { SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Name", products[i].Name); SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "CompanyName", products[i].CompanyName); SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Quntity", products[i].Quntity.ToString()); SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Price", products[i].Price.ToString()); for (int j = 0; j < ProductNameAndId.Length; j++) { if (ProductNameAndId[j].Remove(0, ProductNameAndId[j].IndexOf('.') + 1) == products[i].Name) { int a = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, ProductNameAndId[j], "Quntity")) - Convert.ToInt32(products[i].Quntity); SysRegedit.SaveReg(MyShopConfigration.Products + "\\" + ProductNameAndId[j], "Quntity", a.ToString()); } } } SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "TotalItems", TotalItems.ToString()); SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "TotalPrice", TotalPrice.ToString()); return(true); }
public static Order[] ReadOrder(string root) { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Order); Order[] order = new Order[temp.Length]; for (int i = 0; i < temp.Length; i++) { order[i] = new Order(); order[i].Id = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Order, temp[i], "Id")); order[i].BillNo = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Order, temp[i], "BillNo")); order[i].BillDate = SysRegedit.ReadReg(MyShopConfigration.Order, temp[i], "BillDate"); order[i].CustomerId = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Order, temp[i], "CustomerId")); order[i].Total = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Order, temp[i], "Total")); } return(order); }
public static OrderDetails[] ReadOrderDetails(string root) { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.OrderDetails); OrderDetails[] orderDetails = new OrderDetails[temp.Length]; for (int i = 0; i < temp.Length; i++) { orderDetails[i] = new OrderDetails(); orderDetails[i].Id = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.OrderDetails, temp[i], "Id")); orderDetails[i].OrderId = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.OrderDetails, temp[i], "OrderId")); orderDetails[i].ProductId = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.OrderDetails, temp[i], "ProductId")); orderDetails[i].Quntity = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.OrderDetails, temp[i], "Quntity")); orderDetails[i].Amount = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Amount")); } return(orderDetails); }
private static Customer[] ViewCustmoers(string root) { 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); }
public static string[] LoadId() { string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill); return(temp); }