public frmRpt_UnSelectMenus(int IDBookingHall) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; this.LoadMenus(); //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
public frmRpt_UnSelectMenus(int IDBookingHall,int IDMenu) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; // Load Menu Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); Menus aMenus = aMenusBO.Select_ByID(IDMenu); if (aMenus != null) { List<Foods> aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(aMenus.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); } } //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
//hiennv public void LoadDataMenus() { try { MenusBO aMenusBO = new MenusBO(); dgvMenus.DataSource = aMenusBO.Select_All(); dgvMenus.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmLst_Menus.LoadDataMenus\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { int menuID = Convert.ToInt32(viewMenus.GetFocusedRowCellValue("ID")); Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); int status = aMenus_FoodsBO.Delete_ByIDMenu(menuID); MenusBO aMenusBO = new MenusBO(); aMenusBO.Delete(menuID); this.LoadDataMenus(); MessageBox.Show("Bạn đã xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("frmLst_Menus.btnDeleteFoods_ButtonClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv private void frmUpd_Menus_Load(object sender, EventArgs e) { try { MenusBO aMenusBO = new MenusBO(); Menus aMenus = aMenusBO.Select_ByID(this.IDMenu); txtMenusName.Text = aMenus.Name; txtInfo.Text = aMenus.Info; this.LoadDataListAvaiableFoods(); this.LoadDataListSelectFoods(this.IDMenu); } catch (Exception ex) { MessageBox.Show("frmUpd_Menus.LoadDataFoods\n" + ex.ToString(), "Thông báo", 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); 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; }
// Load data cho bảng món ăn public void LoadDataListFoods() { try { this.aListFoods.Clear(); FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); int count = (lueHalls.Properties.DataSource as IList).Count; for (int i = 0; i < count; i++) { this.aListFoods.Insert(i,aFoodsBO.Select_All()); } dgvAvailableFoods.DataSource = this.aListFoods[this.lueHalls.ItemIndex]; dgvAvailableFoods.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_BookingHall_Customer_New.LoadDataListFoods\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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; } }
//hiennv private void frmIns_Menus_Load(object sender, EventArgs e) { try { this.LoadDataListFoods(); MenusBO aMenusBO = new MenusBO(); List<Menus> aListMenus = aMenusBO.Select_ByType(1);//thuc don co san lueAvailableMenus.Properties.DataSource = aListMenus; lueAvailableMenus.Properties.DisplayMember = "Name"; lueAvailableMenus.Properties.ValueMember = "ID"; } catch (Exception ex) { MessageBox.Show("frmIns_Menus.frmIns_Menus_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv public void LoadDataListFoods() { try { this.aListFoods.Clear(); FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); List<Foods> aListFoods = aFoodsBO.Select_All(); List<int> ListID = new List<int>(); for (int i = 0; i < aListFoods.Count; i++) { ListID.Add(aListFoods[i].ID); } List<Foods> aListTemp = aFoodsBO.Select_ByListID(ListID); foreach (Foods item in aListFoods) { Foods aFoods = aListTemp.Where(p => p.ID == item.ID).ToList()[0]; if (aFoods.Image1 != null) { if (aFoods.Image1.Length <= 0) { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } } else { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } this.aListFoods.Add(aFoods); } dgvAvailableFoods.DataSource = this.aListFoods; dgvAvailableFoods.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmIns_Menus.LoadDataListFoods\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//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)); } }
private void btnDeleteBookingR_Click(object sender, EventArgs e) { BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); CustomerGroups_CustomersBO aCustomerGroups_CustomersBO = new CustomerGroups_CustomersBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); MenusBO aMenusBO = new MenusBO(); Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); try { MessageBox.Show("Chức năng này sẽ xóa tất cả các phòng và hóa đơn đặt phòng đã đặt!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (this.IDBookingH == 0) { DialogResult result = MessageBox.Show("Xóa tất cả các phòng đã đặt. Tiếp tục?", "Xóa phòng", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (BookingRoomUsedEN item in this.aNewPaymentEN.aListBookingRoomUsed) { aBookingRooms_ServicesBO.DeleteListServiceUsed(item.ID); aBookingRoomsMembersBO.DeleteListBookingRoomsMembers(item.ID); aBookingRoomsBO.Delete(item.ID); } aCustomerGroups_CustomersBO.DeleteAllCustomersFromCustomerGroup_ByIDBookingRs(this.IDBookingR); aCustomerGroupsBO.Delete_ByID(Convert.ToInt32(this.aNewPaymentEN.IDCustomerGroup)); int ret = aBookingRsBO.Delete(this.IDBookingR); if (ret > 0) { MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { DialogResult result = MessageBox.Show("Xóa tất cả các phòng và hội trường đã đặt. Tiếp tục?", "Xóa hóa đơn", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (BookingRoomUsedEN item in this.aNewPaymentEN.aListBookingRoomUsed) { aBookingRooms_ServicesBO.DeleteListServiceUsed(item.ID); aBookingRoomsMembersBO.DeleteListBookingRoomsMembers(item.ID); aBookingRoomsBO.Delete(item.ID); } aCustomerGroups_CustomersBO.DeleteAllCustomersFromCustomerGroup_ByIDBookingRs(this.IDBookingR); aCustomerGroupsBO.Delete_ByID(Convert.ToInt32(this.aNewPaymentEN.IDCustomerGroup)); aBookingRsBO.Delete(this.IDBookingR); foreach (BookingHallUsedEN item1 in this.aNewPaymentEN.aListBookingHallUsed) { aBookingHalls_ServicesBO.DeleteListServiceUsed(item1.ID); aBookingHallsBO.Delete(item1.ID); foreach (MenusEN aMenu in item1.aListMenuEN) { aMenusBO.Delete(aMenu.ID); aMenus_FoodsBO.Delete_ByIDMenu(aMenu.ID); } } int ret = aBookingHsBO.Delete(this.IDBookingH); if (ret > 0) { MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } this.Close(); if (this.afrmMain != null) { this.afrmMain.ReloadData(); } else if (this.afrmMain_Halls != null) { this.afrmMain_Halls.ReloadData(); } } catch (Exception ex) { MessageBox.Show("frmTsk_UpdBookingHall.btnDeleteBookingRs\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmLst_DetailMenus_Load(object sender, EventArgs e) { try { MenusBO aMenusBO = new MenusBO(); Menus aMenus = aMenusBO.Select_ByID(this.IDMenu); lblNameMenu.Text = aMenus.Name; ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); FoodsBO aFoodsBO = new FoodsBO(); List<Foods> aListTemp = aReceptionTaskBO.GetListFoods_ByIDMenu(this.IDMenu); List<Foods> aListFoods = new List<Foods>(); foreach (Foods item in aListTemp) { Foods aFoods = aFoodsBO.Select_ByID(item.ID); if (aFoods.Image1 != null) { if (aFoods.Image1.Length <= 0) { Image image = SaleManagement.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70,70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } } else { Image image = SaleManagement.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70,70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } aListFoods.Add(aFoods); } dgvFoods.DataSource = aListFoods; dgvFoods.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmLst_DetailMenus.frmLst_DetailMenus_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSelect_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { MenusBO aMenusBO = new MenusBO(); int IDMenu = Convert.ToInt32(grvMenus.GetFocusedRowCellValue("ID")); Menus aMenu = aMenusBO.Select_ByID(IDMenu); aMenu.Status = 0; aMenusBO.Update(aMenu); MessageBox.Show("Lựa chọn thực đơn chính thức thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (afrmTsk_CheckMenus != null) { afrmTsk_CheckMenus.Reload(); } this.Close(); }
// Load data cho bảng món ăn public void LoadDataListFoods() { try { this.aListFoods.Clear(); FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); this.aListFoods = aFoodsBO.Select_All(); dgvAvailableFoods.DataSource = this.aListFoods; dgvAvailableFoods.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_BookingHall_Customer_New.LoadDataListFoods\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// 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; }