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;
         }
     }
 }
Exemplo n.º 2
0
 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;
         }
     }
 }
Exemplo n.º 3
0
        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");
        }