public frmRpt_Performance_Rooms(DateTime From, DateTime To, int IDLang) { InitializeComponent(); this.From = From; this.To = To; this.IDLang = IDLang; lblFrom.Text = From.ToString(); lblTo.Text = To.ToString(); RoomsBO aRoomsBO = new RoomsBO(); ReportTaskBO aReportTaskBO = new ReportTaskBO(); List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(IDLang); List<string> aListCodeRoom = new List<string>(); for (int i = 0; i < aListRooms.Count; i++) { string CodeRoom = aListRooms[i].Code; aListCodeRoom.Add(CodeRoom); } List<EfficiencyEN> aListEfficiencyEN = aReportTaskBO.GetEfficiencyRoom(From, To, aListCodeRoom); //List<EfficiencyEN> List1 = new List<EfficiencyEN>(); //List<EfficiencyEN> List2 = new List<EfficiencyEN>(); //List1 = aListEfficiencyEN.GetRange(0, Convert.ToInt32(Math.Floor(Convert.ToDouble(aListEfficiencyEN.Count / 2)))); //List2 = aListEfficiencyEN.GetRange(Convert.ToInt32(Math.Ceiling(Convert.ToDouble(aListEfficiencyEN.Count / 2))), aListEfficiencyEN.Count); this.DataSource = aListEfficiencyEN; cellSkuRoom.DataBindings.Add("Text", this.DataSource, "Sku"); cellPerformance.DataBindings.Add("Text", this.DataSource, "Efficiency"); double x = aListEfficiencyEN.Select(a => a.Efficiency).Sum(); double y = aListEfficiencyEN.Count; lblPerformance.Text = (Math.Round(x / y, 2)).ToString() + "%"; }
public void LoadDataRevenueRooms(DateTime FromDate,DateTime ToDate) { try { if (FromDate >= ToDate) { MessageBox.Show("Vui lòng nhập ngày bắt đầu kiểm tra nhỏ hơn ngày kết thúc .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReportTaskBO aReportTaskBO = new ReportTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(1); List<string> aListCodeRoom = new List<string>(); for (int i = 0; i < aListRooms.Count; i++) { string CodeRoom = aListRooms[i].Code; aListCodeRoom.Add(CodeRoom); } List<RevenueEN> aListRevenueEN = aReportTaskBO.GetRevenueRoom(this.FromDate,this.ToDate,aListCodeRoom); colRevenue.DisplayFormat.FormatType = FormatType.Numeric; colRevenue.DisplayFormat.FormatString = "{0:0,0}"; dgvRevenue.DataSource = aListRevenueEN; double TotalMoney = aListRevenueEN.Select(r => r.Revenue).Sum(); lblTotalRevenue.Text = String.Format("{0:0,0}", TotalMoney); } } catch (Exception ex) { MessageBox.Show("frmTsk_Calculator_Revenue.LoadDataRevenueRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmRpt_Revenue_Rooms(DateTime From, DateTime To, int IDLang) { InitializeComponent(); this.From = From; this.To = To; this.IDLang = IDLang; try { lblFrom.Text = From.ToString(); lblTo.Text = To.ToString(); ReportTaskBO aReportTaskBO = new ReportTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(IDLang); List<string> aListCodeRoom = new List<string>(); for (int i = 0; i < aListRooms.Count; i++) { string CodeRoom = aListRooms[i].Code; aListCodeRoom.Add(CodeRoom); } List<RevenueEN> aListRevenueEN = aReportTaskBO.GetRevenueRoom(From, To, aListCodeRoom); this.DataSource = aListRevenueEN; cellSkuRoom.DataBindings.Add("Text", this.DataSource, "Sku"); cellRevenue.DataBindings.Add("Text", this.DataSource, "Revenue","{0:0,0}"); double TotalMoney = aListRevenueEN.Select(r => r.Revenue).Sum(); lblRevenue.Text = String.Format("{0:0,0} (VND)",TotalMoney); } catch (Exception ex) { MessageBox.Show("frmRpt_Revenue_Rooms.frmRpt_Revenue_Rooms\n" + ex.ToString()); } }
//public decimal? CalculateCostRoom(NewPaymentEN aNewPaymentEN, int IDBookingRoom, string PriceType) //{ // if (aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == IDBookingRoom).ToList().Count > 0) // { // CustomersBO aCustomersBO = new CustomersBO(); // ExtraCostBO aExtraCostBO = new ExtraCostBO(); // RoomsBO aRoomsBO = new RoomsBO(); // BookingRoomUsedEN aTemp = aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == IDBookingRoom).ToList()[0]; // List<Customers> aListCustomers = aCustomersBO.SelectListCustomer_ByIDBookingRoom(IDBookingRoom); // if (aListCustomers.Count >0 ) // { // int CustomerType = Convert.ToInt32(aNewPaymentEN.CustomerType); // decimal? CostRoom = 0; // //if (aTemp.Cost != 0) // //{ // // CostRoom = aTemp.Cost - Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aTemp.RoomSku, aTemp.PriceType, aTemp.ListCustomer.Count).ExtraValue); // //} // //else // //{ // CostRoom = aRoomsBO.Select_ByIDBookingRoom(IDBookingRoom).CostRef; // //} // string RoomSku = aTemp.RoomSku; // decimal ExtraMoneyRoom = Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(RoomSku, PriceType, aListCustomers.Count).ExtraValue); // return (CostRoom + ExtraMoneyRoom); // } // else // Neu phong k co ai thi tien =0 // { // return 0; // } // } // else // { // return 0; // } //} public decimal? CalculateCostRoom( int IDBookingRoom, string PriceType , int CustomerType, int NumCustomer ) { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); if (aBookingRoomsBO.Select_ByID(IDBookingRoom) != null) { CustomersBO aCustomersBO = new CustomersBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); RoomsBO aRoomsBO = new RoomsBO(); //List<Customers> aListCustomers = aCustomersBO.SelectListCustomer_ByIDBookingRoom(IDBookingRoom); decimal? CostRoom = 0; CostRoom = aRoomsBO.Select_ByIDBookingRoom(IDBookingRoom).CostRef; string RoomSku = aRoomsBO.Select_ByIDBookingRoom(IDBookingRoom).Sku; try { decimal? ExtraMoneyRoom = aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(RoomSku, PriceType, NumCustomer).ExtraValue; return (CostRoom + ExtraMoneyRoom); } catch(Exception w) { MessageBox.Show("Trong dữ liệu giá bảng giá " + PriceType + " của phòng " + RoomSku + " chưa có giá dành cho " + NumCustomer + " người "); return 0; } } else { return 0; } }
//======================================================= //Author: LinhTing //Function : Tính hiệu suất phòng //======================================================= public List<EfficiencyEN> GetEfficiencyRoom(DateTime From, DateTime To, List<string> ListCodeRoom) { try { List<sp_RoomsExt_CalculationEfficiency_Result> aListSP = new List<sp_RoomsExt_CalculationEfficiency_Result>(); double UsedDate = new double(); List<EfficiencyEN> aListEfficiencyEN = new List<EfficiencyEN>(); TimeSpan dis = To.Subtract(From); double TotalDate = dis.TotalDays; RoomsBO aRoomBO = new RoomsBO(); for (int i = 0; i < ListCodeRoom.Count; i++) { EfficiencyEN aEfficiencyEN = new EfficiencyEN(); aListSP = aDatabaseDA.sp_RoomsExt_CalculationEfficiency(ListCodeRoom[i], From, To).ToList(); UsedDate = new double(); UsedDate = double.Parse(aListSP.Select(p => p.RankTime).Sum().ToString()); //ret.Add((UsedDate / TotalDate) * 100); aEfficiencyEN.CodeRoom = ListCodeRoom[i]; Rooms aRooms = aRoomBO.Select_ByCodeRoom(aEfficiencyEN.CodeRoom, 1); aEfficiencyEN.Sku = aRooms.Sku; aEfficiencyEN.Efficiency = Math.Round((UsedDate / TotalDate) * 100, 2); aListEfficiencyEN.Add(aEfficiencyEN); } return aListEfficiencyEN; } catch (Exception ex) { throw new Exception("ReceptionTaskBO.GetEfficiencyRoom \n" + ex.ToString()); } }
public void LoadDataBookingRoom() { try { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); List<BookingRooms> aListTemp = aBookingRoomsBO.Select_ByDateAndCodeRoomAndStaus(DateTime.Now,this.codeRoom,3); //3 = status = da check In BookingRooms aBookingRooms; List<BookingRooms> aListBookingRoom = new List<BookingRooms>(); RoomsBO aRoomsBO = new RoomsBO(); foreach (BookingRooms item in aListTemp) { aBookingRooms = new BookingRooms(); aBookingRooms.ID = item.ID; aBookingRooms.IDBookingR = item.IDBookingR; aBookingRooms.CodeRoom = item.CodeRoom; aBookingRooms.Cost = item.Cost; aBookingRooms.PercentTax = item.PercentTax; aBookingRooms.CostRef_Rooms = item.CostRef_Rooms; aBookingRooms.Note = item.Note; aBookingRooms.CheckInPlan = item.CheckInPlan; aBookingRooms.CheckInActual = item.CheckInActual; aBookingRooms.CheckOutPlan = item.CheckOutPlan; aBookingRooms.CheckOutActual = item.CheckOutActual; aBookingRooms.BookingStatus = item.BookingStatus; aBookingRooms.Status = item.Status; aBookingRooms.StartTime = item.StartTime; aBookingRooms.EndTime = item.EndTime; aBookingRooms.IsAllDayEvent = item.IsAllDayEvent; aBookingRooms.Color = item.Color; aBookingRooms.IsEditable = item.IsEditable; aBookingRooms.IsRecurring = item.IsRecurring; Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1);//1= IDLang //dung tam de hien thi sku aBookingRooms.AdditionalColumn1 = aRooms.Sku; aListBookingRoom.Add(aBookingRooms); } if (String.IsNullOrEmpty(txtSku.Text) == false) { dgvBookingRooms.DataSource = aListBookingRoom.Where(b => b.AdditionalColumn1.Contains(txtSku.Text)).ToList(); } else { dgvBookingRooms.DataSource = aListBookingRoom; } } catch (Exception ex) { MessageBox.Show("frmTsk_PendingRoom_Step1.LoadDataBookingRoom\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(); // 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 LoadDataBookingRoom(int Status) { try { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); List<BookingRooms> aListTemp = aBookingRoomsBO.Select_ByStatus_ByTime(DateTime.Now,Status); BookingRooms aBookingRooms; List<BookingRooms> aListBookingRoom = new List<BookingRooms>(); RoomsBO aRoomsBO = new RoomsBO(); foreach (BookingRooms item in aListTemp) { aBookingRooms = new BookingRooms(); aBookingRooms.ID = item.ID; aBookingRooms.IDBookingR = item.IDBookingR; aBookingRooms.CodeRoom = item.CodeRoom; aBookingRooms.Cost = item.Cost; aBookingRooms.PercentTax = item.PercentTax; aBookingRooms.CostRef_Rooms = item.CostRef_Rooms; //dung tam truong Note de hien thi trang thai phong aBookingRooms.Note = CORE.CONSTANTS.SelectedBookingRoomStatus(item.Status.GetValueOrDefault()).Name; aBookingRooms.CheckInPlan = item.CheckInPlan; aBookingRooms.CheckInActual = item.CheckInActual; aBookingRooms.CheckOutPlan = item.CheckOutPlan; aBookingRooms.CheckOutActual = item.CheckOutActual; aBookingRooms.BookingStatus = item.BookingStatus; aBookingRooms.Status = item.Status; aBookingRooms.StartTime = item.StartTime; aBookingRooms.EndTime = item.EndTime; aBookingRooms.IsAllDayEvent = item.IsAllDayEvent; aBookingRooms.Color = item.Color; aBookingRooms.IsEditable = item.IsEditable; aBookingRooms.IsRecurring = item.IsRecurring; Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1);//1= IDLang //dung tam de hien thi sku aBookingRooms.AdditionalColumn1 = aRooms.Sku; aListBookingRoom.Add(aBookingRooms); } dgvBookingRooms.DataSource = aListBookingRoom; dgvBookingRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_PendingCheckIn_Step1.LoadDataBookingRoom\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List<RoomExtStatusEN> GetListStatusRoom(DateTime now) { RoomsBO aRoomsBO = new RoomsBO(); List<Rooms> aList = aRoomsBO.Select_All().Where(p => p.IDLang == 1).ToList(); List<RoomExtStatusEN> ret = new List<RoomExtStatusEN>(); try { ret = this.GetStatusRoom(aList.Select(p => p.Code).ToList(), now); } catch (Exception e) { throw new Exception("Có lỗi khi lấy trạng thái phòng : " + e.Message.ToString()); } return ret; }
public List<RoomExtStatusEN> GetListStatusRoom(DateTime now) { RoomsBO aRoomsBO = new RoomsBO(); List<Rooms> aList = aRoomsBO.Select_All().Where(p => p.IDLang == 1 && p.Disable == false).ToList(); List<RoomExtStatusEN> ret = new List<RoomExtStatusEN>(); for (int i = 0; i < aList.Count; i++) { try { ret.Add(this.GetStatusRoom(aList[i].ID, now)); } catch (Exception e) { throw new Exception("Có lỗi khi lấy trạng thái phòng " + aList[i].ID.ToString() + "-" + aList[i].Sku + "|" + e.Message.ToString()); } } return ret; }
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); } }
//Hiennv private void frmIns_ExtraCostRooms_Load(object sender, EventArgs e) { try { RoomsBO aRoomsBO = new RoomsBO(); List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(1).Where(r=>r.Disable==false).ToList(); lueSku.Properties.DataSource = aListRooms; lueSku.Properties.DisplayMember = "Sku"; lueSku.Properties.ValueMember = "ID"; lueCustomerType.Properties.DataSource = CORE.CONSTANTS.ListCustomerTypes; lueCustomerType.Properties.DisplayMember = "Name"; lueCustomerType.Properties.ValueMember = "ID"; } catch (Exception ex) { MessageBox.Show("frmIns_ExtraCostRooms.frmIns_ExtraCostRooms_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Author: Tqtrung public List<BookingRoomsEN> GetListRoomsCheckOutPlanInDayAndH(DateTime Checktime, int Status) { try { DateTime Checktime2 = Checktime.AddDays(1); RoomsBO aRoomsBO = new RoomsBO(); List<BookingRooms> aListTemp = aDatabaseDA.BookingRooms.Where(b => b.Status == Status).Where(b => b.CheckOutPlan > Checktime && b.CheckOutPlan < Checktime2).ToList(); List<BookingRooms> alistTemp2 = aDatabaseDA.BookingRooms.Where(c => c.Status == Status).Where(b => b.CheckOutPlan < Checktime).ToList(); List<BookingRoomsEN> aListBookingRoomEN = new List<BookingRoomsEN>(); BookingRoomsEN aBookingRoomEN, aBookingRoomEN2; for (int i = 0; i < aListTemp.Count; i++) { aBookingRoomEN = new BookingRoomsEN(); aBookingRoomEN.SetValue(aListTemp[i]); if (aRoomsBO.Select_ByCodeRoom(aListTemp[i].CodeRoom, 1) != null) { aBookingRoomEN.RoomSku = aRoomsBO.Select_ByCodeRoom(aListTemp[i].CodeRoom, 1).Sku; } aListBookingRoomEN.Add(aBookingRoomEN); } for (int y = 0; y < alistTemp2.Count; y++) { aBookingRoomEN2 = new BookingRoomsEN(); aBookingRoomEN2.SetValue(alistTemp2[y]); if (aRoomsBO.Select_ByCodeRoom(alistTemp2[y].CodeRoom, 1) != null) { aBookingRoomEN2.RoomSku = aRoomsBO.Select_ByCodeRoom(alistTemp2[y].CodeRoom, 1).Sku; } aListBookingRoomEN.Add(aBookingRoomEN2); } return aListBookingRoomEN; } catch (Exception ex) { throw new Exception("BookingRoomsBO.GetListRoomsCheckOutPlanInDayAndH:" + ex.ToString()); } }
public void Reload() { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); RoomsBO aRoomsBO = new RoomsBO(); BookingRoomsEN aBookingRoomsEN = new BookingRoomsEN(); BookingRooms aBookingRooms = aBookingRoomsBO.Select_ByID(IDBookingRoom); aBookingRoomsEN.SetValue(aBookingRooms); aBookingRoomsEN.ID = aBookingRooms.ID; aBookingRoomsEN.RoomSku = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom, 1).Sku; this.lbCurrentRoom.Text = "Phòng số : " + aBookingRoomsEN.RoomSku; aListBookingRoom.Add(aBookingRoomsEN); dgvRooms.DataSource = aListBookingRoom; dgvRooms.RefreshDataSource(); ServicesBO aServicesBO = new ServicesBO(); aListService = aServicesBO.Select_ByType(2); dgvServices.DataSource = aListService; dgvServices.RefreshDataSource(); }
//======================================================= //Author: LinhTN //Function : Xóa Rooms bằng Code //======================================================= private void btnDeleteRoom_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { RoomsBO aRoomsBO = new RoomsBO(); string Code = viewRooms.GetFocusedRowCellValue("Code").ToString(); DialogResult result = MessageBox.Show("Bạn có muốn xóa phòng " + Code + " này không?", "Xóa phòng", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { aRoomsBO.Delete_ByCode(Code); MessageBox.Show("Xóa thành công"); this.ReloadData(); if (this.afrmMain != null) { this.afrmMain.ReloadData(); } } } catch (Exception ex) { MessageBox.Show("frmLst_Rooms.btnDeleteRoom_ButtonClick\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public decimal? CalculateCostRoom(string CodeRoom, string PriceType, int CustomerType, int NumCustomer) { if (NumCustomer > 0) { CustomersBO aCustomersBO = new CustomersBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); RoomsBO aRoomsBO = new RoomsBO(); //List<Customers> aListCustomers = aCustomersBO.SelectListCustomer_ByIDBookingRoom(IDBookingRoom); decimal? CostRoom = 0; Rooms aRooms = aRoomsBO.Select_ByCodeRoom(CodeRoom, 1); CostRoom = aRooms.CostRef; string RoomSku = aRooms.Sku; decimal ExtraMoneyRoom = Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(RoomSku, PriceType, NumCustomer).ExtraValue); return (CostRoom + ExtraMoneyRoom); } else { return 0; } }
//Hiennv Tạo mới 18/11/2014 private void viewSelectedRooms_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { RoomsBO aRoomsBO = new RoomsBO(); this.aCurrent_CodeRoom = Convert.ToString(viewSelectedRooms.GetFocusedRowCellValue("RoomCode")); lblRoomSku.Text = "Phòng số :" + aRoomsBO.Select_ByCodeRoom(this.aCurrent_CodeRoom, 1).Sku; dgvSelectedCustomer.DataSource = null; dgvSelectedCustomer.DataSource = this.aCheckInEN.GetListCustomerByRoomCode(this.aCurrent_CodeRoom); dgvSelectedCustomer.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn.viewSelectedRooms_RowCellClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv public List<RoomExtStatusEN> GetListUsingRooms_ByCode(DateTime Now ,string code) { try { List<RoomExtStatusEN> aListTemp = new List<RoomExtStatusEN>(); RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = new Rooms(); if (String.IsNullOrEmpty(code) == true) { aListTemp = aRoomsBO.GetListStatusRoom(Now).Where(p => p.RoomStatus == 3).ToList(); } else { aListTemp = aRoomsBO.GetListStatusRoom(Now).Where(p => p.RoomStatus == 3).Where(p => p.Code == code).ToList(); } return aListTemp; } catch (Exception ex) { throw new Exception("UsingServiceTask.GetListUsingRooms_ByCode\n" + ex.ToString()); } }
public frmRpt_PersonalPayment(List<RptPaymentStyle1_ForPrint> aListData, string CompanyName, string Address, string NameCustomerGroup, string InvoiceNumber , DateTime FirstDate, DateTime LastDate, decimal? BookingHMoney, decimal? BookingRMoney,int IDBookingR) { InitializeComponent(); //Load dữ liệu BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); RoomsBO aRoomsBO = new RoomsBO(); string RoomSku = ""; string CustomerNames = ""; List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (RoomSku == "") { RoomSku = aBookingRoomUsedEN.RoomSku; } else { RoomSku = RoomSku + " + " + aBookingRoomUsedEN.RoomSku; } foreach (Customers aItem in aBookingRoomUsedEN.ListCustomer) { if (CustomerNames == "") { CustomerNames = aItem.Name; } else { CustomerNames = CustomerNames + " + " + aItem.Name; } } } } decimal MealCharge = 0; decimal DrinkCharge = 0; decimal RoomCharge= 0; decimal RoomServiceCharge= 0; decimal Tel= 0; decimal Laundry = 0; decimal OtherServiceCharge = 0; decimal TotalServiceMoney = 0; decimal TotalMoneyBeforeTax = 0; foreach (RptPaymentStyle1_ForPrint aItem in aListData) { MealCharge = MealCharge + aItem.ServiceGroup8_Fee; DrinkCharge = DrinkCharge + aItem.ServiceGroup7_Fee; RoomCharge = RoomCharge + aItem.Room_Fee; RoomServiceCharge = RoomServiceCharge + aItem.ServiceGroup5_Fee; Tel = Tel + aItem.ServiceGroup2_Fee; Laundry = Laundry + aItem.ServiceGroup3_Fee; OtherServiceCharge = OtherServiceCharge + aItem.ServiceGroup4_Fee + aItem.ServiceGroup5_Fee + aItem.ServiceGroup9_Fee; TotalServiceMoney = TotalServiceMoney + aItem.TotalServiceMoney; TotalMoneyBeforeTax = TotalMoneyBeforeTax + aItem.TotalMoney; } //Hiển thị dữ liệu BookingRs aBookingRs = new BookingRs(); aBookingRs = (new BookingRsBO()).Select_ByID(IDBookingR); lblIDBookingR.Text = IDBookingR.ToString(); lblInvoiceNumber.Text = aBookingRs.InvoiceNumber; lblInvoiceDate.Text = aBookingRs.InvoiceDate.GetValueOrDefault().Date.ToShortDateString(); lbAcceptDate.Text = aBookingRs.AcceptDate.GetValueOrDefault().Date.ToShortDateString(); lblCheckIn.Text = FirstDate.ToString("dd/MM/yyyy"); lblCheckOut.Text = LastDate.ToString("dd/MM/yyyy"); lblCustomerName.Text = CustomerNames; lblRoomSku.Text = RoomSku; lblMealChargeVN.Text = MealCharge.ToString("0,0"); lblDrinkChargeVN.Text = DrinkCharge.ToString("0,0"); lblRoomChargeVN.Text = RoomCharge.ToString("0,0"); lblRoomServiceVN.Text = RoomServiceCharge.ToString("0,0"); lblTelVN.Text = Tel.ToString("0,0"); lblLaundryVN.Text = Laundry.ToString("0,0"); lblOtherServiceVN.Text = OtherServiceCharge.ToString("0,0"); lblServiceChargeVN.Text = TotalServiceMoney.ToString("0,0"); lblTotalBTVN.Text = TotalMoneyBeforeTax.ToString("0,0"); lblTaxVN.Text = (TotalMoneyBeforeTax * 10 / 100).ToString("0,0"); lblMoneyAfterTaxVN.Text = (TotalMoneyBeforeTax * 110 / 100).ToString("0,0"); lblBookingMoneyVN.Text = Convert.ToDecimal(BookingHMoney + BookingHMoney).ToString("0,0"); lblTotalMoneyVN.Text = ((TotalMoneyBeforeTax * 110 / 100) - Convert.ToDecimal(BookingHMoney + BookingHMoney)).ToString("0,0"); string TotalMoney_String = UppercaseFirst(StringUtility.ConvertDecimalToString((TotalMoneyBeforeTax * 110 / 100) - Convert.ToDecimal(BookingHMoney + BookingHMoney))); lblConvertToString.Text = TotalMoney_String; int day = DateTime.Now.Day; int month = DateTime.Now.Month; int year = DateTime.Now.Year; lblDayMonthYear.Text = "Hà nội , ngày " + day.ToString() + " tháng " + month.ToString() + " năm " + year.ToString(); }
// =============================================================================== // Khoi tao doi tuong Payment private void InitData(int IDBookingR, int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = new BookingHs(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); if (this.IDBookingH > 0) { aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } else { BookingRs_BookingHs aItem = (new BookingRs_BookingHsBO()).Select_ByIDBookingR(this.IDBookingR); if (aItem != null) { this.IDBookingH = aItem.IDBookingH.GetValueOrDefault(0); aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } } // Truyen du lieu chung cua NewPayment if (aBookingRs != null) { aNewPaymentEN.IDBookingR = aBookingRs.ID; aNewPaymentEN.IDCustomer = aBookingRs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingRs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingRs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingRs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.PayMenthodR = aBookingRs.PayMenthod; aNewPaymentEN.CreatedDate_BookingR = aBookingRs.CreatedDate; aNewPaymentEN.CustomerType = aBookingRs.CustomerType; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.StatusPay = aBookingRs.StatusPay; aNewPaymentEN.BookingRMoney = aBookingRs.BookingMoney; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.AcceptDate = aBookingRs.AcceptDate; aNewPaymentEN.InvoiceDate = aBookingRs.InvoiceDate; aNewPaymentEN.InvoiceNumber = aBookingRs.InvoiceNumber; // Truyen du lieu cho List BookingRoom cua NewPayment List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(this.IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (item.Status == 8 || item.Status == 7) { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutActual)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutActual) * 24 * 60); } else { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutPlan)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutPlan) * 24 * 60); } decimal? cost = 0; if (item.Cost == null) { cost = item.CostRef_Rooms; aBookingRoomUsedEN.Cost = cost + Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aRooms.Sku, aBookingRoomUsedEN.PriceType, aBookingRoomUsedEN.ListCustomer.Count).ExtraValue); } else { cost = item.Cost; aBookingRoomUsedEN.Cost = cost; } List<ServiceUsedEN> aListServiceRTemp = aReceptionTaskBO.GetListServiceUsedInRoom_ByIDBookingRoom(item.ID); foreach (ServiceUsedEN aTemp in aListServiceRTemp) { aBookingRoomUsedEN.ListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aListIndexTemp.Add(Convert.ToInt32(aBookingRoomUsedEN.IndexSubPayment)); aNewPaymentEN.aListBookingRoomUsed.Add(aBookingRoomUsedEN); } } //==================================================================================================== //==================================================================================================== //==================================================================================================== // Brucelee Thanh sửa ngày 04/06/2015 // //--------------- // Lỗi sai điều kiện câu lệnh if khiến aBookingHs truyền dữ liệu CustomerType sai cho NewPaymentEN //--------------- // Ban đầu : if (aBookingHs != null) //------------------------------------- if (aBookingHs.ID > 0) { aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment)); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentEN.ListIndex = aListIndexTemp.Distinct().ToList(); } }
public List<RoomServiceInfoEN> Select_Service_ByCodeRoom_ByStatus(string Code, DateTime now,int Status) { try { string Sku = string.Empty; RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(Code,1); if(aRooms !=null) { Sku = aRooms.Sku; } int IDBookingRoom=0; BookingRsBO aBookingRsBO = new BookingRsBO(); List<BookingRooms> aListBookingRooms =aDatabaseDA.BookingRooms.Where(p => p.CodeRoom == Code && p.CheckInActual < now && p.CheckOutActual > now && (p.Status == 3 || p.Status == 7)).ToList(); if(aListBookingRooms.Count > 0) { IDBookingRoom = aListBookingRooms[0].ID; } List<RoomServiceInfoEN> alist = aDatabaseDA.vw__BookingRooms_ServicesInfo__BookingRooms_BookingRoomsServices_Services_ServiceGroups .Where(p => p.BookingRooms_Services_IDBookingRoom == IDBookingRoom && p.BookingRooms_Services_Status !=Status) .Select(p => new RoomServiceInfoEN { IDBookingRooms = IDBookingRoom, IDBookingRs = p.BookingRooms_IDBookingR, CodeRoom = Code, Sku = Sku, ID = p.BookingRooms_Services_ID, Date = p.BookingRooms_Services_Date, IDService=p.Services_ID, ServiceName = p.Services_Name, IDServiceGroup=p.ServiceGroups_ID, Quantity = p.BookingRooms_Services_Quantity, CostRef = p.Services_CostRef, Unit = p.Services_Unit, Cost = p.BookingRooms_Services_Cost, PercentTax = p.BookingRooms_Services_PercentTax, Status=p.BookingRooms_Services_Status }).ToList(); return alist; } catch (Exception ex) { throw new Exception("BookingRooms_ServicesBO.Sel_Service_BySku\n" + ex.ToString()); } }
private void frmTsk_PendingCheckIn_Step2_Load(object sender, EventArgs e) { try { BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); lblIDBookingR.Text = aBookingRs.ID.ToString(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); lblNameCustomerGroup.Text = aCustomerGroups.Name; CompaniesBO aCompaniesBO = new CompaniesBO(); Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); lblNameCompany.Text = aCompanies.Name; CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); lblNameCustomer.Text = aCustomers.Name; RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(CodeRoom, 1);//1=IDLang lblSku.Text = aRooms.Sku; dtpTo.DateTime = CheckOutPlan; dtpFrom.DateTime = DateTime.Now; dtpFrom.Enabled = false; dtpFrom.Properties.ReadOnly = true; } catch (Exception ex) { MessageBox.Show("frmTsk_PendingCheckIn_Step2.frmTsk_PendingCheckIn_Step2_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnCheckIn_Click(object sender, EventArgs e) { try { if (dtpFrom.DateTime < dtpTo.DateTime) { if (this.Status == 2) { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); //cap nhat bookingroom BookingRooms aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRoom); //aBookingRooms.CheckInPlan = DateTime.Now; //aBookingRooms.CheckInActual = DateTime.Now; aBookingRooms.CheckInPlan = dtpFrom.DateTime; aBookingRooms.CheckInActual = dtpFrom.DateTime; aBookingRooms.CheckOutPlan = dtpTo.DateTime; aBookingRooms.CheckOutActual = dtpTo.DateTime; //aBookingRooms.PriceType = "G1"; aBookingRooms.Status = 3;// 3= Da check in aBookingRoomsBO.Update(aBookingRooms); if (this.afrmTsk_PendingCheckIn_Step1 != null) { this.afrmTsk_PendingCheckIn_Step1.LoadDataBookingRoom(this.Status); if (this.afrmTsk_PendingCheckIn_Step1.afrmMain != null) { this.afrmTsk_PendingCheckIn_Step1.afrmMain.ReloadData(); } } MessageBox.Show("Thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else if (this.Status == 5) { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); RoomsBO aRoomsBO = new RoomsBO(); AccountancyBO aAccountancyBO = new AccountancyBO(); //Check out giai doan pending aAccountancyBO.CheckOut(this.IDBookingRoom, dtpFrom.DateTime); //them moi mot bookingroom BookingRooms aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRoom); BookingRooms aBookingRoomsAddNew = new BookingRooms(); aBookingRoomsAddNew.IDBookingR = IDBookingR; aBookingRoomsAddNew.CodeRoom = CodeRoom; aBookingRoomsAddNew.PercentTax = aBookingRooms.PercentTax; aBookingRoomsAddNew.CostRef_Rooms = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom, 1).CostRef; aBookingRoomsAddNew.Note = aBookingRooms.Note; aBookingRoomsAddNew.CheckInPlan = dtpFrom.DateTime; aBookingRoomsAddNew.CheckInActual = dtpFrom.DateTime; aBookingRoomsAddNew.CheckOutPlan = dtpTo.DateTime; aBookingRoomsAddNew.CheckOutActual = dtpTo.DateTime; aBookingRoomsAddNew.PriceType = aBookingRooms.PriceType; aBookingRoomsAddNew.Type = 1; aBookingRoomsAddNew.BookingStatus = aBookingRooms.BookingStatus; aBookingRoomsAddNew.Status = 3;// 3 = Da CheckIn aBookingRoomsAddNew.StartTime = aBookingRooms.StartTime; aBookingRoomsAddNew.EndTime = aBookingRooms.EndTime; aBookingRoomsAddNew.IsAllDayEvent = aBookingRooms.IsAllDayEvent; aBookingRoomsAddNew.Color = aBookingRooms.Color; aBookingRoomsAddNew.IsRecurring = aBookingRooms.IsRecurring; aBookingRoomsAddNew.IsEditable = aBookingRooms.IsEditable; aBookingRoomsAddNew.AdditionalColumn1 = aBookingRooms.AdditionalColumn1; int ID = aBookingRoomsBO.Insert(aBookingRoomsAddNew); if (ID > 0) { BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); List<BookingRoomsMembers> aListBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom(this.IDBookingRoom); BookingRoomsMembers aBookingRoomsMembers; foreach (BookingRoomsMembers item1 in aListBookingRoomsMembers) { aBookingRoomsMembers = new BookingRoomsMembers(); aBookingRoomsMembers.IDBookingRoom = ID; aBookingRoomsMembers.IDCustomer = item1.IDCustomer; aBookingRoomsMembers.PurposeComeVietnam = item1.PurposeComeVietnam; aBookingRoomsMembers.DateEnterCountry = item1.DateEnterCountry; aBookingRoomsMembers.EnterGate = item1.EnterGate; aBookingRoomsMembers.TemporaryResidenceDate = item1.TemporaryResidenceDate; aBookingRoomsMembers.LimitDateEnterCountry = item1.LimitDateEnterCountry; aBookingRoomsMembers.Organization = item1.Organization; aBookingRoomsMembers.LeaveDate = item1.LeaveDate; aBookingRoomsMembersBO.Insert(aBookingRoomsMembers); } } if (this.afrmTsk_PendingCheckIn_Step1 != null) { this.afrmTsk_PendingCheckIn_Step1.LoadDataBookingRoom(Status); if (this.afrmTsk_PendingCheckIn_Step1.afrmMain != null) { this.afrmTsk_PendingCheckIn_Step1.afrmMain.ReloadData(); } } MessageBox.Show("Thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("Ngày giờ không hợp lệ"); } } catch (Exception ex) { MessageBox.Show("frmTsk_PendingCheckIn_Step2.btnCheckIn_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Hiennv tạo mới 18/11/2014 private void frmTsk_CheckIn_Load(object sender, EventArgs e) { try { if (this.customerType == 1) { chkCustomerType.Visible = true; txtNameCompany.Visible = true; } else if (this.customerType == 2) { chkCustomerType.Visible = false; txtNameCompany.Visible = true; } else { chkCustomerType.Visible = false; txtNameCompany.Visible = false; } ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); dtpFrom.DateTime = DateTime.Now; dtpTo.DateTime = aReceptionTaskBO.SetDateValueDefault(DateTime.Now.AddDays(1)); dgvAvailableRooms.DataSource = this.LoadListAvailableRooms(dtpFrom.DateTime, dtpTo.DateTime); dgvAvailableRooms.RefreshDataSource(); dgvSelectedRooms.DataSource = this.LoadListSelectRooms(dtpFrom.DateTime, dtpTo.DateTime); dgvSelectedRooms.RefreshDataSource(); this.LoadAllListCustomers(); lueIDCompanies.Properties.DataSource = this.LoadListCompaniesByType(this.customerType); lueIDCompanies.Properties.ValueMember = "ID"; lueIDCompanies.Properties.DisplayMember = "Name"; if (this.customerType == 3) // khach le { if (this.LoadListCompaniesByType(this.customerType).Count > 0) { lueIDCompanies.EditValue = this.LoadListCompaniesByType(this.customerType)[0].ID; } } lueGender.Properties.DataSource = CORE.CONSTANTS.ListGenders;//Load Gioi tinh lueGender.Properties.DisplayMember = "Name"; lueGender.Properties.ValueMember = "ID"; lueGender.EditValue = CORE.CONSTANTS.SelectedGender(1).ID; lueNationality.Properties.DataSource = CORE.CONSTANTS.ListCountries;//Load Country lueNationality.Properties.DisplayMember = "Name"; lueNationality.Properties.ValueMember = "Code"; lueNationality.EditValue = CORE.CONSTANTS.SelectedCountry(704).Code; lueCitizen.Properties.DataSource = CORE.CONSTANTS.ListCitizens;//Load Citizen lueCitizen.Properties.DisplayMember = "Name"; lueCitizen.Properties.ValueMember = "ID"; lueCitizen.EditValue = CORE.CONSTANTS.SelectedCitizen(2).ID; if (!String.IsNullOrEmpty(this.aCurrent_CodeRoom)) { RoomsBO aRoomsBO = new RoomsBO(); lblRoomSku.Text = "Phòng số :" + aRoomsBO.Select_ByCodeRoom(this.aCurrent_CodeRoom, 1).Sku; } } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn.frmTsk_CheckIn_Group_Step1_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Hiennv Tạo mới 18/11/2014 private void btnSelect_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { RoomMemberEN aRoomMemberEN = new RoomMemberEN(); aRoomMemberEN.RoomSku = viewAvailableRooms.GetFocusedRowCellValue("RoomSku").ToString(); aRoomMemberEN.RoomCode = viewAvailableRooms.GetFocusedRowCellValue("RoomCode").ToString(); aRoomMemberEN.RoomTypeDisplay = viewAvailableRooms.GetFocusedRowCellValue("RoomTypeDisplay").ToString(); aRoomMemberEN.RoomBed1 = Convert.ToInt32(viewAvailableRooms.GetFocusedRowCellValue("RoomBed1").ToString()); aRoomMemberEN.RoomBed2 = Convert.ToInt32(viewAvailableRooms.GetFocusedRowCellValue("RoomBed2").ToString()); aRoomMemberEN.RoomCostRef = Convert.ToDecimal(viewAvailableRooms.GetFocusedRowCellValue("RoomCostRef").ToString()); this.aCheckInEN.InsertRoom(aRoomMemberEN); dgvSelectedRooms.DataSource = this.aCheckInEN.aListRoomMembers; dgvSelectedRooms.RefreshDataSource(); RoomMemberEN Temps = aListAvaiableRooms.Where(p => p.RoomSku == viewAvailableRooms.GetFocusedRowCellValue("RoomSku").ToString()).ToList()[0]; this.aListAvaiableRooms.Remove(Temps); dgvAvailableRooms.DataSource = this.aListAvaiableRooms; dgvAvailableRooms.RefreshDataSource(); RoomsBO aRoomsBO = new RoomsBO(); this.aCurrent_CodeRoom = aRoomMemberEN.RoomCode; lblRoomSku.Text = "Phòng số :" + aRoomsBO.Select_ByCodeRoom(this.aCurrent_CodeRoom, 1).Sku; dgvSelectedCustomer.DataSource = null; dgvSelectedCustomer.DataSource = this.aCheckInEN.GetListCustomerByRoomCode(this.aCurrent_CodeRoom); dgvSelectedCustomer.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn.btnSelect_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//======================================================= //Author: LinhTN //Function : ReLoad Rooms //======================================================= public void ReloadData() { RoomsBO aRoomsBO = new RoomsBO(); dgvRooms.DataSource = aRoomsBO.Select_ByIDLang(1); dgvRooms.RefreshDataSource(); }
//Hiennv private void chkDisable_Click(object sender, EventArgs e) { try { int ID = Convert.ToInt32(viewRooms.GetFocusedRowCellValue("ID")); bool disableOld = Convert.ToBoolean(viewRooms.GetFocusedRowCellValue("Disable")); bool disalbeNew = false; string disable = string.Empty; if (disableOld == false) { disalbeNew = true; disable = "Khóa"; } else { disalbeNew = false; disable = "Mở"; } DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn " + disable + " phòng này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByID(ID); if (aRooms != null) { aRooms.Disable = disalbeNew; int count = aRoomsBO.Update(aRooms); if (count > 0) { this.ReloadData(); if (this.afrmMain != null) { this.afrmMain.ReloadData(); } MessageBox.Show("Thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception ex) { MessageBox.Show("frmLst_Rooms.chkDisable_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmTsk_CheckOut_Load(object sender, EventArgs e) { List<BookingRooms> aListTemp = new List<BookingRooms>(); if (aIDBookingRoom_Old == -1) { aListTemp.Clear(); // aListTemp = aBookingRoomsBO.Select_ByStatus_ByTime(DateTime.Now, Status); aListTemp = aBookingRoomsBO.Select_ByStatus(Status); } else { aListTemp.Clear(); aListTemp.Add(aBookingRoomsBO.Select_ByID(aIDBookingRoom_Old)); } RoomsBO aRoomsBO = new RoomsBO(); this.aListRooms = aRoomsBO.Select_All(); dgvBookingRooms.DataSource = this.GetListBookingRooms(aListTemp, this.aListRooms); dgvBookingRooms.RefreshDataSource(); }
public List<RoomExtStatusEN> GetListUsingRooms(DateTime Now) { try { List<RoomExtStatusEN> aListTemp = new List<RoomExtStatusEN>(); RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = new Rooms(); aListTemp = aRoomsBO.GetListStatusRoom(Now).Where(p => p.RoomStatus == 3).ToList(); return aListTemp; } catch (Exception ex) { throw new Exception("UsingServiceTask.GetListUsingRooms\n" + ex.ToString()); } }
public RoomExtStatusEN GetStatusRoom(int IDRoom, DateTime now) { List<sp_RoomExt_GetCurrentStatusRooms_ByIDRoom_ByTime_Result> aList = this.aDatabaseDA.sp_RoomExt_GetCurrentStatusRooms_ByIDRoom_ByTime(IDRoom, now).ToList(); RoomExtStatusEN aRoomExtStatusEN = new RoomExtStatusEN(); if (aList.Count > 0) { for (int i = 0; i < aList.Count; i++) { aRoomExtStatusEN = new RoomExtStatusEN(); aRoomExtStatusEN.ID = aList[i].ID; aRoomExtStatusEN.Bed1 = aList[i].Bed1; aRoomExtStatusEN.Bed2 = aList[i].Bed2; aRoomExtStatusEN.CostRef = aList[i].CostRef; aRoomExtStatusEN.Code = aList[i].Code; aRoomExtStatusEN.Sku = aList[i].Sku; aRoomExtStatusEN.Note = aList[i].Note; aRoomExtStatusEN.Type = aList[i].Type; aRoomExtStatusEN.BookingRooms_ID = aList[i].BookingRooms_ID; aRoomExtStatusEN.BookingRs_BookingMoney = aList[i].BookingRs_BookingMoney; aRoomExtStatusEN.BookingRs_CustomerType = aList[i].BookingRs_CustomerType; aRoomExtStatusEN.BookingRs_ID = aList[i].BookingRs_ID; aRoomExtStatusEN.BookingRs_Subject = aList[i].BookingRs_Subject; aRoomExtStatusEN.CheckInActual = aList[i].CheckInActual; aRoomExtStatusEN.CheckInPlan = aList[i].CheckInPlan; aRoomExtStatusEN.CheckOutActual = aList[i].CheckOutActual; aRoomExtStatusEN.CheckOutPlan = aList[i].CheckOutPlan; aRoomExtStatusEN.Color = aList[i].Color; aRoomExtStatusEN.Companies_Name = aList[i].Companies_Name; aRoomExtStatusEN.CostRef = aList[i].CostRef; aRoomExtStatusEN.CustomerGroups_Name = aList[i].CustomerGroups_Name; aRoomExtStatusEN.Customers_Address = aList[i].Customers_Address; aRoomExtStatusEN.Customers_Name = aList[i].Customers_Name; aRoomExtStatusEN.Customers_Nationality = aList[i].Customers_Nationality; aRoomExtStatusEN.Customers_Tel = aList[i].Customers_Tel; aRoomExtStatusEN.Companies_ID = aList[i].Companies_ID; aRoomExtStatusEN.CustomerGroups_ID = aList[i].CustomerGroups_ID; aRoomExtStatusEN.Customers_ID = aList[i].Customers_ID; if (aList[i].BookingRooms_Status == 1) { aRoomExtStatusEN.RoomStatus = 1; } else if (aList[i].BookingRooms_Status == 2) { aRoomExtStatusEN.RoomStatus = 2; } else if (aList[i].BookingRooms_Status == 3) { aRoomExtStatusEN.RoomStatus = 3; } else if (aList[i].BookingRooms_Status == 5) { aRoomExtStatusEN.RoomStatus = 5; } else if ((aList[i].BookingRooms_Status == 6) || (aList[i].BookingRooms_Status == 7) || (aList[i].BookingRooms_Status == 8)) { aRoomExtStatusEN.RoomStatus = 0; } } return aRoomExtStatusEN; } else { RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByID(IDRoom); if (aRooms != null) { aRoomExtStatusEN = new RoomExtStatusEN(); aRoomExtStatusEN.RoomStatus = 0; aRoomExtStatusEN.Code = aRooms.Code; aRoomExtStatusEN.Sku = aRooms.Sku; aRoomExtStatusEN.Bed1 = aRooms.Bed1; aRoomExtStatusEN.Bed2 = aRooms.Bed2; aRoomExtStatusEN.Type = aRooms.Type; } else { throw new Exception("Phòng cần check trạng thái không tồn tại"); } return aRoomExtStatusEN; } }