protected void BookingSearchButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         bookingID        = BookingIDDropDownList.SelectedItem.Text;
         Booking        booking          = bookingBLLObject.GetBookingDetails(bookingID);
         if (booking != null)
         {
             HotelIDTextbox.Text       = booking.HotelID;
             BookingDateTextbox.Text   = booking.BookingDate.ToString();
             ArrivalDateTextBox.Text   = booking.ArrivalDate.ToString();
             DepartureDateTextbox.Text = booking.DepartureDate.ToString();
             NoOfAdultTextBox.Text     = booking.NoOfAdults.ToString();
             NoOfChildrenTextBox.Text  = booking.NoOfChildren.ToString();
             NoOfNightsTextBox.Text    = booking.NoOfNights.ToString();
             RoomTypeTextbox.Text      = booking.RoomType;
             TotalRoomTextBox.Text     = booking.TotalRooms.ToString();
         }
         hidden.Visible = true;
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
             string         customerID       = Session["userId"].ToString();
             var            bookings         = bookingBLLObject.GetBookingID(customerID);
             BookingIDDropDownList.DataSource = bookings;
             BookingIDDropDownList.DataBind();
             hidden.Visible = false;
         }
         if (IsPostBack)
         {
             if (ArrivalDateTextBox.Text != "" && DepartureDateTextbox.Text != "")
             {
                 DateTime arrivalDate   = new DateTime();
                 DateTime departureDate = new DateTime();
                 DateTime.TryParse(ArrivalDateTextBox.Text.ToString(), out arrivalDate);
                 DateTime.TryParse(DepartureDateTextbox.Text.ToString(), out departureDate);
                 int noOfNights = (int)(departureDate - arrivalDate).TotalDays;
                 NoOfNightsTextBox.Text = noOfNights.ToString();
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                Booking        booking          = new Booking();
                HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
                booking.BookingDate   = DateTime.Now;
                booking.BookingID     = BookingIDDropDownList.SelectedItem.Text;
                booking.ArrivalDate   = DateTime.Parse(ArrivalDateTextBox.Text.ToString());
                booking.DepartureDate = DateTime.Parse(DepartureDateTextbox.Text.ToString());
                booking.NoOfAdults    = Convert.ToInt32(NoOfAdultTextBox.Text.ToString());
                booking.NoOfChildren  = Convert.ToInt32(NoOfChildrenTextBox.Text.ToString());
                booking.NoOfNights    = Convert.ToInt32(NoOfNightsTextBox.Text.ToString());
                booking.HotelID       = HotelIDTextbox.Text;
                booking.RoomType      = RoomTypeTextbox.Text;
                booking.TotalRooms    = Convert.ToInt32(TotalRoomTextBox.Text);
                string result = bookingBLLObject.AddUpdateBooking(booking, true);
                ResultLabel.Text = result;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$(function () {");
                sb.Append(" $('#Result').modal('show');});");
                sb.Append("</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
            }
            catch (Exception ex)
            {
                Utility.ExceptionUtility.ExceptionLog(ex);
                throw;
            }
        }
 protected void BookingIDButton_Click(object sender, EventArgs e)
 {
     try
     {
         int            noOfAdults = 0, noOfChildren = 0, noOfnights = 0, rateAdult = 0, rateChild = 0;
         double         bill             = 0;
         string         hotelID          = string.Empty;
         string         roomType         = string.Empty;
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         bookingID        = BookingIDDropDownList.SelectedItem.Text;
         var            booking          = bookingBLLObject.GetBookingDetails(bookingID);
         if (booking != null)
         {
             hotelID      = booking.HotelID;
             noOfAdults   = booking.NoOfAdults;
             noOfChildren = booking.NoOfChildren;
             noOfnights   = booking.NoOfNights;
             roomType     = booking.RoomType;
         }
         HRSHotelsBLL hotelBLLObject = new HRSHotelsBLL();
         var          hotel          = hotelBLLObject.GetHotelDetailsByID(hotelID);
         if (roomType == HRSConstants.AC)
         {
             rateAdult = hotel.RateAdultACRoom;
             rateChild = hotel.RateChildACRoom;
         }
         else
         {
             rateAdult = hotel.RateAdultNACRoom;
             rateChild = hotel.RateChildNACRoom;
         }
         bill = (noOfAdults * rateAdult + noOfChildren * rateChild) * noOfnights;
         if (noOfnights > 5)
         {
             bill = bill - bill * 0.025;
         }
         AmountTextBox.Text = bill.ToString();
         hidden.Visible     = true;
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         ExpiryDateTextBox.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         customerID       = Session["userId"].ToString();
         List <string>  booking          = bookingBLLObject.GetBookingIDForTXN(customerID);
         BookingIDDropDownList.DataSource = booking;
         BookingIDDropDownList.DataBind();
         BookingIDDropDownList.SelectedValue = Request.QueryString["field"];
         hidden.Visible = false;
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
             string         customerID       = Session["userId"].ToString();
             var            bookings         = bookingBLLObject.GetBookingID(customerID);
             BookingIDDropDownList.DataSource = bookings;
             BookingIDDropDownList.DataBind();
         }
         hidden.Visible = false;
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
        protected void BookNowButton_Click(object sender, EventArgs e)
        {
            try
            {
                Booking        booking          = new Booking();
                HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
                booking.BookingDate   = DateTime.Now;
                booking.HotelID       = HotelIDDropDownList.SelectedItem.Value;
                booking.CustomerID    = Session["userId"].ToString();
                booking.ArrivalDate   = DateTime.Parse(ArrivalDateTextBox.Text.ToString());
                booking.DepartureDate = DateTime.Parse(DepartureDateTextbox.Text.ToString());
                booking.NoOfAdults    = Convert.ToInt32(NoOfAdultTextBox.Text.ToString());
                booking.NoOfChildren  = Convert.ToInt32(NoOfChildrenTextBox.Text.ToString());
                booking.NoOfNights    = (int)(booking.DepartureDate - booking.ArrivalDate).TotalDays;
                booking.TotalRooms    = Convert.ToInt32(TotalRoomTextBox.Text.ToString());
                booking.RoomType      = RoomTypeDropDownList.SelectedItem.Text;
                string result = bookingBLLObject.AddUpdateBooking(booking, false);
                if (result.Trim().Split().Length == 1)
                {
                    ReseltLabel.Text      = "Hotel Reserved Successfully, Note your booking id: " + result;
                    resultBookingID       = result;
                    PaymentButton.Visible = true;
                }
                else
                {
                    ReseltLabel.Text = result;
                }

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$(function () {");
                sb.Append(" $('#Result').modal('show');});");
                sb.Append("</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
            }
            catch (Exception ex)
            {
                Utility.ExceptionUtility.ExceptionLog(ex);
                throw;
            }
        }
Example #8
0
 protected void CalcelButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         bookingID        = BookingIDDropDownList.SelectedItem.Text;
         string         customerID       = Session["userId"].ToString();
         DateTime       bookingDate      = DateTime.Parse(BookingDateLabel.Text);
         if ((DateTime.Now - bookingDate).TotalDays <= 3)
         {
             int result = bookingBLLObject.DeleteBookingDetails(bookingID, customerID);
             if (result >= 1)
             {
                 ReseltLabel.Text = "Successfully Cancelled";
             }
             else
             {
                 ReseltLabel.Text = "Error Occured";
             }
         }
         else
         {
             ReseltLabel.Text = "Cancellation Not Allowed";
         }
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append(@"<script type='text/javascript'>");
         sb.Append("$(function () {");
         sb.Append(" $('#Result').modal('show');});");
         sb.Append("</script>");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Example #9
0
 protected void SearchHotelButton_Click(object sender, EventArgs e)
 {
     try
     {
         int            roomNo           = int.Parse(NoOfRooms.Text);
         HRSHotelsBLL   hotelBLLObject   = new HRSHotelsBLL();
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         roomType         = RoomTypeDropDownList.SelectedItem.Text;
         var            hotels           = hotelBLLObject.SearchHotels(roomNo, CityDropDownList.SelectedItem.Text, roomType);
         foreach (var hotel in hotels)
         {
             var bookingRD = bookingBLLObject.GetBookingsByHotelID(hotel.HotelID);
             foreach (var booking in bookingRD)
             {
                 DateTime queryArrivalDate   = DateTime.Parse(CheckInTextBox.Text);
                 DateTime queryDepartureDate = DateTime.Parse(CheckOutTextBox.Text);
                 if (booking.ArrivalDate <= queryDepartureDate && queryArrivalDate <= booking.DepartureDate)
                 {
                     if (booking.RoomType == Utility.HRSConstants.AC)
                     {
                         hotel.NoOfACRooms -= booking.TotalRooms;
                     }
                     else
                     {
                         hotel.NoOfNACRooms -= booking.TotalRooms;
                     }
                 }
             }
             if (roomType == Utility.HRSConstants.AC)
             {
                 if (hotel.NoOfACRooms < roomNo)
                 {
                     hotels.Remove(hotel);
                 }
             }
             else
             {
                 if (hotel.NoOfNACRooms < roomNo)
                 {
                     hotels.Remove(hotel);
                 }
             }
         }
         if (hotels.Count >= 1)
         {
             SearchHotelResult.DataSource = hotels;
             SearchHotelResult.DataBind();
             HiddenTable.Visible = true;
             HiddenLabel.Visible = false;
         }
         else
         {
             ErrorLabel.Text     = "Search Found No Relevant Results";
             HiddenTable.Visible = false;
             HiddenLabel.Visible = true;
         }
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append(@"<script type='text/javascript'>");
         sb.Append("$(function () {");
         sb.Append(" $('#Result').modal('show');});");
         sb.Append("</script>");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }