public void Clone(MenusEN aMenusEN) { this.CodeHall = aMenusEN.CodeHall; this.Disable = aMenusEN.Disable; this.ID = aMenusEN.ID; this.IDBookingHall = aMenusEN.IDBookingHall; this.IDSystemUser = aMenusEN.IDSystemUser; this.Info = aMenusEN.Info; this.Issue = aMenusEN.Issue; this.Name = aMenusEN.Name; this.NameFood = aMenusEN.NameFood; this.PriceMenu = aMenusEN.PriceMenu; this.SkuHall = aMenusEN.SkuHall; this.Status = aMenusEN.Status; this.Type = aMenusEN.Type; this.aListFoods.Clear(); this.aListFoods.AddRange(aMenusEN.aListFoods); }
private void lueHalls_EditValueChanged(object sender, EventArgs e) { this.CurrentCodeHall = lueHalls.EditValue.ToString(); if (this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList().Count > 0) { if (this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList()[0].aListMenuEN.Count > 0) { txtMenusName.Text = this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList()[0].aListMenuEN[0].Name; dgvSelectFoods.DataSource = this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList()[0].aListMenuEN[0].aListFoods; dgvServiceInHall.RefreshDataSource(); } else { MenusEN aMenusEN = new MenusEN(); txtMenusName.Text = "Thực đơn " + lueHalls.Text; aMenusEN.Name = txtMenusName.Text; this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList()[0].InsertMenu(aMenusEN); dgvSelectFoods.DataSource = this.aNewBookingHEN.aListBookingHallUsed.Where(a => a.CodeHall == CurrentCodeHall).ToList()[0].aListMenuEN[0].aListFoods; dgvServiceInHall.RefreshDataSource(); } } }
//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)); } }
//hiennv public void UpdateMenus(MenusEN aMenusEN) { try { Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); MenusBO aMenusBO = new MenusBO(); Menus aMenus = aMenusBO.Select_ByID(aMenusEN.ID); aMenus.Name = aMenusEN.Name; aMenus.Info = aMenusEN.Info; aMenus.IDBookingHall = aMenusEN.IDBookingHall; aMenus.IDSystemUser = aMenusEN.IDSystemUser; aMenusBO.Update(aMenus); aMenus_FoodsBO.Delete_ByIDMenu(aMenusEN.ID); foreach (Foods item in aMenusEN.aListFoods) { Menus_Foods aMenus_Foods = new Menus_Foods(); aMenus_Foods.IDMenu = aMenusEN.ID; aMenus_Foods.IDFood = item.ID; aMenus_FoodsBO.Insert(aMenus_Foods); } } catch (Exception ex) { throw new Exception(string.Format("ReceptionTaskBO.UpdateMenus:" + ex.Message)); } }
public List<MenusEN> GetListMenus_ByIDBookingHall(int IDBookingHall) { MenusBO aMenusBO = new MenusBO(); List<MenusEN> aListMenus = new List<MenusEN>(); MenusEN aMenu; List<Menus> aListTemp = aMenusBO.Select_ByIDBookingHall(IDBookingHall); foreach (Menus item in aListTemp) { aMenu = new MenusEN(); aMenu.ID = item.ID; aMenu.Name = item.Name; aMenu.aListFoods = (this.GetListFoods_ByIDMenu(item.ID)).ToList(); aListMenus.Add(aMenu); } return aListMenus; }
//11/05 //hiennv public MenusEN GetDetailMenu_ByIDBookingHall(int IDBookingHall) { try { MenusEN aMenusEN = new MenusEN(); List<Menus> aListMenus = (from aMenus in aDatabaseDA.Menus where aMenus.IDBookingHall == IDBookingHall select aMenus).ToList(); if (aListMenus.Count > 0) { aMenusEN.ID = aListMenus[0].ID; aMenusEN.Name = aListMenus[0].Name; aMenusEN.aListFoods = (this.GetListFoods_ByIDMenu(aMenusEN.ID)).ToList(); } return aMenusEN; } catch (Exception ex) { throw new Exception(string.Format("ReceptionTaskBO.GetDetailMenu_ByIDBookingHall\n" + ex.Message)); } }
public int InsertMenu(MenusEN aMenusEN) { try { this.aListMenuEN.Add(aMenusEN); return 1; } catch (Exception ex) { return 0; throw new Exception(string.Format("BookingHallUsedEN.InsertMenu :" + ex.Message.ToString())); } }