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 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); } }
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(); }
//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)); } }