Ejemplo n.º 1
0
        public string CreateMenu(string name, int idbookinghall, int idsystemuser)
        {
            string result = "0";
            try
            {
                var menu = new Menus() { Name = name, IDBookingHall = idbookinghall, IDSystemUser = idsystemuser };
                aDatabaseDA.Menus.Add(menu);
                aDatabaseDA.SaveChanges();

                var id = (from m in aDatabaseDA.Menus
                          orderby m.ID descending
                          select m.ID).FirstOrDefault();
                result = id.ToString();

            }
            catch (Exception ex)
            {

                result = "Lỗi hệ thống";
            }
            return result;
        }
Ejemplo n.º 2
0
 //=======================================================
 //Author: Hiennv
 //Function : Insert
 //=======================================================
 public int Insert(Menus aMenus)
 {
     try
     {
         aDatabaseDA.Menus.Add(aMenus);
         aDatabaseDA.SaveChanges();
         return aMenus.ID;
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("MenusBO.Insert :" + ex.Message));
     }
 }
Ejemplo n.º 3
0
 //=======================================================
 //Author: Hiennv
 //Function : Update
 //=======================================================
 public int Update(Menus aMenus)
 {
     try
     {
         aDatabaseDA.Menus.AddOrUpdate(aMenus);
         return aDatabaseDA.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("MenusBO.Update :" + ex.Message));
     }
 }
 //hiennv
 public void CreateMenus(MenusEN aMenusEN)
 {
     try
     {
         MenusBO aMenusBO = new MenusBO();
         Menus aMenus = new Menus();
         aMenus.Name = aMenusEN.Name;
         aMenus.Issue = aMenusEN.Issue;
         aMenus.Info = aMenusEN.Info;
         aMenus.Type = aMenusEN.Type;
         aMenus.Status = aMenusEN.Status;
         aMenus.Disable = aMenusEN.Disable;
         aMenus.IDBookingHall = aMenusEN.IDBookingHall;
         aMenus.IDSystemUser = aMenusEN.IDSystemUser;
         int IDMenu = aMenusBO.Insert(aMenus);
         if (IDMenu > 0)
         {
             foreach (Foods item in aMenusEN.aListFoods)
             {
                 Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
                 Menus_Foods aMenus_Foods = new Menus_Foods();
                 aMenus_Foods.IDMenu = IDMenu;
                 aMenus_Foods.IDFood = item.ID;
                 aMenus_FoodsBO.Insert(aMenus_Foods);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("ReceptionTaskBO.CreateMenus:" + ex.Message));
     }
 }