Ejemplo n.º 1
0
        private void saveDBStoresLocally()
        {
            DiscountDataContext db = new DiscountDataContext();

            var lStores = from c in db.Stores select c;

            foreach (var i in lStores)
            {
                db.Stores.DeleteOnSubmit(i);
            }
            db.SubmitChanges();

            foreach (CStore store_i in stores)
            {
                var store = new StoresTable();
                store.storeID   = store_i.storeID;
                store.storeName = store_i.storeName;
                db.Stores.InsertOnSubmit(store);
            }
            db.SubmitChanges();
        }
Ejemplo n.º 2
0
 private void clearBuys()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys select c;
         foreach (var r in res)
         {
             db.Buys.DeleteOnSubmit(r);
         }
         db.SubmitChanges();
         InitializeSettings();
     }
 }
Ejemplo n.º 3
0
 private void clearBuys()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys select c;
         foreach (var r in res)
         {
             db.Buys.DeleteOnSubmit(r);
         }
         db.SubmitChanges();
         InitializeSettings();
     }
 }
Ejemplo n.º 4
0
 private void delProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         BuysTable buy = res.First();
         //Debug.WriteLine(productID);
         db.Buys.DeleteOnSubmit(buy);
         db.SubmitChanges();
         InitializeSettings();
     }
 }
Ejemplo n.º 5
0
        private void saveDBProductsLocally()
        {
            using (DiscountDataContext db = new DiscountDataContext())
            {
                var lProducts = from c in db.Products
                                select c;

                foreach (var i in lProducts)
                {
                    db.Products.DeleteOnSubmit(i);
                }
                db.SubmitChanges();


                foreach (CProduct prod_i in products)
                {
                    var product = new ProductsTable();
                    product.productID     = prod_i.productID;
                    product.productName   = prod_i.productName;
                    product.storeID       = prod_i.storeID;
                    product.storeName     = prod_i.storeName;
                    product.productTypeID = prod_i.productsTypeID;
                    product.productType   = prod_i.productsType;
                    product.discount      = prod_i.discount;
                    product.oldPrice      = prod_i.oldPrice;
                    product.newPrice      = prod_i.newPrice;
                    product.startDate     = prod_i.startDate;
                    product.endDate       = prod_i.endDate;
                    product.imageURL      = prod_i.imageURL;
                    db.Products.InsertOnSubmit(product);
                }
                db.SubmitChanges();
            }

            cleanStorage();
        }
Ejemplo n.º 6
0
 private void addProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
         }
     }
 }
Ejemplo n.º 7
0
 private void saveBuy()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
             popupMsgText.Text = "Добавлено";
             showPopup();
         }
         else
         {
             popupMsgText.Text = "Уже есть в списке покупок";
             showPopup();
         }
     }
 }
Ejemplo n.º 8
0
 private void addProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
         }
     }
 }
Ejemplo n.º 9
0
 private void saveBuy()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
             popupMsgText.Text = "Добавлено";
             showPopup();
         }
         else
         {
             popupMsgText.Text = "Уже есть в списке покупок";
             showPopup();
         }
     }
 }
Ejemplo n.º 10
0
 private void delProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         BuysTable buy = res.First();
         //Debug.WriteLine(productID);
         db.Buys.DeleteOnSubmit(buy);
         db.SubmitChanges();
         InitializeSettings();
     }
 }
Ejemplo n.º 11
0
        private void saveDBStoresLocally()
        {
            DiscountDataContext db = new DiscountDataContext();

            var lStores = from c in db.Stores select c;

            foreach (var i in lStores)
            {
                db.Stores.DeleteOnSubmit(i);
            }
            db.SubmitChanges();

            foreach (CStore store_i in stores)
            {
                var store = new StoresTable();
                store.storeID = store_i.storeID;
                store.storeName = store_i.storeName;
                db.Stores.InsertOnSubmit(store);
            }
            db.SubmitChanges();
        }
Ejemplo n.º 12
0
        private void saveDBProductsLocally()
        {
            using (DiscountDataContext db = new DiscountDataContext())
            {

                var lProducts = from c in db.Products
                                select c;

                foreach (var i in lProducts)
                {
                    db.Products.DeleteOnSubmit(i);
                }
                db.SubmitChanges();

                foreach (CProduct prod_i in products)
                {
                    var product = new ProductsTable();
                    product.productID = prod_i.productID;
                    product.productName = prod_i.productName;
                    product.storeID = prod_i.storeID;
                    product.storeName = prod_i.storeName;
                    product.productTypeID = prod_i.productsTypeID;
                    product.productType = prod_i.productsType;
                    product.discount = prod_i.discount;
                    product.oldPrice = prod_i.oldPrice;
                    product.newPrice = prod_i.newPrice;
                    product.startDate = prod_i.startDate;
                    product.endDate = prod_i.endDate;
                    product.imageURL = prod_i.imageURL;
                    db.Products.InsertOnSubmit(product);
                }
                db.SubmitChanges();
            }

            cleanStorage();
        }