コード例 #1
0
        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");
        }
コード例 #2
0
 //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);
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        private void btnUnSelectFoods_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                if (this.aListFoods.Where(f => f.ID == Convert.ToInt32(viewSelectFoods.GetFocusedRowCellValue("ID"))).ToList().Count() == 0)
                {

                    Foods aFoods = new Foods();
                    aFoods.ID = Convert.ToInt32(viewSelectFoods.GetFocusedRowCellValue("ID"));
                    aFoods.Name = Convert.ToString(viewSelectFoods.GetFocusedRowCellValue("Name"));
                    aFoods.Name1 = Convert.ToString(viewSelectFoods.GetFocusedRowCellValue("Name1"));
                    aFoods.Name2 = Convert.ToString(viewSelectFoods.GetFocusedRowCellValue("Name2"));
                    aFoods.Name3 = Convert.ToString(viewSelectFoods.GetFocusedRowCellValue("Name3"));
                    aFoods.Image1 = (byte[])viewSelectFoods.GetFocusedRowCellValue("Image1");

                    this.aListFoods.Insert(0, aFoods);
                    dgvAvailableFoods.DataSource = this.aListFoods;
                    dgvAvailableFoods.RefreshDataSource();
                }

                Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
                Menus_Foods aMenus_Foods = aMenus_FoodsBO.Select_ByIDFoodAndIDMenu(Convert.ToInt32(viewSelectFoods.GetFocusedRowCellValue("ID")),this.IDMenu);
                if (aMenus_Foods != null)
                {
                    aMenus_FoodsBO.Delete_ByIDMenuAndIDFood(this.IDMenu, Convert.ToInt32(viewSelectFoods.GetFocusedRowCellValue("ID")));
                }
                Foods aFoodTemp = this.aMenusEN.aListFoods.Where(f => f.ID == Convert.ToInt32(viewSelectFoods.GetFocusedRowCellValue("ID"))).ToList()[0];
                this.aMenusEN.aListFoods.Remove(aFoodTemp);
                dgvSelectFoods.DataSource = this.aMenusEN.aListFoods;
                dgvSelectFoods.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmUpd_Menus.btnUnSelectFoods_ButtonClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        private void btnShow_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
            List<Foods> aListFood1 = new List<Foods>();

            int IDMenu = Convert.ToInt32(grvMenus.GetFocusedRowCellValue("ID"));
            List<Foods> aListTemp1 = new List<Foods>();
            aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(IDMenu);
            foreach (Foods item in aListTemp1)
            {
                if (item.Image1 != null)
                {
                    if (item.Image1.Length <= 0)
                    {
                        Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        item.Image1 = aImageByte;
                    }
                }
                else
                {
                    Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                    image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                    Byte[] aImageByte = this.ConvertImageToByteArray(image);
                    item.Image1 = aImageByte;
                }
                aListFood1.Add(item);
            }
            dgvFoods.DataSource = aListFood1;
            dgvFoods.RefreshDataSource();
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        private void lueAvailableMenus_EditValueChanged(object sender, EventArgs e)
        {
            this.aMenusEN.aListFoods.Clear();

            Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
            FoodsBO aFoodsBO = new FoodsBO();
            int IDMenu = Convert.ToInt32(lueAvailableMenus.EditValue);
            List<Foods> aListFoods = aMenus_FoodsBO.SelectListFoods_ByIDMenu(IDMenu);
            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 = this.ConvertByteArrayToImage(aFoods.Image1);
                        image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                    else
                    {
                        Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                }
                else
                {
                    Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                    image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                    Byte[] aImageByte = this.ConvertImageToByteArray(image);
                    aFoods.Image1 = aImageByte;
                }

                this.aMenusEN.aListFoods.Add(aFoods);
            }
            dgvSelectFoods.DataSource = this.aMenusEN.aListFoods;
            dgvSelectFoods.RefreshDataSource();
        }
コード例 #9
0
 private void grvMenus_RowClick(object sender, RowClickEventArgs e)
 {
     Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
     int IDMenu = Convert.ToInt32(grvMenus.GetFocusedRowCellValue("ID"));
     List<Foods> aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(IDMenu);
     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;
         }
         this.aListFood1.Add(item);
     }
     dgvFoods.DataSource = aListFood1;
     dgvFoods.RefreshDataSource();
 }
コード例 #10
0
 //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));
     }
 }
コード例 #11
0
        //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));
            }
        }
コード例 #12
0
        //=======================================================
        //Author: Hiennv
        //Function : SelectListFoods_ByIDMenu()
        //=======================================================
        public List<Foods> SelectListFoods_ByIDMenu(int IDMenu)
        {
            try
            {
                Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
                List<Menus_Foods> aList = aDatabaseDA.Menus_Foods.Where(a => a.IDMenu == IDMenu).ToList();
                List<Foods> aListFoods = new List<Foods>();
                Foods aFoods;
                FoodsBO aFoodsBO = new FoodsBO();
                for (int i = 0; i < aList.Count; i++)
                {
                    aFoods = new Foods();
                    aFoods = aFoodsBO.Select_ByID(aList[i].IDFood);
                    aListFoods.Add(aFoods);
                }
                return aListFoods;
            }
            catch (Exception ex)
            {

                throw new Exception("Menus_FoodsBO.SelectListFoods_ByIDMenu\n" + ex.ToString());
            }
        }