protected void Page_Load(object sender, EventArgs e) { int bookingID = 0; bool intTest = false; intTest = int.TryParse(Request.QueryString["id"], out bookingID); Session["BookingID"] = bookingID; BookingHandler bookingHandler = new BookingHandler(); InvoiceHandler invoiceHandler = new InvoiceHandler(); ProvisionalBooking provisionalBooking = bookingHandler.GetProvisionalBookingDetails(bookingID); try { Page.Title = "EASiBOOK :: Booking Number" + bookingID.ToString(); litBookingNo.Text = bookingID.ToString(); lblName.Text = provisionalBooking.Name; lblEmail.Text = provisionalBooking.Email; lblPhoneNo.Text = provisionalBooking.PhoneNo; lblDeposit.Text = "R " + invoiceHandler.GetDepositAmount(bookingID).ToString(); lblArriveDate.Text = provisionalBooking.ArriveDate.Year + "-" + provisionalBooking.ArriveDate.Month + "-" + provisionalBooking.ArriveDate.Day; lblDepartDate.Text = provisionalBooking.DepartDate.Year + "-" + provisionalBooking.DepartDate.Month + "-" + provisionalBooking.DepartDate.Day; if (provisionalBooking.ProofOfPayment != "") imgProofOfPayment.ImageUrl = "." + provisionalBooking.ProofOfPayment; else { imgProofOfPayment.Visible = false; lblLargeImage.Visible = false; lblNoPOP.Visible = true; } if (provisionalBooking.ProofOfPayment.EndsWith(".pdf")) { litProofOfPayment.Text = "." + provisionalBooking.ProofOfPayment + "\" target=\"_blank\""; imgProofOfPayment.ImageUrl = "/resources/pdflogo.png"; } else litProofOfPayment.Text = "." + provisionalBooking.ProofOfPayment + "\" data-lightbox=\"image\""; } catch (NullReferenceException) { Response.Redirect("ProvisionalBookings.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { int invoiceID = 0; bool intTest = false; intTest = int.TryParse(Request.QueryString["id"], out invoiceID); if (invoiceID == 0) Response.Redirect("Default.aspx"); litInvoiceNo.Text = invoiceID.ToString(); BusinessHandler businessHandler = new BusinessHandler(); Business business = businessHandler.GetBusinessDetails(); lblCompanyName.Text = business.Name; lblAddressLine1.Text = business.AddressLine1; lblAddressLine2.Text = business.AddressLine2; lblPhoneNo.Text = business.PhoneNo; lblEmail.Text = business.Email; lblBankName.Text = business.BankName; lblBankAccountNo.Text = business.AccountNo; lblBranchCode.Text = business.BranchCode; InvoiceHandler invoiceHandler = new InvoiceHandler(); DAL.Invoice invoice = invoiceHandler.GetInvoiceDetails(invoiceID); int bookingID = 0; try { bookingID = invoice.BookingID; } catch (NullReferenceException) { Response.Redirect("Default.aspx"); } BookingHandler bookingHandler = new BookingHandler(); ProvisionalBooking provisionalBooking = bookingHandler.GetProvisionalBookingDetails(bookingID); lblArriveDate.Text = provisionalBooking.ArriveDate.Year + "-" + provisionalBooking.ArriveDate.Month + "-" + provisionalBooking.ArriveDate.Day; lblDepartDate.Text = provisionalBooking.DepartDate.Year + "-" + provisionalBooking.DepartDate.Month + "-" + provisionalBooking.DepartDate.Day; //Get all rooms in booking double totalPrice = 0; DateTime startDate = new DateTime(); DateTime endDate = new DateTime(); startDate = provisionalBooking.ArriveDate; endDate = provisionalBooking.DepartDate; double noOfDays = (endDate - startDate).TotalDays; string htmlOutput = ""; string[] rooms = invoice.Rooms.Split(','); int roomCount = rooms.Count(); RoomAndType roomAndType = null; AvailabilityHandler availabilityHandler = new AvailabilityHandler(); for (int i = 0; i < roomCount - 1; i++) { roomAndType = availabilityHandler.GetAvailableRoomDetails(Convert.ToInt32(rooms[i])); totalPrice = totalPrice + (roomAndType.Rate * noOfDays); htmlOutput += "<tr><td>" + roomAndType.RoomNo + "</td><td>" + roomAndType.Name + "</td><td>R " + roomAndType.Rate + "</td><td>R " + (roomAndType.Rate * noOfDays).ToString() + "</td></tr>"; } //end get all rooms in booking litSelectedRooms.Text = htmlOutput; double depositAmount = invoiceHandler.GetDepositAmount(bookingID); double totalAmount = invoiceHandler.GetTotalAmount(bookingID); lblDeposit.Text = depositAmount.ToString(); lblTotalAmount.Text = totalAmount.ToString(); }