Beispiel #1
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL CustomerBLLObject = new HRSCustomersBLL();
         string          userId            = UserIDTextbox.Text;
         string          password          = LoginPasswordTextbox.Text;
         bool            isAuthenticated   = CustomerBLLObject.VerifyUser(userId, password);
         if (isAuthenticated)
         {
             FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
             Session["userId"] = userId;
             Response.Redirect("SearchHotel.aspx");
         }
         else
         {
             ErrorMessageLabel.Text = "Invalid Username or Password";
             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;
     }
 }
Beispiel #2
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();

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$(function () {");
                sb.Append(" $('#Register').modal('show');});");
                sb.Append("</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
                CityDropDownList.Focus();
            }
            catch (Exception ex)
            {
                Utility.ExceptionUtility.ExceptionLog(ex);
                throw;
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             countries         = customerBLLObject.GetCountry();
             CountryDropDownList.DataSource     = countries;
             CountryDropDownList.DataTextField  = "Value";
             CountryDropDownList.DataValueField = "Key";
             CountryDropDownList.DataBind();
         }
         else
         {
             PasswordTextBox.Attributes.Add("value", PasswordTextBox.Text);
             ConfirmPassword.Attributes.Add("value", ConfirmPassword.Text);
         }
         DateOfBirthTextbox.Attributes["max"] = DateTime.Now.ToString("yyyy-MM-dd");
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["userId"] == null)
         {
             hidden.Visible = false;
         }
         if (!IsPostBack)
         {
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             countries         = customerBLLObject.GetCountry();
             CountryDropDownList.DataSource     = countries;
             CountryDropDownList.DataTextField  = "Value";
             CountryDropDownList.DataValueField = "Key";
             CountryDropDownList.DataBind();
         }
         CheckInTextBox.Attributes["min"]  = DateTime.Now.ToString("yyyy-MM-dd");
         CheckOutTextBox.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
         HiddenLabel.Visible = false;
         HiddenTable.Visible = false;
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #5
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;
         }
     }
 }
Beispiel #6
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         string          userId            = UserIDTextbox.Text;
         string          password          = PasswordTextbox.Text;
         bool            isAuthenticated   = customerBLLObject.VerifyUser(userId, password);
         if (isAuthenticated)
         {
             if (Request.QueryString.Count >= 1)
             {
                 if (Request.QueryString["ReturnUrl"].ToString().Contains(Utility.HRSConstants.ADMIN))
                 {
                     if (userId.EndsWith(Utility.HRSConstants.ADMINENDSTRING))
                     {
                         FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                         Session["userId"] = userId;
                     }
                     else
                     {
                         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);
                         ErrorMessageLabel.Text = "Unathourised User";
                     }
                 }
                 else
                 {
                     FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                     Session["userId"] = userId;
                 }
             }
             else
             {
                 FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                 Session["userId"] = userId;
             }
         }
         else
         {
             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);
             ErrorMessageLabel.Text = "Invalid UserID or Password";
         }
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #7
0
 protected void SubmitButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         Customers       customer          = new Customers();
         customer.CustomerName    = CustomerNameTextbox.Text;
         customer.AccountPassword = PasswordTextBox.Text;
         customer.DateOfBirth     = DateTime.Parse(DateOfBirthTextbox.Text);
         customer.ContactNumber   = ContactNumberTextBox.Text;
         customer.EmailAddress    = EmailAddressTextBox.Text;
         customer.CustomerCountry = CountryDropDownList.SelectedItem.Text;
         customer.CustomerState   = StateDropDownList.SelectedItem.Text;
         customer.CustomerCity    = CityDropDownList.SelectedItem.Text;
         customer.CustomerPinCode = PinCodeTextBox.Text;
         DateTime zeroTime = new DateTime(1, 1, 1);
         TimeSpan span     = DateTime.Now - DateTime.Parse(DateOfBirthTextbox.Text);
         customer.Age = (zeroTime + span).Year - 1;
         if (customer.Age > 50)
         {
             customer.CustomerType = Utility.HRSConstants.SENIORCITIZEN;
         }
         else
         {
             customer.CustomerType = Utility.HRSConstants.NORMALCITIZEN;
         }
         var existingCustomer = customerBLLObject.GetCustomerDetailsByContactAndEmail(customer.ContactNumber, customer.EmailAddress);
         {
             if (!string.IsNullOrEmpty(existingCustomer))
             {
                 ErrorMessageLabel.Text = "User with same Contact or Email already exists";
             }
             else
             {
                 string customerID = customerBLLObject.InsertCustomerDetails(customer);
                 if (!string.IsNullOrEmpty(customerID))
                 {
                     ErrorMessageLabel.Text = "Registration Successful. \n Your UserID is: " + customerID;
                 }
                 else
                 {
                     ErrorMessageLabel.Text = "Registration 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)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #8
0
 protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         var             states            = customerBLLObject.GetState(Convert.ToInt32(CountryDropDownList.SelectedItem.Value));
         StateDropDownList.DataSource     = states;
         StateDropDownList.DataTextField  = "Value";
         StateDropDownList.DataValueField = "Key";
         StateDropDownList.DataBind();
         StateDropDownList.Focus();
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DateOfBirthTextbox.Attributes["max"] = DateTime.Now.ToString("yyyy-MM-dd");
         if (Session["userId"] != null)
         {
             if (Session["userId"].ToString().EndsWith(Utility.HRSConstants.ADMINENDSTRING))
             {
                 Response.Redirect("../Admin/AddHotel.aspx");
             }
             else
             {
                 Response.Redirect("SearchHotel.aspx");
             }
         }
         if (!IsPostBack)
         {
             HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
             var             countries         = customerBLLObject.GetCountry();
             CountryDropDownList.DataSource     = countries;
             CountryDropDownList.DataTextField  = "Value";
             CountryDropDownList.DataValueField = "Key";
             CountryDropDownList.DataBind();
         }
         else
         {
             PasswordTextBox.Attributes.Add("value", PasswordTextBox.Text);
             ConfirmPassword.Attributes.Add("value", ConfirmPassword.Text);
         }
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }