コード例 #1
0
        private void LoadServicesInRoom()
        {
            try
            {
                ServicesBO aServicesBO = new ServicesBO();
                BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO();
                List<BookingRooms_Services> aListTemp = aBookingRooms_ServicesBO.Select_ByIDBookingRooms(this.IDBookingRoom);
                BookingRoom_ServiceEN aBookingRoom_ServiceEN;

                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aBookingRoom_ServiceEN = new BookingRoom_ServiceEN();
                    aBookingRoom_ServiceEN.ID = aListTemp[i].ID;
                    aBookingRoom_ServiceEN.Info = aListTemp[i].Info;
                    aBookingRoom_ServiceEN.Type = aListTemp[i].Type;
                    aBookingRoom_ServiceEN.Status = aListTemp[i].Status;
                    aBookingRoom_ServiceEN.Disable = aListTemp[i].Disable;
                    aBookingRoom_ServiceEN.IDBookingRoom = aListTemp[i].IDBookingRoom;
                    aBookingRoom_ServiceEN.IDService = aListTemp[i].IDService;
                    aBookingRoom_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
                    aBookingRoom_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;
                    aBookingRoom_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost;
                    aBookingRoom_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
                    aBookingRoom_ServiceEN.Date = aListTemp[i].Date;
                    aBookingRoom_ServiceEN.PercentTax = aListTemp[i].PercentTax;
                    aBookingRoom_ServiceEN.Quantity = aListTemp[i].Quantity;
                    aBookingRoom_ServiceEN.Tag = aListTemp[i].Tag;
                    aListSelected.Add(aBookingRoom_ServiceEN);
                }
                dgvServiceInRoom.DataSource = aListSelected;
                dgvServiceInRoom.RefreshDataSource();

                CustomersBO aCustomersBO = new CustomersBO();

                lueUserInRoom.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRoom);

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_BookingRooms_Services.grvRooms_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
コード例 #2
0
        private void btnAddService_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            this.IsDataChange = true;
            if (String.IsNullOrEmpty(this.CodeCurrentRoom) == true)
            {
                MessageBox.Show("Vui lòng chọn phòng muốn sử dụng dịch vụ.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                BookingRoom_ServiceEN aBookingRoom_ServiceEN = new BookingRoom_ServiceEN();
                // Tạo IDCurrent cho những Room Service được thêm ở thời điểm hiện tại - lỗi số lượng dịch vụ thêm mới bị đồng bộ
                // Bắt đầu
                aBookingRoom_ServiceEN.ID = --IDCurrent;
                // Kết thúc

                int IDService = int.Parse(grvServices.GetFocusedRowCellValue("ID").ToString());
                aBookingRoom_ServiceEN.IDService = IDService;
                aBookingRoom_ServiceEN.IDBookingRoom = this.IDBookingRoom;
                aBookingRoom_ServiceEN.Service_Name = grvServices.GetFocusedRowCellValue("Name").ToString();
                aBookingRoom_ServiceEN.Cost = Convert.ToDecimal(grvServices.GetFocusedRowCellValue("CostRef"));
                aBookingRoom_ServiceEN.CostRef_Services = Convert.ToDecimal(grvServices.GetFocusedRowCellValue("CostRef"));
                aBookingRoom_ServiceEN.Service_Unit = grvServices.GetFocusedRowCellValue("Unit").ToString();
                aBookingRoom_ServiceEN.Date = dtpDate.DateTime;
                aBookingRoom_ServiceEN.PercentTax = 10;
                aBookingRoom_ServiceEN.Quantity = 1;

                this.aListSelected.Insert(0, aBookingRoom_ServiceEN);
                dgvServiceInRoom.DataSource = aListSelected;
                dgvServiceInRoom.RefreshDataSource();

            }
        }