示例#1
0
 public Booking GetBookingDetails(string bookingID)
 {
     try
     {
         SqlDataReader rd      = HRSBookingDALObject.GetBookingDetails(bookingID);
         Booking       booking = new Booking();
         while (rd.Read())
         {
             booking.HotelID       = rd["HotelID"].ToString();
             booking.BookingDate   = DateTime.Parse(rd["BookingDate"].ToString());
             booking.ArrivalDate   = DateTime.Parse(rd["ArrivalDate"].ToString());
             booking.DepartureDate = DateTime.Parse(rd["DepartureDate"].ToString());
             booking.NoOfAdults    = Convert.ToInt32(rd["NoOfAdults"].ToString());
             booking.NoOfChildren  = Convert.ToInt32(rd["NoOfChildren"].ToString());
             booking.NoOfNights    = Convert.ToInt32(rd["NoOfNights"].ToString());
             booking.RoomType      = rd["RoomType"].ToString();
             booking.TotalRooms    = Convert.ToInt32(rd["TotalRooms"].ToString());
         }
         return(booking);
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
 protected void SubmitButton_Click(object sender, EventArgs e)
 {
     try
     {
         Transaction    transaction      = new Transaction();
         HRSPaymentsBLL paymentBLLObject = new HRSPaymentsBLL();
         transaction.CustomerID    = Session["userId"].ToString();
         transaction.BookingID     = BookingIDDropDownList.SelectedItem.ToString();
         transaction.Amount        = Convert.ToInt32(AmountTextBox.Text.ToString());
         transaction.CardNo        = Convert.ToInt64(CreditCardNoTextBox.Text.ToString());
         transaction.DateTimeOfTXN = DateTime.Now;
         transaction.TXNStatus     = HRSConstants.SUCCESS;
         var transactionID = paymentBLLObject.AddTransactionDetails(transaction);
         if (!string.IsNullOrEmpty(transactionID))
         {
             string display = "Payment Successfully Done." + "\n" + "Transaction ID: " + transactionID;
             ErrorMessageLabel.Text = display;
         }
         else
         {
             ErrorMessageLabel.Text = HRSConstants.FAILED;
         }
         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)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (!Session["userId"].ToString().EndsWith(HRSConstants.ADMINENDSTRING))
             {
                 FormsAuthentication.SignOut();
                 Session.Clear();
             }
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             countries         = customerBLLObject.GetCountry();
             CountryDropDownList.DataSource     = countries;
             CountryDropDownList.DataTextField  = "Value";
             CountryDropDownList.DataValueField = "Key";
             CountryDropDownList.DataBind();
         }
         catch (Exception ex)
         {
             ExceptionUtility.ExceptionLog(ex);
             throw;
         }
     }
 }
示例#4
0
 public int UpdateBookingDetails(Booking booking)
 {
     try
     {
         return(HRSBookingDALObject.UpdateBookingDetails(booking));
     }
     catch (Exception ex)
     {
         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;
     }
 }
