Пример #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (_context != null)
         {
             _context.Dispose();
         }
         disposedValue = true;
     }
 }
Пример #2
0
 public void Dispose()
 {
     if (_inventoryContext != null)
     {
         _inventoryContext.Dispose();
     }
 }
Пример #3
0
 protected virtual void Dispose(bool disposing)
 {
     // Cleanup
     if (_context != null)
     {
         _context.Dispose();
     }
 }
Пример #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         inventoryContext.Dispose();
     }
     base.Dispose(disposing);
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Пример #6
0
        public string AddUpdateProduct(Product model)
        {
            if (model.ProductID == -1)                       // new product
            {
                TB_Products aProduct = new TB_Products
                {
                    ProductName = model.ProductName,
                    CategoryID  = model.CategoryID,
                    UnitName    = model.UnitName,
                    Barcode     = model.Barcode,
                    Brand       = model.Brand,
                    IsActive    = model.IsActive,
                    Model       = model.Model,
                    Description = model.Description
                };

                _context.TB_Products.Add(aProduct);
            }
            else                                                // update product
            {
                var aProduct = _context.TB_Products.Find(model.ProductID);

                aProduct.ProductName = model.ProductName;
                aProduct.CategoryID  = model.CategoryID;
                aProduct.UnitName    = model.UnitName;
                aProduct.Barcode     = model.Barcode;
                aProduct.Brand       = model.Brand;
                aProduct.IsActive    = model.IsActive;
                aProduct.Model       = model.Model;
                aProduct.Description = model.Description;
            }

            try
            {
                _context.SaveChanges();
                _context.Dispose();
                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Пример #7
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             _context.Dispose();
         }
     }
     this.disposed = true;
 }
Пример #8
0
 public virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             context.Dispose();
         }
         this.disposed = true;
     }
 }
Пример #9
0
        public void SelectUsers()
        {
            var Inventory = new InventoryContext();

            try
            {
                var t1 = Inventory.Users.Where(user => user.StatusUser != null)
                         .Where(u => u.StatusUser.IdStatusUser != 4).Where(u1 => u1.NameUser == "Яшина Полина Денисовна").ToArray();
                TT(ref t1);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            Inventory?.Dispose();
        }
Пример #10
0
        public ActionResult Edit([Bind(Include = "ID,Name,Description,Sku,Qty,Price,IsActive")] Inventory inventory)
        {
            //Creating a second connection to eliminate any collision with the first database connection
            var store = 0;

            using (InventoryContext context = new InventoryContext()) {
                store = context.Inventories.Where(x => x.ID == inventory.ID).FirstOrDefault().Stores.ID;
                context.Dispose();//forces new connection to close
            }
            if (ModelState.IsValid)
            {
                db.Entry(inventory).State = EntityState.Modified;
                db.SaveChanges();
                //return RedirectToAction("Index");
            }

            return(RedirectToAction("Index", new { storeId = store }));
        }
Пример #11
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 public void Dispose()
 {
     _dbContext.Dispose();
 }
 public void Dispose()
 {
     _inventoryContext.Dispose();
 }
Пример #13
0
 public void Rollback()
 {
     _inventoryContext.Dispose();
 }
Пример #14
0
 //allows the use of using(UnitOfWork){}
 //saves changes to database before it is disposed
 public void Dispose()
 {
     Context.SaveChanges();
     Context.Dispose();
 }
Пример #15
0
 public void Dispose()
 {
     _DB.Dispose();
 }
Пример #16
0
 public void Dispose()
 {
     _context.Dispose();
 }
Пример #17
0
 public static void Flush(this InventoryContext inventoryContext)
 {
     inventoryContext.Database.EnsureDeleted();
     inventoryContext.Dispose();
 }