internal static List <Stock> ListStock() { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Stock.ToList()); } }
internal static Stock GetStock(int productID) { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Stock.FirstOrDefault(f => f.ProductID == productID)); } }
internal static List <Client> ListClients() { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Client.ToList()); } }
internal static Client GetClient(int userID) { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Client.FirstOrDefault(f => f.ClientID == userID)); } }
internal static Product GetProduct(int productID) { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Product.FirstOrDefault(f => f.ProductID == productID)); } }
internal static List <Product> ListProducts() { using (ErpEntities dbContext = new ErpEntities()) { return(dbContext.Product.ToList()); } }
public List <Customer> Get(Func <Customer, bool> predicate) { using (var context = new ErpEntities()) { return(context.Customers.Where(predicate).ToList()); } }
internal static void AddProduct(Product product) { using (ErpEntities dbContext = new ErpEntities()) { dbContext.Product.Add(product); dbContext.SaveChanges(); } }
internal static void AddClient(Client client) { using (ErpEntities dbContext = new ErpEntities()) { dbContext.Client.Add(client); dbContext.SaveChanges(); } }
internal static string GetName(int productID) { using (ErpEntities dbContext = new ErpEntities()) { var product = dbContext.Product.SingleOrDefault(f => f.ProductID == productID); return(product.ProductName); } }
internal static void ChangeStock(int productID, int new_quantity) { using (ErpEntities dbContext = new ErpEntities()) { Stock stock = dbContext.Stock.FirstOrDefault(f => f.ProductID == productID); stock.ProductQuantity = new_quantity; dbContext.SaveChanges(); } }
internal static void ModifyClient(int userID, string clientName, string clientEmail) { using (ErpEntities dbContext = new ErpEntities()) { var client = dbContext.Client.SingleOrDefault(f => f.ClientID == userID); client.ClientName = clientName; client.ClientEmail = clientEmail; dbContext.SaveChanges(); } }
internal static void ModifyProduct(int productID, string productName, decimal productPrice) { using (ErpEntities dbContext = new ErpEntities()) { var product = dbContext.Product.SingleOrDefault(f => f.ProductID == productID); product.ProductName = productName; product.ProductPrice = productPrice; dbContext.SaveChanges(); } }
internal static void AddStock(Product product, int productQuantity) { using (ErpEntities dbContext = new ErpEntities()) { Stock stock = new Stock { ProductID = product.ProductID, ProductQuantity = productQuantity }; dbContext.Stock.Add(stock); dbContext.SaveChanges(); } }
internal static bool RemoveProduct(int productID) { using (ErpEntities dbContext = new ErpEntities()) { Product product = dbContext.Product.FirstOrDefault(f => f.ProductID == productID); if (product != null) { dbContext.Product.Remove(product); dbContext.SaveChanges(); return(true); } else { Display.NoEntry(); return(false); } } }
internal static bool RemoveClient(int userID) { using (ErpEntities dbContext = new ErpEntities()) { Client client = dbContext.Client.FirstOrDefault(f => f.ClientID == userID); if (client != null) { dbContext.Client.Remove(client); dbContext.SaveChanges(); return(true); } else { Display.NoEntry(); return(false); } } }
public UserDao() { db = new ErpEntities(); }