protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { HRSHotelsBLL hotelsBLLObject = new HRSHotelsBLL(); var hotelIds = hotelsBLLObject.GetHotelsID(); HotelIDDropDownList.DataSource = hotelIds; HotelIDDropDownList.DataTextField = "Value"; HotelIDDropDownList.DataValueField = "Key"; HotelIDDropDownList.DataBind(); BookingDateTextbox.Text = DateTime.Now.ToString("MM/dd/yyyy"); NoOfNightsTextBox.Text = string.Empty; HotelIDDropDownList.SelectedValue = Request.QueryString["field"]; } if (IsPostBack) { if (ArrivalDateTextBox.Text != "" && DepartureDateTextbox.Text != "") { DateTime arrivalDate = DateTime.Parse(ArrivalDateTextBox.Text.ToString()); DateTime departureDate = DateTime.Parse(DepartureDateTextbox.Text.ToString()); int noOfNights = (int)(departureDate - arrivalDate).TotalDays; NoOfNightsTextBox.Text = noOfNights.ToString(); } } ArrivalDateTextBox.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd"); DepartureDateTextbox.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd"); } catch (Exception ex) { Utility.ExceptionUtility.ExceptionLog(ex); throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (!Session["userId"].ToString().EndsWith(Utility.HRSConstants.ADMINENDSTRING)) { FormsAuthentication.SignOut(); Session.Clear(); } HRSHotelsBLL hotelsBLLObject = new HRSHotelsBLL(); var HotelIds = hotelsBLLObject.GetHotelsID(); HotelIDDropDownList.DataSource = HotelIds; HotelIDDropDownList.DataTextField = "Value"; HotelIDDropDownList.DataValueField = "Key"; HotelIDDropDownList.DataBind(); } hidden.Visible = false; } catch (Exception ex) { Utility.ExceptionUtility.ExceptionLog(ex); throw; } }