public void LoadListAvailableRooms(DateTime fromDate, DateTime toDate) { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (this.CheckData() == true) { this.aCheckInEN.aListRoomMembers.Clear(); dgvSelectedRooms.DataSource = null; aListTemp = aReceptionTaskBO.GetListAvailableRooms(fromDate, toDate, 1).OrderBy(r => r.Sku).ToList(); // 1=IDLang RoomsEN aRoomEN; for (int i = 0; i < aListTemp.Count; i++) { aRoomEN = new RoomsEN(); aRoomEN.ID = aListTemp[i].ID; aRoomEN.Code = aListTemp[i].Code; aRoomEN.Sku = aListTemp[i].Sku; aRoomEN.Image = aListTemp[i].Image; aRoomEN.Bed1 = aListTemp[i].Bed1; aRoomEN.Bed2 = aListTemp[i].Bed2; aRoomEN.CostRef = aListTemp[i].CostRef; aRoomEN.CostUnit = aListTemp[i].CostUnit; aRoomEN.Info = aListTemp[i].Info; aRoomEN.Intro = aListTemp[i].Intro; aRoomEN.Disable = aListTemp[i].Disable; aRoomEN.IDLang = aListTemp[i].IDLang; aRoomEN.TypeDisplay = CORE.CONSTANTS.SelectedRoomsType(Convert.ToInt32(aListTemp[i].Type)).Name; this.aListAvaiableRooms.Add(aRoomEN); } dgvAvailableRooms.DataSource = aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); } } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn_Customer_Step1.LoadListAvailableRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRemoveSelectedRooms_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { RoomsEN aRoomEN = new RoomsEN(); //aRoomEN.ID = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("ID")); aRoomEN.Code = viewSelectedRooms.GetFocusedRowCellValue("RoomCode").ToString(); aRoomEN.Sku = viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString(); aRoomEN.TypeDisplay = viewSelectedRooms.GetFocusedRowCellValue("RoomTypeDisplay").ToString(); aRoomEN.Bed1 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed1")); aRoomEN.Bed2 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed2")); aRoomEN.CostRef = Convert.ToDecimal(viewSelectedRooms.GetFocusedRowCellValue("RoomCostRef")); aListAvaiableRooms.Insert(0, aRoomEN); dgvAvailableRooms.DataSource = aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); RoomMemberEN Temps = aCheckInEN.aListRoomMembers.Where(p => p.RoomSku == viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString()).ToList()[0]; aCheckInEN.aListRoomMembers.Remove(Temps); dgvSelectedRooms.DataSource = aCheckInEN.aListRoomMembers; dgvSelectedRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn_Group_Step1.btnRemoveSelectedRooms_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv private void btnRemoveSelectedRooms_ButtonClick(object sender, ButtonPressedEventArgs e) { try { RoomsEN aRoomEN = new RoomsEN(); aRoomEN.Code = viewSelectedRooms.GetFocusedRowCellValue("RoomCode").ToString(); aRoomEN.Sku = viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString(); aRoomEN.TypeDisplay = viewSelectedRooms.GetFocusedRowCellValue("RoomTypeDisplay").ToString(); aRoomEN.Bed1 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed1")); aRoomEN.Bed2 = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("RoomBed2")); aRoomEN.CostRef = Convert.ToDecimal(viewSelectedRooms.GetFocusedRowCellValue("RoomCostRef")); this.aListAvaiableRooms.Insert(0, aRoomEN); dgvAvailableRooms.DataSource = this.aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); int ID = Convert.ToInt32(viewSelectedRooms.GetFocusedRowCellValue("IDBookingRooms")); BookingRooms aBookingRooms = aBookingRoomsBO.Select_ByID(ID); if (aBookingRooms != null) { aBookingRoomsBO.Delete(aBookingRooms.ID); } RoomMemberEN Temps = aCheckInRoomBookingEN.aListRoomMembers.Where(p => p.RoomSku == viewSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString()).ToList()[0]; this.aCheckInRoomBookingEN.aListRoomMembers.Remove(Temps); dgvSelectedRooms.DataSource = aCheckInRoomBookingEN.aListRoomMembers; dgvSelectedRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckInGoverment_ForRoomBooking_Step1.btnRemoveSelectedRooms_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUnFill_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { RoomsEN aRoomEN = new RoomsEN(); aRoomEN.Sku = grvSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString(); aRoomEN.Code = grvSelectedRooms.GetFocusedRowCellValue("RoomCode").ToString(); aRoomEN.TypeDisplay = Convert.ToString(grvSelectedRooms.GetFocusedRowCellValue("RoomTypeDisplay")); aRoomEN.Bed1 = Convert.ToInt32(grvSelectedRooms.GetFocusedRowCellValue("RoomBed1")); aRoomEN.Bed2 = Convert.ToInt32(grvSelectedRooms.GetFocusedRowCellValue("RoomBed2")); aRoomEN.CostRef = Convert.ToDecimal(grvSelectedRooms.GetFocusedRowCellValue("RoomCostRef")); this.aListAvaiableRooms.Insert(0, aRoomEN); dgvAvailableRooms.DataSource = this.aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); RoomMemberEN aRoomMemberEN = this.aCheckInEN.aListRoomMembers.Where(p => p.RoomSku == grvSelectedRooms.GetFocusedRowCellValue("RoomSku").ToString()).ToList()[0]; this.aCheckInEN.aListRoomMembers.Remove(aRoomMemberEN); dgvSelectedRooms.DataSource = this.aCheckInEN.aListRoomMembers; dgvSelectedRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("Check In Step 1 - Khách lẻ - Bỏ chọn " + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSelect_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { RoomsEN aRoomEN = new RoomsEN(); aRoomEN.Code = Convert.ToString(viewAvailableRooms.GetFocusedRowCellValue("Code")); aRoomEN.Sku = Convert.ToString(viewAvailableRooms.GetFocusedRowCellValue("Sku")); aRoomEN.Type = Convert.ToInt32(viewAvailableRooms.GetFocusedRowCellValue("Type")); aRoomEN.TypeDisplay = Convert.ToString(viewAvailableRooms.GetFocusedRowCellValue("TypeDisplay")); aRoomEN.Bed1 = Convert.ToInt32(viewAvailableRooms.GetFocusedRowCellValue("Bed1")); aRoomEN.Bed2 = Convert.ToInt32(viewAvailableRooms.GetFocusedRowCellValue("Bed2")); aRoomEN.CostRef = Convert.ToDecimal(viewAvailableRooms.GetFocusedRowCellValue("CostRef")); aBookingEN.aListRoomsEN.Insert(aBookingEN.aListRoomsEN.Count, aRoomEN); dgvSelectedRooms.DataSource = aBookingEN.aListRoomsEN; dgvSelectedRooms.RefreshDataSource(); RoomsEN Temps = aListAvaiableRooms.Where(p => p.Sku == viewAvailableRooms.GetFocusedRowCellValue("Sku").ToString()).ToList()[0]; aListAvaiableRooms.Remove(Temps); dgvAvailableRooms.DataSource = aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_Booking_Step1.btnSelect_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }