public void LoadMenus() { try { MenusBO aMenusBO = new MenusBO(); FoodsBO aFoodsBO = new FoodsBO(); Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); List<Menus> aListMenus = aMenusBO.Select_ByIDBookingHall(IDBookingHall); dgvMenus.DataSource = aListMenus; dgvMenus.RefreshDataSource(); if (aListMenus.Count > 0) { btnCreateMenu.Visible = false; } } catch (Exception ex) { MessageBox.Show("frmTsk_SelectedMenus.LoadMenus\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadMenus() { try { MenusBO aMenusBO = new MenusBO(); FoodsBO aFoodsBO = new FoodsBO(); Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); List<Menus> aListMenus = aMenusBO.Select_ByIDBookingHall(IDBookingHall); if (aListMenus.Count > 0) { List<Foods> aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(aListMenus[0].ID); foreach (Foods item in aListTemp1) { if (item.Image1 != null) { if (item.Image1.Length <= 0) { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } } else { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } aListFood1.Add(item); } } } catch (Exception ex) { MessageBox.Show("frmTsk_SelectedMenus.LoadMenus\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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; }
private List<BookingHallsEN> GetListBookingHalls(List<BookingHallsEN> aListBookingHallTemp) { try { List<BookingHallsEN> aListBookingHallsEN = new List<BookingHallsEN>(); BookingHallsEN aBookingHallsEN; MenusBO aMenusBO = new MenusBO(); foreach (BookingHallsEN item in aListBookingHallTemp) { aBookingHallsEN = new BookingHallsEN(); aBookingHallsEN.IDBookingH = item.IDBookingH; aBookingHallsEN.DisplayCustomerType = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(item.CustomerType)).Name; aBookingHallsEN.ID = item.ID; aBookingHallsEN.BookingStatus = item.BookingStatus; aBookingHallsEN.NameGuest = item.NameGuest; aBookingHallsEN.Date = item.Date; aBookingHallsEN.LunarDate= item.LunarDate; aBookingHallsEN.StartTime = item.StartTime; aBookingHallsEN.EndTime = item.EndTime; aBookingHallsEN.BookingTypeBookingH = item.BookingTypeBookingH; aBookingHallsEN.StatusPayBookingH = item.StatusPayBookingH; aBookingHallsEN.DisplayBookingType = CORE.CONSTANTS.SelectedBookingType(Convert.ToInt32(item.BookingTypeBookingH)).Name; aBookingHallsEN.DisplayLevel = CORE.CONSTANTS.SelectedLevel(Convert.ToInt32(item.LevelBookingH)).Name; aBookingHallsEN.HallSku = item.HallSku; List<Menus> aListMenus = aMenusBO.Select_ByIDBookingHall(item.ID); if (aListMenus.Count > 0) { aBookingHallsEN.HasMenu = " Có"; } else { aBookingHallsEN.HasMenu = " Chưa có"; } aListBookingHallsEN.Add(aBookingHallsEN); } return aListBookingHallsEN; } catch (Exception ex) { MessageBox.Show("frmTsk_CheckMenus.GetListBookingHalls\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } }
// Linhting public List<BookingHallsEN> GetListBookingHallsSelectedMenus(DateTime FromDate, DateTime ToDate) { List<BookingHallsEN> aListTemp = GetListBookingHallsHaveMenus_ByBookingHallsDate(FromDate, ToDate); List<BookingHallsEN> aListBookingHallsEN = new List<BookingHallsEN>(); List<int> aListStatus = new List<int>(); foreach (BookingHallsEN aBookingHallsEN in aListTemp) { MenusBO aMenusBO = new MenusBO(); List<Menus> aListMenu = aMenusBO.Select_ByIDBookingHall(aBookingHallsEN.ID); foreach (Menus aMenu in aListMenu) { aListStatus.Add(Convert.ToInt32(aMenu.Status)); } if (aListStatus.Contains(0) == true) { aListBookingHallsEN.Add(aBookingHallsEN); } aListStatus.Clear(); } return aListBookingHallsEN; }