예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
            Response.Cache.SetValidUntilExpires(false);
            Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();

            if (Request.Form.Count != 0)
            {
                User user = new Models.User(Request.Form["username"], Request.Form["password"], Request.Form["customerId"], Request.Form["securityQuestion"], Request.Form["securityAnswer"], Request.Form["email"]);
                if (Models.User.TryRegister(user))
                {
                    Session.Add("customerId", user.CustomerId);
                    Response.Redirect("OrderStatus.aspx");
                }
                else
                {
                    Response.Redirect("Index.aspx?tab=register&error=true");
                }
            }
            else
                Response.Redirect("Index.aspx");
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
     Response.Cache.SetValidUntilExpires(false);
     Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
     Response.Cache.SetCacheability(HttpCacheability.NoCache);
     Response.Cache.SetNoStore();
     if (Request.Form.Count != 0 && Request.Form["username"] != null && Request.Form["password"] != null)
     {
         User user = new Models.User(Request.Form["username"], Request.Form["password"]);
         if (Models.User.IsRegistered(user))
         {
             user.LoadUserDetails();
             Session.Add("customerId", user.CustomerId);
             Response.Redirect("OrderStatus.aspx");
         }
         else
         {
             Response.Redirect("Index.aspx?tab=login&error=true");
         }
     }
     else
         Response.Redirect("Index.aspx");
 }
예제 #3
0
 public static bool TryRegister(User user)
 {
     if (DataAccessHelper.IsUserNameAvailable(user.Username) && DataAccessHelper.IsCustomerIdAvailable(user.CustomerId) && ServiceJsonHelper.PullProfile(user.CustomerId) != null)
     {
         DataAccessHelper.RegisterUser(user);
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #4
0
 public static bool IsRegistered(User user)
 {
     return DataAccessHelper.IsUserExists(user);
 }