public void LoadData() { try { CustomersBO aCustomersBO = new CustomersBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms aBookingRooms = new BookingRooms(); RoomsBO aRoomsBO = new RoomsBO(); // Load các thông tin chung về phòng aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRooms); if (aBookingRooms != null) { lblCheckIn.Text = aBookingRooms.CheckInActual.ToString("dd/MM/yyyy HH:mm"); lblCheckOut.Text = aBookingRooms.CheckOutPlan.ToString("dd/MM/yyyy HH:mm"); lblRoomSku.Text = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom, 1).Sku; } BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs = aBookingRsBO.Select_ByID(this.IDBookingRs); if (aBookingRs != null) { lblCustomerType.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingRs.CustomerType)).Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByIDBookingRoom(this.IDBookingRooms).Name; lblCustomer.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Name; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); lblGroup.Text = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup).Name; lblTel.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Tel; this.IDCustomerGroup = aBookingRs.IDCustomerGroup; } //Load danh sách phòng còn trống lueRooms.Properties.DataSource = this.LoadListAvailableRooms(aBookingRooms.CheckInActual, aBookingRooms.CheckOutPlan); lueRooms.Properties.ValueMember = "RoomCode"; lueRooms.EditValue = this.IDBookingRooms; //Load danh sách khách trong phòng this.aListCustomersInRoom = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRooms); dgvAvailableCustomers.DataSource = this.aListCustomersInRoom; dgvAvailableCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_EditBooking.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadData() { try { CustomersBO aCustomersBO = new CustomersBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms aBookingRooms = new BookingRooms(); RoomsBO aRoomsBO = new RoomsBO(); aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRooms); if (aBookingRooms != null) { lblCheckIn.Text = aBookingRooms.CheckInActual.ToString("dd/MM/yyyy HH:mm"); lblCheckOut.Text = aBookingRooms.CheckOutPlan.ToString("dd/MM/yyyy HH:mm"); lblRoomSku.Text = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom,1).Sku; } BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs = aBookingRsBO.Select_ByID(this.IDBookingRs); if (aBookingRs != null) { lblCustomerType.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingRs.CustomerType)).Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByIDBookingRoom(this.IDBookingRooms).Name; lblCustomer.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Name; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); lblGroup.Text = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup).Name; lblTel.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Tel; this.IDCustomerGroup = aBookingRs.IDCustomerGroup; } dgvAvaiableRooms.DataSource = this.LoadListAvailableRooms(aBookingRooms.CheckInActual, aBookingRooms.CheckOutPlan); dgvAvaiableRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_EditBooking.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }