public void AddOrderDetail(OrderDetail orderDetail) { using (DB_Project db = new DB_Project()) { db.OrderDetail.Add(orderDetail); db.SaveChanges(); } }
public void DeleteClient(String email) { using (DB_Project db = new DB_Project()) { var client = db.Client.Find(email); if (client != null) { db.Client.Attach(client); db.Client.Remove(client); db.SaveChanges(); } } }
public void DeleteDish(int code) { using (DB_Project db = new DB_Project()) { Dish dish = db.Dish.Find(code); if (dish != null) { db.Dish.Attach(dish); db.Dish.Remove(dish); db.SaveChanges(); } } }
public void DeleteUser(String name) { using (DB_Project db = new DB_Project()) { var user = db.SystemUser.Find(name); if (user != null) { db.SystemUser.Attach(user); db.SystemUser.Remove(user); db.SaveChanges(); } } }
public void addDish(Dish dish) { try { using (DB_Project db = new DB_Project()) { db.Dish.Add(dish); db.SaveChanges(); } } catch { } }
public void addUser(SystemUser user) { try { using (DB_Project db = new DB_Project()) { db.SystemUser.Add(user); db.SaveChanges(); } } catch { } }
public void addClient(Client client, Address address) { try { using (DB_Project db = new DB_Project()) { db.Client.Add(client); db.Address.Add(address); db.SaveChanges(); } } catch { } }
public void ChangeStateOrder(int OrderCode, string state) { using (DB_Project db = new DB_Project()) { ClientOrder client = db.ClientOrder.Find(OrderCode); if (client != null) { client.OrderState = state; if (state == "committed") { client.DateHourOut = DateTime.Now; } db.SaveChanges(); } } }
public int AddOrder(ClientOrder order) { int orderCode = 0; using (DB_Project db = new DB_Project()) { db.ClientOrder.Add(order); db.SaveChanges(); ClientOrder orderFound = (from dbOrder in db.ClientOrder where dbOrder.ClientEmail == order.ClientEmail orderby dbOrder.OrderCode descending select dbOrder).First(); orderCode = orderFound.OrderCode; } return(orderCode); }
public void updateStateClient(Client client) { try { using (DB_Project db = new DB_Project()) { Client cliente = db.Client.Find(client.ClientEmail); if (client != null) { cliente.ClientAvailable = client.ClientAvailable; db.SaveChanges(); } } } catch { } }
public void updateUser(SystemUser systemUser) { try { using (DB_Project db = new DB_Project()) { SystemUser User = db.SystemUser.Find(systemUser.SystemUserName); if (User != null) { User.SystemUserPassword = systemUser.SystemUserPassword; User.SystemUserRole = systemUser.SystemUserRole; db.SaveChanges(); } } } catch { } }
public void updateDish(Dish dish) { try { using (DB_Project db = new DB_Project()) { Dish dis = db.Dish.Find(dish.DishCode); if (dis != null) { dis.DishName = dish.DishName; dis.DishDescription = dish.DishDescription; dis.DishPrice = dish.DishPrice; dis.DishAvailable = dish.DishAvailable; dis.DishPhoto = dish.DishPhoto; db.SaveChanges(); } } } catch { } }