Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Globals.formTitle = "Sign In";
     Globals.subTitle = "Please complete the Sign In form below for downloading";
     Globals.vContent = string.Empty;
     if (IsPostBack)
     {
         bool isDownload = true;
         Globals.vContent = string.Empty;
          string password = Request.Form["password"];
         if (password.Length ==0)
         {
             Globals.vContent += "<li>Password is not valid</li>";
             isDownload = false;
             return;
         }
         string username = Request.Form["username"];
         if (username.Length == 0)
         {
             Globals.vContent += "<li>username is not valid</li>";
             isDownload = false;
             return;
         }
         wUser user = new wUser();
         user.Username = username;
         user.Password = password;
         if (!user.Login())
         {
             Globals.vContent += "<li>Username is not correct or password is wrong!!!</li>";
             isDownload = false;
             return;
         }
         if (isDownload)
         {
             //FormsAuthentication.SetAuthCookie(username, false);
             //FormsAuthenticationTicket fat = new FormsAuthenticationTicket(1,
             //username, DateTime.Now,
             //DateTime.Now.AddMinutes(10), false, "member",
             //FormsAuthentication.FormsCookiePath);
             //Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName,
             //    FormsAuthentication.Encrypt(fat)));
             wUser.currentUser = user;
             Response.Redirect("DownloadSuccess.aspx");
         }
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         wUser user = new wUser();
         user.Username = Request.Form["username"];
         user.Password = Request.Form["password"];
         if (user.Login())
         {
             Response.Write("SUCCESS");
         }
         else
         {
             Response.Write("FAIL");
         }
     }
     catch
     {
         Response.Write("FAIL");
     }
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Globals.vContent = string.Empty;
            Globals.formTitle = "Sign Up";
            Globals.subTitle = "Please complete the register form below for downloading";
            if (IsPostBack)
            {
                bool isDownload = true;
                Globals.vContent = string.Empty;
                string firstname = Request.Form["firstname"];
                if (firstname.Length == 0)
                {
                    Globals.vContent += "<li>'Họ' không hợp lệ.</li>";
                    isDownload = false;
                }
                string lastname = Request.Form["lastname"];
                if (lastname.Length ==0)
                {
                    Globals.vContent += "<li>'Tên' không hợp lệ.</li>";
                    isDownload = false;
                }
                string email = Request.Form["email"];
                if (!Globals.emailValid(email))
                {
                    Globals.vContent += "<li>'Email' không hợp lệ.</li>";
                    isDownload = false;
                }
                string password = Request.Form["password"];
                if (password.Length <1)
                {
                    Globals.vContent += "<li>Mật khẩu ít nhất phải 1 ký tự</li>";
                    isDownload = false;
                }
                string repassword = Request.Form["repassword"];
                if (repassword!=password)
                {
                    Globals.vContent += "<li>Nhập lại mật khẩu sai</li>";
                    isDownload = false;
                }
                string username = Request.Form["username"];
                if (username.Length < 1)
                {
                    Globals.vContent += "<li>Tên tài khoản ít nhất phải 1 ký tự</li>";
                    isDownload = false;
                }
                else
                if (!wUser.isValidUserName(username))
                {
                    Globals.vContent += "<li>Tên người dùng đã tồn tại</li>";
                    isDownload = false;
                }

                if (isDownload)
                {
                    wUser user = new wUser();
                    user.Email = email;
                    user.Firstname = firstname;
                    user.Lastname = lastname;
                    user.Password = password;
                    user.Username = username;
                    try
                    {
                        user.InsertNew();
                    }
                    catch
                    {
                        Globals.vContent = "Có lỗi trong quá trình tải về. Xin vui lòng thử lại, cảm ơn!";
                        return;
                    }
                    wUser.currentUser = user;
                    Response.Redirect("DownloadSuccess.aspx");
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Globals.vContent = string.Empty;
            Globals.formTitle = "Sign Up";
            Globals.subTitle = "Please complete the register form below for downloading";
            if (IsPostBack)
            {
                bool isDownload = true;
                Globals.vContent = string.Empty;
                string firstname = Request.Form["firstname"];
                if (firstname.Length == 0)
                {
                    Globals.vContent += "<li>'Họ' không hợp lệ.</li>";
                    isDownload = false;
                }
                string lastname = Request.Form["lastname"];
                if (lastname.Length ==0)
                {
                    Globals.vContent += "<li>'Tên' không hợp lệ.</li>";
                    isDownload = false;
                }
                string email = Request.Form["email"];
                if (!Globals.emailValid(email))
                {
                    Globals.vContent += "<li>'Email' không hợp lệ.</li>";
                    isDownload = false;
                }
                string password = Request.Form["password"];
                if (password.Length <=5)
                {
                    Globals.vContent += "<li>Mật khẩu ít nhất phải 6 ký tự</li>";
                    isDownload = false;
                }
                string repassword = Request.Form["repassword"];
                if (repassword!=password)
                {
                    Globals.vContent += "<li>Nhập lại mật khẩu sai</li>";
                    isDownload = false;
                }
                string username = Request.Form["username"];
                if (username.Length <= 5)
                {
                    Globals.vContent += "<li>Tên tài khoản ít nhất phải 6 ký tự</li>";
                    isDownload = false;
                }
                string phone = Request.Form["phone"];
                //if (phone.Length < 10)
                //{
                //    Globals.vContent += "<li>Số điện thoại không hợp lệ</li>";
                //    isDownload = false;
                //}
                string company = Request.Form["company"];
                //if (company.Length==0)
                //{
                //    Globals.vContent += "<li>Xin vui lòng nhập tên công ty</li>";
                //    isDownload = false;
                //}
                string stockcompany = Request.Form["stockcompany"];
                if (stockcompany.Length == 0)
                {
                    Globals.vContent += "<li>Xin vui lòng nhập tên công ty chứng khoán nơi bạn mở tài khoản.</li>";
                    isDownload = false;
                }
                else if (!wUser.isValidUserName(username))
                {
                    Globals.vContent += "<li>Tên người dùng đã tồn tại</li>";
                    isDownload = false;
                }

                if (isDownload)
                {
                    wUser user = new wUser();
                    user.Email = email;
                    user.Firstname = firstname;
                    user.Lastname = lastname;
                    user.Password = password;
                    user.Username = username;
                    user.StockCompany = stockcompany;
                    user.Company = company;
                    try
                    {
                        user.InsertNew();
                    }
                    catch
                    {
                        Globals.vContent = "Có lỗi trong quá trình tải về. Xin vui lòng thử lại, cảm ơn!";
                        return;
                    }
                    wUser.currentUser = user;
                    Response.Redirect("DownloadSuccess.aspx");
                }
                //if (firstname!=null)
                //{
                //    Response.Redirect("DownloadHandler.ashx?File=Quantum_0202beta.zip");
                //}
            }
        }