Ejemplo n.º 1
0
 public void AddOrderDetail(OrderDetail orderDetail)
 {
     using (DB_Project db = new DB_Project())
     {
         db.OrderDetail.Add(orderDetail);
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 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();
         }
     }
 }
Ejemplo n.º 3
0
 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();
         }
     }
 }
Ejemplo n.º 4
0
 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();
         }
     }
 }
Ejemplo n.º 5
0
 public void addDish(Dish dish)
 {
     try
     {
         using (DB_Project db = new DB_Project())
         {
             db.Dish.Add(dish);
             db.SaveChanges();
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 6
0
 public void addUser(SystemUser user)
 {
     try
     {
         using (DB_Project db = new DB_Project())
         {
             db.SystemUser.Add(user);
             db.SaveChanges();
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 7
0
 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
     {
     }
 }
Ejemplo n.º 8
0
        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();
                }
            }
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 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
     {
     }
 }
Ejemplo n.º 11
0
 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
     {
     }
 }
Ejemplo n.º 12
0
 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
     {
     }
 }