示例#6
0
 public List <string> GetBookingIDForTXN(string customerID)
 {
     try
     {
         SqlDataReader rd       = HRSBookingDALObject.GetBookingIDForTXN(customerID);
         List <string> bookings = new List <string>();
         while (rd.Read())
         {
             bookings.Add(rd["BookingID"].ToString());
         }
         return(bookings);
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#7
0
 protected void StateDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         var             cities            = customerBLLObject.GetCity(Convert.ToInt32(StateDropDownList.SelectedItem.Value));
         CityDropDownList.DataSource     = cities;
         CityDropDownList.DataTextField  = "Value";
         CityDropDownList.DataValueField = "Key";
         CityDropDownList.DataBind();
         CityDropDownList.Focus();
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#8
0
 public int DeleteBookingDetails(string bookingID, string customerID)
 {
     try
     {
         int result = HRSBookingDALObject.DeleteBookingDetails(bookingID);
         if (result >= 1)
         {
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             customer          = customerBLLObject.GetCustomerDetailsById(customerID);
             SendEmail.SendEmail.CancelReservation(customerID, customer.EmailAddress, bookingID);
         }
         return(result);
     }
     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;
     }
 }
示例#10
0
 public string AddBookingDetails(Booking booking)
 {
     try
     {
         SqlDataReader result    = HRSBookingDALObject.AddBookingDetails(booking);
         string        bookingId = string.Empty;
         if (result.HasRows)
         {
             result.Read();
             bookingId = result["BookingID"].ToString();
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             customer          = customerBLLObject.GetCustomerDetailsById(booking.CustomerID);
             SendEmail.SendEmail.BookHotel(booking.CustomerID, customer.EmailAddress, bookingId);
         }
         return(bookingId);
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#11
0
 protected void SubmitButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSHotelsBLL hotelsBLLObject = new HRSHotelsBLL();
         Hotel        hotel           = new Hotel();
         hotel.HotelName        = HotelNameTextbox.Text;
         hotel.Country          = CountryDropDownList.SelectedItem.Text;
         hotel.City             = CityDropDownList.SelectedItem.Text;
         hotel.HotelDescription = HotelDescriptionTextBox.Text;
         hotel.NoOfACRooms      = Convert.ToInt32(NoOfACRoomsTextBox.Text);
         hotel.NoOfNACRooms     = Convert.ToInt32(NoOfNACRoomsTextBox.Text);
         hotel.RateAdultACRoom  = Convert.ToInt32(RateACAdultTextBox.Text);
         hotel.RateChildACRoom  = Convert.ToInt32(RateACChildTextBox.Text);
         hotel.RateAdultNACRoom = Convert.ToInt32(RateNACAdultTextBox.Text);
         hotel.RateChildNACRoom = Convert.ToInt32(RateNACChildTextBox.Text);
         string hotelID = hotelsBLLObject.AddHotelDetails(hotel);
         if (!string.IsNullOrEmpty(hotelID))
         {
             string display = "Hotel Added Successfully." + "\n" + "Hotel ID: " + hotelID;
             ErrorMessageLabel.Text = display;
         }
         else
         {
             ErrorMessageLabel.Text = "failed";
         }
         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)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#12
0
 public List <Booking> GetBookingsByHotelID(string hotelID)
 {
     try
     {
         SqlDataReader  bookingRD = HRSBookingDALObject.GetBookingsByHotelID(hotelID);
         List <Booking> bookings  = new List <Booking>();
         while (bookingRD.Read())
         {
             Booking booking = new Booking();
             booking.BookingID     = bookingRD["BookingID"].ToString();
             booking.ArrivalDate   = DateTime.Parse(bookingRD["ArrivalDate"].ToString());
             booking.DepartureDate = DateTime.Parse(bookingRD["DepartureDate"].ToString());
             booking.RoomType      = bookingRD["RoomType"].ToString();
             booking.TotalRooms    = Convert.ToInt32(bookingRD["TotalRooms"].ToString());
             bookings.Add(booking);
         }
         return(bookings);
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
示例#13
0
 public string AddUpdateBooking(Booking booking, bool isUpdate)
 {
     try
     {
         HRSBookingsBLL bookingBLLObject   = new HRSBookingsBLL();
         HRSHotelsBLL   hotelBLLObject     = new HRSHotelsBLL();
         int            noOfRoomsAvailable = 0;
         if ((booking.DepartureDate - booking.ArrivalDate).TotalDays > 7)
         {
             return("Difference between arrival and departure date must be maximum 7");
         }
         int totalPersonPerRoom = (booking.NoOfChildren + booking.NoOfAdults) / booking.TotalRooms;
         var bookingRD          = bookingBLLObject.GetBookingsByHotelID(booking.HotelID);
         var hotel = hotelBLLObject.GetHotelDetailsByID(booking.HotelID);
         if (booking.RoomType == HRSConstants.AC)
         {
             noOfRoomsAvailable = hotel.NoOfACRooms;
         }
         else
         {
             noOfRoomsAvailable = hotel.NoOfNACRooms;
         }
         foreach (var bookings in bookingRD)
         {
             if (bookings.ArrivalDate <= booking.DepartureDate && booking.ArrivalDate <= bookings.DepartureDate)
             {
                 if (bookings.RoomType == booking.RoomType)
                 {
                     noOfRoomsAvailable -= bookings.TotalRooms;
                 }
             }
         }
         if (totalPersonPerRoom <= 4)
         {
             if (noOfRoomsAvailable >= booking.TotalRooms)
             {
                 if (isUpdate)
                 {
                     int result = bookingBLLObject.UpdateBookingDetails(booking);
                     if (result >= 1)
                     {
                         return("Successfully Saved");
                     }
                     else
                     {
                         return("Error Occured");
                     }
                 }
                 else
                 {
                     string bookingID = bookingBLLObject.AddBookingDetails(booking);
                     if (!string.IsNullOrEmpty(bookingID))
                     {
                         return(bookingID);
                     }
                     else
                     {
                         return("Error Occured");
                     }
                 }
             }
             else
             {
                 return("Sorry! Required rooms are not available for you inputs.\nModify your inputs or search hotel before booking.");
             }
         }
         else
         {
             return("Total person per room must not exceed 4");
         }
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }