//Hiennv Tạo mới 18/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<RoomMemberEN> LoadListAvailableRooms(DateTime fromDate, DateTime toDate) { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (this.CheckData() == true) { aCheckInEN.aListRoomMembers.Clear(); List<Rooms> aListRooms = aReceptionTaskBO.GetListAvailableRooms(fromDate, toDate, 1).OrderBy(r => r.Sku).ToList(); // 1=IDLang RoomMemberEN aRoomMemberEN; for (int i = 0; i < aListRooms.Count; i++) { aRoomMemberEN = new RoomMemberEN(); aRoomMemberEN.IDBookingRooms = aListRooms[i].ID; aRoomMemberEN.RoomCode = aListRooms[i].Code; aRoomMemberEN.RoomSku = aListRooms[i].Sku; aRoomMemberEN.RoomBed1 = aListRooms[i].Bed1.GetValueOrDefault(); aRoomMemberEN.RoomBed2 = aListRooms[i].Bed2.GetValueOrDefault(); aRoomMemberEN.RoomCostRef = aListRooms[i].CostRef.GetValueOrDefault(); aRoomMemberEN.RoomTypeDisplay = CORE.CONSTANTS.SelectedRoomsType(Convert.ToInt32(aListRooms[i].Type)).Name; this.aListAvaiableRooms.Add(aRoomMemberEN); } } return this.aListAvaiableRooms; } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn.LoadListAvailableRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } }
public frmRpt_UnSelectMenus(int IDBookingHall) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; this.LoadMenus(); //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
//hiennv public void GetListSelectRooms(int IDBookingR) { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); RoomMemberEN aRoomMemberEN; List<RoomsEN> aListTempRooms = aReceptionTaskBO.GetListRooms_ByIDBookingR(IDBookingR); foreach (RoomsEN aRooms in aListTempRooms) { aRoomMemberEN = new RoomMemberEN(); aRoomMemberEN.IDBookingRooms = aRooms.IDBookingRooms; aRoomMemberEN.RoomSku = aRooms.Sku; aRoomMemberEN.RoomCode = aRooms.Code; aRoomMemberEN.RoomType = Convert.ToInt32(aRooms.Type); aRoomMemberEN.RoomBed1 = Convert.ToInt32(aRooms.Bed1); aRoomMemberEN.RoomBed2 = Convert.ToInt32(aRooms.Bed2); aRoomMemberEN.RoomCostRef = Convert.ToDecimal(aRooms.CostRef); aRoomMemberEN.RoomTypeDisplay = CORE.CONSTANTS.SelectedRoomsType(Convert.ToInt32(aRooms.Type)).Name; this.aCheckInRoomBookingEN.aListRoomMembers.Add(aRoomMemberEN); } dgvSelectedRooms.DataSource = this.aCheckInRoomBookingEN.aListRoomMembers; dgvSelectedRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckInGoverment_ForRoomBooking_Step1.GetListSelectRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Hiennv public List<ContractsEN> LoadListContractsExpiring(DateTime dateChoose) { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); List<ContractsEN> aListTemp = aReceptionTaskBO.GetListContractsExpiring(dateChoose); List<ContractsEN> aListContractsEN = new List<ContractsEN>(); ContractsEN aContractsEN; foreach (ContractsEN item in aListTemp) { aContractsEN = new ContractsEN(); aContractsEN.ID = item.ID; aContractsEN.CreatedDate = item.CreatedDate; aContractsEN.ContractDate = item.ContractDate; aContractsEN.NumberContract = item.NumberContract; aContractsEN.NumberTemplateContract = item.NumberTemplateContract; aContractsEN.IDSystemUser = item.IDSystemUser; aContractsEN.Company = item.Company; aContractsEN.StatutoryRepresent = item.StatutoryRepresent; aContractsEN.StatutoryRepresentGender = item.StatutoryRepresentGender; aContractsEN.StatutoryRepresentIdentifier = item.StatutoryRepresentIdentifier; aContractsEN.ContractType = item.ContractType; if (item.ContractType > 0) { aContractsEN.DisplayContractType = CORE.CONSTANTS.SelectedContractType(Convert.ToInt32(item.ContractType)).Name; } aContractsEN.FromDate = item.FromDate; aContractsEN.ToDate = item.ToDate; aContractsEN.SkuTableSalary = item.SkuTableSalary; aContractsEN.Coefficent = item.Coefficent; aContractsEN.SalaryNet = item.SalaryNet; aContractsEN.SalaryCross = item.SalaryCross; aContractsEN.Type = item.Type; aContractsEN.Status = item.Status; aContractsEN.Disable = item.Disable; aContractsEN.Name = item.Name; aContractsEN.Birthday = item.Birthday; aContractsEN.Identifier1 = item.Identifier1; aContractsEN.Phone = item.Phone; aContractsEN.Gender = item.Gender; if (item.Gender > 0) { aContractsEN.DisplayGender = CORE.CONSTANTS.SelectedGender(Convert.ToInt32(item.Gender)).Name; } aListContractsEN.Add(aContractsEN); } return aListContractsEN; } catch (Exception ex) { return null; MessageBox.Show("frmMain.LoadListContractExpiring\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmRpt_SplitPayment_BookingHs(PaymentHallsEN aPaymentHallsEN, int indexSub) { InitializeComponent(); this.aPaymentHallsEN = aPaymentHallsEN; this.indexSub = indexSub; try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); ServicesBO aServicesBO = new ServicesBO(); List<HallsEN> aListHallsEN = new List<HallsEN>(); aListHallsEN=this.aPaymentHallsEN.GetListHallsEN().Where(r => r.IndexSubHalls == this.indexSub).OrderBy(r => r.Sku).ToList(); totalMoneyHall = aListHallsEN.Sum(s => s.TotalCost); List<ServicesHallsEN> aListServicesHallsEN = new List<ServicesHallsEN>(); aListServicesHallsEN=this.aPaymentHallsEN.GetListServicesHallsEN().Where(r => r.IndexSubServices == this.indexSub).OrderBy(r => r.SkuHall).ToList(); totalMoneyService = aListServicesHallsEN.Sum(s => s.Total); lblCompany.Text = this.aPaymentHallsEN.NameCompany; lblGroup.Text =this.aPaymentHallsEN.NameCustomerGroup; lblNameCustomer.Text =this.aPaymentHallsEN.NameCustomer; lblIDBookingH.Text = Convert.ToString(this.aPaymentHallsEN.IDBookingH); //danh sach hoi truong this.DetailReportHall.DataSource = aListHallsEN; colSkuHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Sku"); colCreateDate.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Date", "{0:dd/MM/yyyy}"); colBookingHallCost.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Cost", "{0:0,0}"); colPercentTax.DataBindings.Add("Text", this.DetailReportHall.DataSource, "PercentTax"); colPaymentMoneyHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "TotalMoney", "{0:0,0}"); //danh sach dich vu su dung this.DetailReportService.DataSource = aListServicesHallsEN; colService_Sku.DataBindings.Add("Text", this.DetailReportService.DataSource, "SkuHall"); colService_Name.DataBindings.Add("Text", this.DetailReportService.DataSource, "NameService"); colService_Date.DataBindings.Add("Text", this.DetailReportService.DataSource, "Date", "{0:dd/MM/yyyy}"); colService_Quantity.DataBindings.Add("Text", this.DetailReportService.DataSource, "Quantity", "{0:0,0}"); colService_Cost.DataBindings.Add("Text", this.DetailReportService.DataSource, "Cost", "{0:0,0}"); colService_PercentTax.DataBindings.Add("Text", this.DetailReportService.DataSource, "PercentTax"); colService_Money.DataBindings.Add("Text", this.DetailReportService.DataSource, "Total", "{0:0,0}"); //tong tien dich vu lblTotalMoneyServices.Text = String.Format("{0:0,0} (VND)",this.totalMoneyService); //tong tien hoi truong lblTotalMoneyHall.Text = String.Format("{0:0,0} (VND)",this.totalMoneyHall); //tong tien lblTotalMoney.Text = String.Format("{0:0,0}",aPaymentHallsEN.GetTotalMoneyBookingHBehindTax()); lblBookingMoney.Text = String.Format("{0:0,0}",this.aPaymentHallsEN.GetBookingMoney()); lblMoney.Text = String.Format("{0:0,0}", (aPaymentHallsEN.GetTotalMoneyBookingHBehindTax() - this.aPaymentHallsEN.GetBookingMoney())); } catch (Exception ex) { MessageBox.Show("frmRpt_PaymentBookingHs.frmRpt_PaymentBookingHs\n" + ex.ToString()); } }
public frmRpt_UnSelectMenus(int IDBookingHall,int IDMenu) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; // Load Menu Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); Menus aMenus = aMenusBO.Select_ByID(IDMenu); if (aMenus != null) { List<Foods> aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(aMenus.ID); foreach (Foods item in aListTemp1) { if (item.Image1 != null) { if (item.Image1.Length <= 0) { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } } else { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } aListFood1.Add(item); } } //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
private void btnSendMail_Click(object sender, EventArgs e) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); string SendEmail = CORE.CONSTANTS.ListEmails.SenderMail.ID; string Pass = CORE.CONSTANTS.ListEmails.SenderMail.PassWord; string ReceiveEmail = CORE.CONSTANTS.ListEmails.ReceiverMail1.ID; string subject = "Gửi thông báo tạm trú ngày :" + String.Format("{0:MM-dd-yyyy}", DateTime.Now); string filename = this.FileName; aReceptionTaskBO.SendMail(SendEmail, Pass, ReceiveEmail, subject, filename); MessageBox.Show("Gửi Email thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void LoadListBookingHallSelectedMenu() { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); List<BookingHallsEN> aListTemp = new List<BookingHallsEN>(); //danh sach tiec đã chọn thực đơn aListTemp.Clear(); aListTemp = aReceptionTaskBO.GetListBookingHallsSelectedMenus(dtpFrom.DateTime.Date, dtpTo.DateTime.Date); // Đã chốt thực đơn dgvBookingHalls_Selected.DataSource = this.GetListBookingHalls(aListTemp); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckMenus.LoadListBookingHallAlreadyComplete\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadListBookingHallHaveMenus() { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); List<BookingHallsEN> aListTemp = new List<BookingHallsEN>(); //danh sach tiec da lên thực đơn nhưng chưa chốt aListTemp.Clear(); aListTemp = aReceptionTaskBO.GetListBookingHallsHaveMenus(dtpFrom.DateTime.Date, dtpTo.DateTime.Date); // Chưa có thực đơn dgvBookingHalls_HaveMenus.DataSource = this.GetListBookingHalls(aListTemp); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckMenus.LoadListBookingHallHaveMenus\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadListBookingHallHaveNotMenus() { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); List<BookingHallsEN> aListTemp = new List<BookingHallsEN>(); //danh sach tiec chưa có thực đơn aListTemp.Clear(); aListTemp = aReceptionTaskBO.GetListBookingHallsNotMenus_ByBookingHallsDate(dtpFrom.DateTime.Date, dtpTo.DateTime.Date); // tiec da co thuc don dgvHaveNotMenus.DataSource = this.GetListBookingHalls(aListTemp); dgvHaveNotMenus.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckMenus.LoadListBookingHallHaveNotMenus\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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); } }
//Hiennv public void LoadData(DateTime createDate) { try { List<CustomerEN> aListCustomersCurrentInRooms = new List<CustomerEN>(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); List<CustomerEN> aListCustomerEN = aReceptionTaskBO.GetListCustomersCurrentInRooms_ByCreateDateBookingR(createDate); CustomerEN aCustomerEN; foreach (CustomerEN items in aListCustomerEN) { aCustomerEN = new CustomerEN(); aCustomerEN.SetValue(items); if (String.IsNullOrEmpty(items.Gender) == false) { aCustomerEN.GenderDisplay = CORE.CONSTANTS.SelectedGender(Convert.ToInt32(items.Gender)).Name; } if (String.IsNullOrEmpty(items.Nationality) == false) { aCustomerEN.NationalityDisplay = CORE.CONSTANTS.SelectedCountry(Convert.ToString(items.Nationality)).Name; } if (items.Citizen != null) { aCustomerEN.CitizenDisplay = CORE.CONSTANTS.SelectedCitizen(Convert.ToInt32(items.Citizen)).Name; } aCustomerEN.IDCompany = items.IDCompany; aCustomerEN.NameCompany = items.NameCompany; aCustomerEN.IDGroup = items.IDGroup; aCustomerEN.NameGroup = items.NameGroup; aCustomerEN.CodeRoom = items.CodeRoom; aCustomerEN.SkuRoom = items.SkuRoom; aListCustomersCurrentInRooms.Add(aCustomerEN); } dgvCustomers.DataSource = aListCustomersCurrentInRooms; dgvCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_ListCustomersCurrentInRoom.LoadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddNew_Click(object sender, EventArgs e) { try { if (ValidateData() == true) { if (dtpAvaiableDate.DateTime < DateTime.Now.AddDays(-1)) { MessageBox.Show("Vui lòng chọn ngày chuyển vào phải lớn hơn hoặc bằng ngày hiện tại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (DateTime.ParseExact(dtpAvaiableDate.Text, "dd/MM/yyyy", null) >= DateTime.ParseExact(dtpExpireDate.Text, "dd/MM/yyyy", null)) { MessageBox.Show("Ngày chuyển vào phải nhỏ hơn ngày chuyển đi.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); aSystemUsers_DivisionsEN.AvaiableDate = DateTime.ParseExact(dtpAvaiableDate.Text, "dd/MM/yyyy", null); aSystemUsers_DivisionsEN.ExpireDate = DateTime.ParseExact(dtpExpireDate.Text, "dd/MM/yyyy",null); aSystemUsers_DivisionsEN.Type = cboType.SelectedIndex + 1; aSystemUsers_DivisionsEN.Status = cboStatus.SelectedIndex + 1; aSystemUsers_DivisionsEN.Disable = Convert.ToBoolean(cboDisable.Text); aReceptionTaskBO.InsertSystemUsersToDivisions(aSystemUsers_DivisionsEN); MessageBox.Show("Thêm mới thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (afrmLst_SystemUsers_Divisions != null) { this.afrmLst_SystemUsers_Divisions.ReloadData(); } this.Close(); } } } catch (Exception ex) { MessageBox.Show("frmIns_SystemUsers_Divisions.btnAddNew_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btReservation_Click(object sender, EventArgs e) { try { ReceptionTaskBO aCheckInActionBO = new ReceptionTaskBO(); aCheckInEN.CustomerType = 1; // 1: Khach nha nuoc, 2: Khach doan, 3: khach le, 4: Khach vang lai aCheckInEN.BookingType = 3; // 1: Dat onlie, 2: Dat qua dien thoai, 3: Truc tiep, 4: Cong van aCheckInEN.IDSystemUser = CORE.CURRENTUSER.SystemUser.ID; ; aCheckInEN.PayMenthod = 1; //1:Tien mat if (aCheckInEN.BookingMoney > 0) { aCheckInEN.StatusPay = 2; //2:Tam ung } else { aCheckInEN.StatusPay = 1; //1:chua thanh toan } aCheckInEN.ExchangeRate = 0; aCheckInEN.Status = 3; // 3 : da checkin aCheckInEN.Type = -1; aCheckInEN.Disable = false; aCheckInActionBO.CheckIn(aCheckInEN); MessageBox.Show("Đặt phòng thành công .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.afrmTsk_CheckIn_Goverment_Step2.Close(); this.afrmTsk_CheckIn_Goverment_Step2.afrmTsk_CheckIn_Goverment_Step1.Close(); if (this.afrmTsk_CheckIn_Goverment_Step2.afrmTsk_CheckIn_Goverment_Step1.afrmMain != null) { this.afrmTsk_CheckIn_Goverment_Step2.afrmTsk_CheckIn_Goverment_Step1.afrmMain.ReloadData(); } this.Close(); } catch (Exception ex) { MessageBox.Show("frmTsk_CheckIn_Goverment_Step3.btReservation_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Ngoc - done private void dtpCheckOutActual_Leave(object sender, EventArgs e) { try { if(this.IsLockForm == true) { MessageBox.Show("Bạn cần tắt chế độ khoá form trước khi sửa bằng cách ấn vào nút 'Sửa hóa đơn' "); } else { if(this.CurrentIDBookingRoom > 0) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if(dtpCheckInActual.DateTime < dtpCheckOutActual.DateTime) { if(this.CheckChangeTime(CurrentIDBookingRoom, CodeRoom, dtpCheckInActual.DateTime, dtpCheckOutActual.DateTime) == true) { List<BookingRoomUsedEN> aTemp = new List<BookingRoomUsedEN>(); aTemp = this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList(); if(aTemp.Count > 0) { // Phai kiem tra xem sua cai gi if(aTemp[0].Status >= 7) { this.aNewPaymentEN.ChangeCheckOutActual(this.CurrentIDBookingRoom, dtpCheckOutActual.DateTime); } else if(aTemp[0].Status < 7) { this.aNewPaymentEN.ChangeCheckOutPlan(this.CurrentIDBookingRoom, dtpCheckOutActual.DateTime); } } } this.LoadDataCurrentRoomForControl(); } else { MessageBox.Show("Vui lòng nhập ngày giờ CheckIn phải nhỏ hơn ngày giờ CheckOut", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentStep2.dtpCheckOutActual_Leave\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btReservation_Click(object sender, EventArgs e) { try { ReceptionTaskBO aCheckInActionBO = new ReceptionTaskBO(); aCheckInRoomBookingEN.BookingType = 3; // 1: Dat onlie, 2: Dat qua dien thoai, 3: Truc tiep, 4: Cong van aCheckInRoomBookingEN.IDSystemUser = CORE.CURRENTUSER.SystemUser.ID; ; aCheckInRoomBookingEN.Status = 3; // 3 : da checkin if (aCheckInRoomBookingEN.BookingMoney > 0) { aCheckInRoomBookingEN.StatusPay = 2; //2:Tam ung } else { aCheckInRoomBookingEN.StatusPay = 1; //1:chua thanh toan } bool success = aCheckInActionBO.CheckInForRoomAlreadyBooking(aCheckInRoomBookingEN); if (success == true) { MessageBox.Show("Đặt phòng thành công .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmTsk_ListBookingRs != null) { this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmTsk_ListBookingRs.Reload(); if (this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmTsk_ListBookingRs.afrmMain != null) { this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmTsk_ListBookingRs.afrmMain.ReloadData(); } } if (this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmMain != null) { this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.afrmMain.ReloadData(); } this.Close(); this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.Close(); this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2.afrmTsk_CheckInGoverment_ForRoomBooking_Step1.Close(); } } catch (Exception ex) { MessageBox.Show("frmTsk_CheckInGoverment_ForRoomBooking_Step3.btReservation_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void InitData(int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs != null) { aNewPaymentHEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aNewPaymentHEN.NameCustomer = aCustomers.Name; } aNewPaymentHEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentHEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentHEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentHEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentHEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentHEN.NameCompany = aCompanies.Name; aNewPaymentHEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentHEN.AddressCompany = aCompanies.Address; } } aNewPaymentHEN.Subject = aBookingHs.Subject; aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentHEN.CustomerType = aBookingHs.CustomerType; aNewPaymentHEN.Status_BookingH = aBookingHs.Status; aNewPaymentHEN.StatusPay = aBookingHs.StatusPay; aNewPaymentHEN.BookingHMoney = aBookingHs.BookingMoney; aNewPaymentHEN.AcceptDate = aBookingHs.AcceptDate; aNewPaymentHEN.InvoiceDate = aBookingHs.InvoiceDate; aNewPaymentHEN.InvoiceNumber = aBookingHs.InvoiceNumber; this.aNewPaymentHEN.IDBookingH = aBookingHs.ID; this.aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod; this.aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate; this.aNewPaymentHEN.CustomerType = aBookingHs.CustomerType; this.aNewPaymentHEN.Status_BookingH = aBookingHs.Status; this.aNewPaymentHEN.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)); } aNewPaymentHEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentHEN.ListIndex = aListIndexTemp.Distinct().ToList(); }
//Ngoc - done private void dtpCheckInActual_Leave(object sender, EventArgs e) { if (this.CurrentIDBookingRoom > 0) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (dtpCheckInActual.DateTime < dtpCheckOutActual.DateTime) { if (this.CheckChangeTime(CurrentIDBookingRoom, CodeRoom, dtpCheckInActual.DateTime, dtpCheckOutActual.DateTime) == true) { List<BookingRoomUsedEN> aTemp = new List<BookingRoomUsedEN>(); aTemp = this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList(); if (aTemp.Count > 0) { if (aTemp[0].Status >= 3) { this.aNewPaymentEN.ChangeCheckInActual(this.CurrentIDBookingRoom, dtpCheckInActual.DateTime); } else if (aTemp[0].Status < 3) { this.aNewPaymentEN.ChangeCheckInPlan(this.CurrentIDBookingRoom, dtpCheckInActual.DateTime); } } } this.LoadDataCurrentRoomForControl(); } else { MessageBox.Show("Vui lòng nhập ngày giờ CheckIn phải nhỏ hơn ngày giờ CheckOut", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnBook_Click(object sender, EventArgs e) { try { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (this.ValidateData() == true) { //Truyền dữ liệu BookingH this.aNewBookingHEN.Subject = txtSubject.Text; this.aNewBookingHEN.CreatedDate = dtpFrom.DateTime; this.aNewBookingHEN.CustomerType = this.CustomerType; this.aNewBookingHEN.BookingType = 3;//3 : Đặt trực tiếp if (txtBookingMoney.Text == "") { this.aNewBookingHEN.BookingMoney = 0; this.aNewBookingHEN.StatusPay = 1;//1 : Trạng thái chưa thanh toán } else { this.aNewBookingHEN.BookingMoney = this.aNewBookingHEN.BookingMoney = Convert.ToDecimal(txtBookingMoney.Text); this.aNewBookingHEN.StatusPay = 2;//2 : Trạng thái tạm ứng } this.aNewBookingHEN.Status = 2;//2: Trạng thái đã xác thực this.aNewBookingHEN.PayMenthod = 1; if (cbbType.EditValue.ToString().ToUpper() == "NGOÀI NẤU") { this.aNewBookingHEN.Type = 1;//1: Tiệc KHÔNG thuộc phạm trù bếp } else if (cbbType.EditValue.ToString().ToUpper() == "BẾP NẤU") { this.aNewBookingHEN.Type = 2;//2: Tiệc thuộc phạm trù bếp } this.aNewBookingHEN.Disable = false; this.aNewBookingHEN.Description = ""; string CustomerGroupName; if (Convert.ToInt32(lueCompany.EditValue) == 0) { this.IDCompany = this.aCompaniesBO.AutoInsertCompany(txtCompanyName.Text, 3);// 3 : Loại khách lẻ if (lueCustomer.Text == "") { if (txtSubject.Text == "") { CustomerGroupName = "[" + txtCompanyName.Text + "][" + DateTime.Now.ToShortDateString() + "]" + "[" + txtCustomerName.Text + "]"; } else { CustomerGroupName = txtSubject.Text; } } else { if (txtSubject.Text == "") { CustomerGroupName = "[" + txtCompanyName.Text + "][" + DateTime.Now.ToShortDateString() + "]" + "[" + lueCustomer.Text + "]"; } else { CustomerGroupName = txtSubject.Text; } } this.IDCustomerGroup = this.aCustomerGroupsBO.AutoInsertCustomerGroup(CustomerGroupName, IDCompany); } else { this.IDCompany = Convert.ToInt32(lueCompany.EditValue); if (lueCustomer.Text == "") { if (txtSubject.Text == "") { CustomerGroupName = "[" + txtCompanyName.Text + "][" + DateTime.Now.ToShortDateString() + "]" + "[" + txtCustomerName.Text + "]"; } else { CustomerGroupName = txtSubject.Text; } } else { if (txtSubject.Text == "") { CustomerGroupName = "[" + txtCompanyName.Text + "][" + DateTime.Now.ToShortDateString() + "]" + "[" + lueCustomer.Text + "]"; } else { CustomerGroupName = txtSubject.Text; } } this.IDCustomerGroup = this.aCustomerGroupsBO.AutoInsertCustomerGroup(CustomerGroupName, Convert.ToInt32(lueCompany.EditValue)); } if (Convert.ToInt32(lueCustomer.EditValue) == 0) { this.IDCustomer = this.aCustomersBO.AutoInsertCustomer(txtCustomerName.Text, this.IDCustomerGroup, txtPhoneNumber.Text, DateTime.Now); } else { CustomerGroups_CustomersBO aCustomerGroups_CustomersBO = new CustomerGroups_CustomersBO(); this.IDCustomer = Convert.ToInt32(lueCustomer.EditValue); aCustomerGroups_CustomersBO.AutoInsertCustomerToGroup(IDCustomer, this.IDCustomerGroup, dtpFrom.DateTime); } this.aNewBookingHEN.Disable = false; this.aNewBookingHEN.IDCustomer = this.IDCustomer; this.aNewBookingHEN.IDSystemUser = CORE.CURRENTUSER.SystemUser.ID; this.aNewBookingHEN.IDCustomerGroup = this.IDCustomerGroup; //=============================================================================== // Ngoc edit. All BookingR and BookingH join together // Tao them 1 bookingR neu chua co //=============================================================================== if (this.IDBookingR == 0) { BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs.CreatedDate = this.aNewBookingHEN.CreatedDate; aBookingRs.ID = 0; aBookingRs.CustomerType = this.aNewBookingHEN.CustomerType; aBookingRs.IDCustomer = this.aNewBookingHEN.IDCustomer; aBookingRs.IDCustomerGroup = this.aNewBookingHEN.IDCustomerGroup; aBookingRs.DatePay = Convert.ToDateTime("01/01/1900"); aBookingRs.DateEdit = Convert.ToDateTime("01/01/1900"); aBookingRs.IDSystemUser = this.aNewBookingHEN.IDSystemUser; aBookingRs.Type = 0; aBookingRs.Status = 0; aBookingRs.Disable = true; aBookingRs.Level = -1; this.IDBookingR = aBookingRsBO.Insert(aBookingRs); } //=============================================================================== this.IDBookingH = aReceptionTaskBO.NewBookHall(this.aNewBookingHEN); if (this.IDBookingR != 0) { BookingRs_BookingHsBO aBookingRs_BookingHsBO = new BookingRs_BookingHsBO(); BookingRs_BookingHs aBookingRs_BookingHs = new BookingRs_BookingHs(); aBookingRs_BookingHs.IDBookingR = this.IDBookingR; aBookingRs_BookingHs.IDBookingH = this.IDBookingH; aBookingRs_BookingHs.Type = String.Empty; aBookingRs_BookingHs.Status = String.Empty; aBookingRs_BookingHs.Disable = false; aBookingRs_BookingHs.Extension1 = String.Empty; aBookingRs_BookingHs.Extension2 = String.Empty; aBookingRs_BookingHs.Extension3 = String.Empty; aBookingRs_BookingHsBO.Insert(aBookingRs_BookingHs); } MessageBox.Show("Đặt hội trường thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (afrmMain_Halls != null) { this.afrmMain_Halls.Reload(); } if (afrmTsk_Payment_Step2 != null) { this.afrmTsk_Payment_Step2.Reload(); } this.Close(); } } catch (Exception ex) { MessageBox.Show("frmTsk_BookingHall_Customer_New.btnBook_Click\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool CheckChangeTime(int IDBookingRoom, string CodeRoom, DateTime From, DateTime To) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); List<int> aListIDBookingRoom = aReceptionTaskBO.CheckAvaiableRoom(IDBookingRoom, CodeRoom, From, To); if (aListIDBookingRoom.Count > 0) { MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show("Không chuyển được thời gian do xung đột thời gian với mã đặt phòng :" + string.Join(",", aListIDBookingRoom.ToArray()) +". Bạn có muốn search xem chi tiết không ?","Thông báo", buttons); if (result == System.Windows.Forms.DialogResult.Yes) { frmTsk_Payment_Step1 aFrm = new frmTsk_Payment_Step1(); aFrm.ShowDialog(); this.Close(); } return false; } return true; }
//Ngoc - done private void cbbPriceType_EditValueChanged(object sender, EventArgs e) { decimal? CostDBCurrentRoom = this.aNewPaymentEN.GetOnlyMoneyRoom(this.CurrentIDBookingRoom); string CostTypeDBCurrentRoom = this.aNewPaymentEN.GetPriceType(this.CurrentIDBookingRoom); // Neu da co du lieu trong DB thi lay du lieu trong DB if (cbbPriceType.Text != CostTypeDBCurrentRoom) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); this.aNewPaymentEN.SetPriceType(this.CurrentIDBookingRoom, cbbPriceType.Text); this.aNewPaymentEN.ChangeCostRoom(this.CurrentIDBookingRoom, aAccountancyBO.CalculateCostRoom(this.CurrentIDBookingRoom, this.aNewPaymentEN.GetPriceType(this.CurrentIDBookingRoom), this.aNewPaymentEN.CustomerType.GetValueOrDefault(0), this.aNewPaymentEN.GetNumberCustomerInRoom(this.CurrentIDBookingRoom)).GetValueOrDefault(0)); } this.LoadDataCurrentRoomForControl(); }
private void btnShowForeign_Click(object sender, EventArgs e) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); FileName = aReceptionTaskBO.ExportDBF(aListForeign); }
// Author : Linhting public void InitData( int IDBookingH) { try { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); // Truyen du lieu cho List BookingRoom cua NewPayment if (aBookingHs != null) { aNewPaymentEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.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.IDBookingH = aBookingHs.ID; 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); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
//hiennv public void InitData(PaymentHallsEN aPaymentHallsEN, int IDBookingH) { try { HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomersBO aCustomersBO = new CustomersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CompaniesBO aCompaniesBO = new CompaniesBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs != null) { aPaymentHallsEN.IDBookingH = aBookingHs.ID; aPaymentHallsEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aPaymentHallsEN.NameCustomerGroup = aCustomerGroups.Name; aPaymentHallsEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aPaymentHallsEN.NameCompany = aCompanies.Name; aPaymentHallsEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; } } aPaymentHallsEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aPaymentHallsEN.NameCustomer = aCustomers.Name; } aPaymentHallsEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aPaymentHallsEN.NameSystemUser = aSystemUsers.Name; } aPaymentHallsEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aPaymentHallsEN.CustomerType = aBookingHs.CustomerType; aPaymentHallsEN.BookingType = aBookingHs.BookingType; aPaymentHallsEN.PayMenthod = aBookingHs.PayMenthod; aPaymentHallsEN.StatusPay = aBookingHs.StatusPay; aPaymentHallsEN.Status_BookingH = aBookingHs.Status; aPaymentHallsEN.ExchangeRate = aBookingHs.ExchangeRate; aPaymentHallsEN.Level = aBookingHs.Level; aPaymentHallsEN.BookingMoney = aBookingHs.BookingMoney; } List<BookingHalls> aListBookingHalls = new List<BookingHalls>(); aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN; for (int i = 0; i < aListBookingHalls.Count; i++) { aInfoDetailPaymentHallsEN = new InfoDetailPaymentHallsEN(); Halls aHalls = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1); if (aHalls != null) { aInfoDetailPaymentHallsEN.Sku = aHalls.Sku; } else { aInfoDetailPaymentHallsEN.Sku = string.Empty; } aInfoDetailPaymentHallsEN.aBookingHalls = aListBookingHalls[i]; aInfoDetailPaymentHallsEN.aMenusEN = aReceptionTaskBO.GetDetailMenu_ByIDBookingHall(aListBookingHalls[i].ID); aInfoDetailPaymentHallsEN.aListServicesHallsEN = aReceptionTaskBO.GetListServicesHallsEN_ByIDBookingHall(aListBookingHalls[i].ID); aPaymentHallsEN.aListInfoDetailPaymentHallsEN.Insert(i, aInfoDetailPaymentHallsEN); } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
//Hiennv // Ngoc da sua lai ten ham 26/12 public void LoadListBookingR() { try { string StatusPay; DateTime From = dtpFrom.DateTime; DateTime To = dtpTo.DateTime; if (Convert.ToInt32(lueStatusPay.EditValue) == 4) { StatusPay = "1,2,3"; } else { StatusPay = lueStatusPay.EditValue.ToString(); } int CustomerType = Convert.ToInt32(lueCustomerType.EditValue); if (StatusPay == "1" || StatusPay == "2") { } else if (StatusPay == "3") { } if (this.IDBookingR == 0) { if (From > To) { MessageBox.Show("Vui lòng nhập ngày bắt đầu kiểm tra nhỏ hơn ngày kết thúc .\n", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); dgvOwePay.DataSource = aReceptionTaskBO.GetListBookingRByStatus(From, To, CustomerType, StatusPay); dgvOwePay.RefreshDataSource(); } } else if (this.IDBookingR > 0) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); dgvOwePay.DataSource = aReceptionTaskBO.GetListBookingRByStatus(From, To, CustomerType, StatusPay).Where(r=>r.IDBookingR == this.IDBookingR).ToList(); dgvOwePay.RefreshDataSource(); } } catch (Exception ex) { MessageBox.Show("frmTsk_Payment_Step1.GetListUnPayBookingR \n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// =============================================================================== // 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(); } }
//hiennv private void btnPaymentHall_Click(object sender, EventArgs e) { try { if (this.CheckDataBeforePayment() == true) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); this.aPaymentHallsEN.PayMenthod = Convert.ToInt32(luePayMethod.EditValue); bool status = aReceptionTaskBO.PaymentHall(this.aPaymentHallsEN); if (status == true) { MessageBox.Show("Thanh toán thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thanh toán bị thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.btnPaymentHall_Click\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Load lai du lieu cho cac control moi khi select vao 1 phong moi // Ngoc - done private void LoadDataCurrentRoomForControl() { if (this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList().Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN = this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList()[0]; /*Ghi chu TypeBookingRooms * Type = 2: //Tính checkin sớm , không tính checkout muộn. * Type = 0: //Không tính checkIn sớm và checkout muộn. * Type = 3: //Tính checkin sớm và Checkout muộn * Type = 1: //Không tính checkin sớm , tính checkout muộn */ ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (aBookingRoomUsedEN.Status == 1 || aBookingRoomUsedEN.Status == 2) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInPlan; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = ""; // Phong chua su dung txtAddTimeEnd.Text = ""; txtAddTimeStart.Text = ""; lblCI.Text = "CI dự kiến"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang ở trạng thái đặt").ToUpper(); } else if (aBookingRoomUsedEN.Status == 3) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang có người ở").ToUpper(); } else if (aBookingRoomUsedEN.Status == 5) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang khóa").ToUpper(); } else if (aBookingRoomUsedEN.Status == 7) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutActual; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutActual).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutActual).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO thực tế"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đã checkout nhưng chưa thanh toán").ToUpper(); } else if (aBookingRoomUsedEN.Status == 8) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutActual; // Neu phong da dc thanh toan tuc la thong tin phong da chot. Vay lay thong tin nay de hien thi txtNumberDate.Text = (aBookingRoomUsedEN.TimeInUse.GetValueOrDefault(0)/(24*60)).ToString(); txtAddTimeEnd.Text = aBookingRoomUsedEN.AddTimeEnd.ToString(); txtAddTimeStart.Text = aBookingRoomUsedEN.AddTimeStart.ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO thực tế"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đã thanh toán").ToUpper(); } lblSkuRooms.Text = aBookingRoomUsedEN.RoomSku; txtPercentTax_Room.Text = Convert.ToString(aBookingRoomUsedEN.PercentTax); lblMoneyRoom.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetOnlyMoneyRoom(aBookingRoomUsedEN.ID)); if (string.IsNullOrEmpty(aBookingRoomUsedEN.Cost.ToString()) == false) { txtBookingRoomsCost.EditValue = aBookingRoomUsedEN.Cost; } else { txtBookingRoomsCost.EditValue = aAccountancyBO.CalculateCostRoom(this.CurrentIDBookingRoom, aBookingRoomUsedEN.PriceType, this.aNewPaymentEN.CustomerType.GetValueOrDefault(0), this.aNewPaymentEN.GetNumberCustomerInRoom(this.CurrentIDBookingRoom)); } // Danh sách khách dgvCustomers.DataSource = aBookingRoomUsedEN.ListCustomer; dgvCustomers.RefreshDataSource(); // Danh sách dịch vụ dgvServicesR.DataSource = aNewPaymentEN.GetListServiceUsedInRoom(aBookingRoomUsedEN.ID); dgvServicesR.RefreshDataSource(); //-----------Ngoc bổ sung -------------- CustomersBO aCustomersBO = new CustomersBO(); lueUserInBookingR.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.CurrentIDBookingRoom); //-----------Ngoc bổ sung -------------- lblTotalMoneyServiceR.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyListServiceUsedInARoom(aBookingRoomUsedEN.ID)); } //========================================= //========================================= //========================================= // Load lai control khac //-------------- Phòng --------------------- //Thong tin nguoi dat lblNameCompany_BookingR.Text = this.aNewPaymentEN.NameCompany; lblNameCustomerGroup_BookingR.Text = this.aNewPaymentEN.NameCustomerGroup; lblNameCustomer_BookingR.Text = this.aNewPaymentEN.NameCustomer; txtAddressR.Text = this.aNewPaymentEN.AddressCompany; txtTaxNumberCodeR.Text = this.aNewPaymentEN.TaxNumberCodeCompany; // Thông tin hóa đơn txtInvoiceNumberR.Text = this.aNewPaymentEN.InvoiceNumber; dtpAcceptDateR.DateTime = this.aNewPaymentEN.AcceptDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900")); dtpInvoiceDateR.DateTime = this.aNewPaymentEN.InvoiceDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900")); // Trang thai, hinh thuc thanh toan lueBookingR_Paymethod.Properties.DataSource = CORE.CONSTANTS.ListPayMethods; lueBookingR_Paymethod.Properties.DisplayMember = "Name"; lueBookingR_Paymethod.Properties.ValueMember = "ID"; lueBookingR_Paymethod.EditValue = CORE.CONSTANTS.SelectedPayMethod(Convert.ToInt32(this.aNewPaymentEN.PayMenthodR)).ID; //-------------------------------------------------------------- // Thong tin gia tiền, đặt trước lblTotalMoneyRooms.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyRooms()); txtBookingRMoney.EditValue = this.aNewPaymentEN.BookingRMoney; lblTotalMoneyR.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyRooms() - this.aNewPaymentEN.BookingRMoney); // Bang danh sach phong dgvRooms.DataSource = this.aNewPaymentEN.aListBookingRoomUsed; dgvRooms.RefreshDataSource(); }
private void simpleButton1_Click(object sender, EventArgs e) { try { if (ValidateData() == true) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); //Add du lieu cho BookingH BookingHs aBookingHs = new BookingHs(); aBookingHs.ID = IDBookingH; aBookingHs.Subject = txtSubject.Text; aBookingHs.CreatedDate = this.aBookingHs.CreatedDate; aBookingHs.CustomerType = this.aBookingHs.CustomerType; aBookingHs.BookingType = Convert.ToInt16(lueBookingType.EditValue); aBookingHs.Note = txtNote.Text; aBookingHs.IDGuest = Convert.ToInt16(lueGuest.EditValue); if (txtBookingMoney.Text == "") { aBookingHs.BookingMoney = 0; lueStatusPay.EditValue = CORE.CONSTANTS.SelectedStatusPay(1).ID; } else { aBookingHs.BookingMoney = Convert.ToDecimal(txtBookingMoney.Text); lueStatusPay.EditValue = CORE.CONSTANTS.SelectedStatusPay(2).ID; } aBookingHs.StatusPay = Convert.ToInt16(lueStatusPay.EditValue); aBookingHs.Status = Convert.ToInt16(lueBookingStatus.EditValue); aBookingHs.PayMenthod = 1; if (cbbType.Text == "Tiệc không thuộc phạm trù nhà bếp") { aBookingHs.Type = 1; } else { aBookingHs.Type = 2; } aBookingHs.Disable = false; aBookingHs.Level = Convert.ToInt16(lueLevel.EditValue); aBookingHs.Description = ""; aBookingHs.IDCustomer = Convert.ToInt16(lueCustomer.EditValue); aBookingHs.IDCustomerGroup = Convert.ToInt16(lueCustomerGroup.EditValue); aBookingHs.IDSystemUser = 1;// Để tạm //Add du lieu cho BookingHall List<BookingHalls> aListBookingHall = new List<BookingHalls>(); BookingHalls aTemp; for (int i = 0; i < aListSelected.Count; i++) { aTemp = new BookingHalls(); aTemp.CodeHall = aListSelected[i].Code; aTemp.Cost = aListSelected[i].Cost; aTemp.PercentTax = 10; aTemp.CostRef_Halls = aListSelected[i].CostRef; aTemp.Date = dtpFrom.DateTime; IFormatProvider theCultureInfo = new System.Globalization.CultureInfo("en-GB", true); //DateTime Lunardate = DateTime.ParseExact(LunarDateExt.ToLunarDate(dtpFrom.DateTime, 7).ToString(), "dd/MM/yyyy", theCultureInfo); //aTemp.LunarDate = Lunardate; aTemp.BookingStatus = null; aTemp.Unit = aListSelected[i].Unit; aTemp.TableOrPerson = aListSelected[i].TableOrPerson; aTemp.Note = ""; aTemp.Status = Convert.ToInt16(lueBookingStatus.EditValue); aTemp.StartTime = !string.IsNullOrEmpty(tedStart.Time.ToString()) ? tedStart.Time.TimeOfDay : TimeSpan.Zero; aTemp.EndTime = !string.IsNullOrEmpty(tedEnd.Time.ToString()) ? tedEnd.Time.TimeOfDay : TimeSpan.Zero; aListBookingHall.Add(aTemp); } aReceptionTaskBO.UpdateCheckIn(aBookingHs, aListBookingHall); if (afrmTsk_ManageBookingHs != null) { afrmTsk_ManageBookingHs.ReloadData(); } else if (afrmMain_Halls != null) { afrmMain_Halls.ReloadData(); } MessageBox.Show("Đặt hội trường thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { MessageBox.Show("frmTsk_UpdBooking.CheckIn\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtAddTimeStart_EditValueChanged(object sender, EventArgs e) { if (this.CurrentIDBookingRoom > 0) { ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); int NewTypeBookingRoom = this.ConvertTypeBookingRoom(chkCheckIn.Checked, chkCheckOut.Checked); this.aNewPaymentEN.ChangeTypeBookingRoom(this.CurrentIDBookingRoom, NewTypeBookingRoom); this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList()[0].AddTimeStart = aReceptionTaskBO.GetAddTimeStart(NewTypeBookingRoom, dtpCheckInActual.DateTime); this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList()[0].AddTimeEnd = aReceptionTaskBO.GetAddTimeEnd(NewTypeBookingRoom, dtpCheckOutActual.DateTime); this.ShowControlAutoCost(this.aNewPaymentEN.GetTypeBookingRoom(this.CurrentIDBookingRoom)); this.LoadDataCurrentRoomForControl(); } }