//Hiennv    25/11/2014
 public void RemoveRoom(NewRoomMemberEN aNewRoomMemberEN)
 {
     this.aListNewRoomMembers.Remove(aNewRoomMemberEN);
 }
 //============== FORM 3 =========
 //Hiennv   25/11/2014
 public void InsertRoom(NewRoomMemberEN aNewRoomMemberEN)
 {
     this.aListNewRoomMembers.Insert(0, aNewRoomMemberEN);
 }
 //Hiennv    Tạo mới     25/11/2014   Load ra toàn bộ danh sách phòng còn trống trong khoảng thời gian tìm kiếm
 public List<NewRoomMemberEN> LoadListAvailableRooms(DateTime fromDate, DateTime toDate)
 {
     try
     {
         ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
         if (this.CheckData() == true)
         {
             aNewBookingEN.aListNewRoomMembers.Clear();
             List<Rooms> aListRooms = aReceptionTaskBO.GetListAvailableRooms(fromDate, toDate, 1).OrderBy(r => r.Sku).ToList(); // 1=IDLang
             NewRoomMemberEN aNewRoomMemberEN;
             for (int i = 0; i < aListRooms.Count; i++)
             {
                 aNewRoomMemberEN = new NewRoomMemberEN();
                 aNewRoomMemberEN.IDBookingRooms = aListRooms[i].ID;
                 aNewRoomMemberEN.RoomCode = aListRooms[i].Code;
                 aNewRoomMemberEN.RoomSku = aListRooms[i].Sku;
                 aNewRoomMemberEN.RoomBed1 = aListRooms[i].Bed1.GetValueOrDefault();
                 aNewRoomMemberEN.RoomBed2 = aListRooms[i].Bed2.GetValueOrDefault();
                 aNewRoomMemberEN.RoomCostRef = aListRooms[i].CostRef.GetValueOrDefault();
                 aNewRoomMemberEN.RoomTypeDisplay = CORE.CONSTANTS.SelectedRoomsType(Convert.ToInt32(aListRooms[i].Type)).Name;
                 this.aListAvaiableRooms.Add(aNewRoomMemberEN);
             }
         }
         return this.aListAvaiableRooms;
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmTsk_BookingForRoom.LoadListAvailableRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return null;
     }
 }
        //Hiennv    Tạo mới     25/11/2014
        private void btnUnSelect_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                NewRoomMemberEN aNewRoomMemberEN = new NewRoomMemberEN();
                aNewRoomMemberEN.RoomCode = viewSelectedRooms.GetFocusedRowCellValue("RoomCode").ToString();
                aNewRoomMemberEN.RoomSku = viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString();
                aNewRoomMemberEN.RoomTypeDisplay = viewSelectedRooms.GetFocusedRowCellValue("RoomTypeDisplay").ToString();
                aNewRoomMemberEN.RoomBed1 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed1"));
                aNewRoomMemberEN.RoomBed2 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed2"));
                aNewRoomMemberEN.RoomCostRef = Convert.ToDecimal(viewSelectedRooms.GetFocusedRowCellValue("RoomCostRef"));

                this.aListAvaiableRooms.Insert(0, aNewRoomMemberEN);
                dgvAvailableRooms.DataSource = aListAvaiableRooms;
                dgvAvailableRooms.RefreshDataSource();

                NewRoomMemberEN Temps = aNewBookingEN.aListNewRoomMembers.Where(p => p.RoomSku == viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString()).ToList()[0];
                this.aNewBookingEN.RemoveRoom(Temps);
                dgvSelectedRooms.DataSource = this.aNewBookingEN.aListNewRoomMembers;
                dgvSelectedRooms.RefreshDataSource();

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_BookingForRoom.btnUnSelect_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //Hiennv    Tạo mới     25/11/2014   Tim ra toàn bộ danh sách phòng còn trống trong khoảng thời gian tìm kiếm
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.CheckData() == true)
                {
                    DateTime From = dtpFrom.DateTime;
                    DateTime To = dtpTo.DateTime;

                    this.aCurrent_CodeRoom = string.Empty;

                    this.aListAvaiableRooms.Clear();
                    dgvAvailableRooms.DataSource = this.LoadListAvailableRooms(From, To);
                    dgvAvailableRooms.RefreshDataSource();

                    this.aNewBookingEN.aListNewRoomMembers.Clear();
                    dgvSelectedRooms.DataSource = this.aNewBookingEN.aListNewRoomMembers;
                    dgvSelectedRooms.RefreshDataSource();

                    List<NewRoomMemberEN> aListNewRoomMemberEN = this.aListAvaiableRooms.Where(p => p.RoomCode == this.aCurrent_CodeRoom).ToList();
                    if (aListNewRoomMemberEN.Count > 0)
                    {
                        this.aListAvaiableRooms.Remove(aListNewRoomMemberEN[0]);
                        dgvAvailableRooms.DataSource = this.aListAvaiableRooms;
                        dgvAvailableRooms.RefreshDataSource();

                        NewRoomMemberEN aNewRoomMemberEN = new NewRoomMemberEN();
                        aNewRoomMemberEN.RoomSku = aListNewRoomMemberEN[0].RoomSku;
                        aNewRoomMemberEN.RoomCode = aListNewRoomMemberEN[0].RoomCode;
                        aNewRoomMemberEN.RoomTypeDisplay = aListNewRoomMemberEN[0].RoomTypeDisplay;
                        aNewRoomMemberEN.RoomBed1 = aListNewRoomMemberEN[0].RoomBed1;
                        aNewRoomMemberEN.RoomBed2 = aListNewRoomMemberEN[0].RoomBed2;
                        aNewRoomMemberEN.RoomCostRef = aListNewRoomMemberEN[0].RoomCostRef;

                        this.aNewBookingEN.InsertRoom(aNewRoomMemberEN);
                        dgvSelectedRooms.DataSource = this.aNewBookingEN.aListNewRoomMembers;
                        dgvSelectedRooms.RefreshDataSource();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_BookingForRoom.btnSearch_Click\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //Hiennv   25/11/2014   load ra danh sach cac phong da duoc chon
        public List<NewRoomMemberEN> LoadListSelectRooms(DateTime fromDate, DateTime toDate)
        {
            try
            {
                if (!String.IsNullOrEmpty(this.aCurrent_CodeRoom))
                {

                    List<NewRoomMemberEN> aListNewRoomMemberEN = this.aListAvaiableRooms.Where(p => p.RoomCode == this.aCurrent_CodeRoom).ToList();
                    if (aListNewRoomMemberEN.Count > 0)
                    {
                        this.aListAvaiableRooms.Remove(aListNewRoomMemberEN[0]);

                        dgvAvailableRooms.DataSource = this.aListAvaiableRooms;
                        dgvAvailableRooms.RefreshDataSource();

                        NewRoomMemberEN aNewRoomMemberEN = new NewRoomMemberEN();
                        aNewRoomMemberEN.RoomSku = aListNewRoomMemberEN[0].RoomSku;
                        aNewRoomMemberEN.RoomCode = aListNewRoomMemberEN[0].RoomCode;
                        aNewRoomMemberEN.RoomTypeDisplay = aListNewRoomMemberEN[0].RoomTypeDisplay;
                        aNewRoomMemberEN.RoomBed1 = aListNewRoomMemberEN[0].RoomBed1;
                        aNewRoomMemberEN.RoomBed2 = aListNewRoomMemberEN[0].RoomBed2;
                        aNewRoomMemberEN.RoomCostRef = aListNewRoomMemberEN[0].RoomCostRef;
                        this.aNewBookingEN.InsertRoom(aNewRoomMemberEN);
                    }
                    return this.aNewBookingEN.aListNewRoomMembers;
                }
                return null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_BookingForRoom.LoadListSelectRooms()\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }