//======================================================= //Author: Hien //Function : ReportPaymentBookingR //======================================================= public List<InfoDetailPaymentEN> ReportPaymentBookingR(int IDBookingR) { PaymentEN aPaymentEN = new PaymentEN(); BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); List<BookingRooms> aListBookingRoom = new List<BookingRooms>(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); aListBookingRoom = aBookingRoomBO.Select_ByIDBookingRs(IDBookingR); InfoDetailPaymentEN aInfoDetailPaymentEn; for (int i = 0; i < aListBookingRoom.Count; i++) { aInfoDetailPaymentEn = new InfoDetailPaymentEN(); aInfoDetailPaymentEn.aBookingRooms = aListBookingRoom[i]; aInfoDetailPaymentEn.aListService = aReceptionTaskBO.GetListService_ByIDBookingRoom(aListBookingRoom[i].ID); //aInfoDetailPaymentEn.DateInUse = aReceptionTaskBO.CaculateBooking(aListBookingRoom[i].ID,aListBookingRoom[i].CheckInActual, aListBookingRoom[i].CheckOutActual); aPaymentEN.aListInfoDetailPaymentEN.Add(aInfoDetailPaymentEn); } return aPaymentEN.aListInfoDetailPaymentEN; }
//hiennv public bool PaymentRoom(PaymentEN aPaymentEN) { try { BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(aPaymentEN.IDBookingR); if (aBookingRs != null) { aBookingRs.ID = aPaymentEN.IDBookingR; aBookingRs.PayMenthod = aPaymentEN.PayMenthod; aBookingRs.StatusPay = 3; aBookingRs.Status = 8; aBookingRs.DatePay = DateTime.Now; aBookingRs.BookingMoney = 0; aBookingRsBO.Update(aBookingRs); } BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); for (int i = 0; i < aPaymentEN.aListInfoDetailPaymentEN.Count; i++) { if (aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.IDBookingR == aPaymentEN.IDBookingR) { BookingRooms aBookingRooms = aBookingRoomsBO.Select_ByID(aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.ID); if (aBookingRooms != null) { aBookingRooms.ID = aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.ID; aBookingRooms.PercentTax = aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.PercentTax; decimal? cost = aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.Cost == null ? aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.CostRef_Rooms : aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.Cost; aBookingRooms.Cost = cost; aBookingRooms.Status = 8; aBookingRooms.CheckOutActual = aPaymentEN.aListInfoDetailPaymentEN[i].CheckOut; aBookingRooms.TimeInUse = Convert.ToDecimal(aPaymentEN.aListInfoDetailPaymentEN[i].DateInUse * 24 * 60); aBookingRoomsBO.Update(aBookingRooms); } for (int j = 0; j < aPaymentEN.aListInfoDetailPaymentEN[i].aListService.Count; j++) { if (aPaymentEN.aListInfoDetailPaymentEN[i].aBookingRooms.ID == aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].IDBookingRoom) { BookingRooms_Services aBookingRooms_Services = aBookingRooms_ServicesBO.Select_ByID(aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].IDBookingRoomService); if (aBookingRooms_Services != null) { aBookingRooms_Services.ID = aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].IDBookingRoomService; aBookingRooms_Services.Quantity = aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].Quantity; aBookingRooms_Services.PercentTax = aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].PercentTax; aBookingRooms_Services.Cost = aPaymentEN.aListInfoDetailPaymentEN[i].aListService[j].Cost; aBookingRooms_Services.Status = 8; aBookingRooms_ServicesBO.Update(aBookingRooms_Services); } } } } } return true; } catch (Exception ex) { return false; throw new Exception(string.Format("ReceptionTaskBO.PaymentRoom\n" + ex.Message)); } }