protected void RegisterButton_Click(object sender, EventArgs e)
 {
     try
     {
         LoginRegisterSvcRef.Service1Client client = new LoginRegisterSvcRef.Service1Client();
         EncryptDecryptDLL.Class1           cl     = new EncryptDecryptDLL.Class1();
         string encryPassword        = cl.encryptMethod(Password.Text);
         string encryConfirmPassword = cl.encryptMethod(ConfirmPassword.Text);
         if (TextBox1.Text.Equals(myStr))
         {
             string result = client.registerUser(Username.Text, encryPassword, encryConfirmPassword, ZipCode.Text, Email.Text, CellNumber.Text, "Member");
             if (result.Equals("success"))
             {
                 Label1.Text         = "Registration Successful!";
                 LinkButton1.Visible = true;
                 Label2.Text         = " to login and proceed";
                 Username.Text       = "";
                 Email.Text          = "";
                 ZipCode.Text        = "";
                 CellNumber.Text     = "";
                 TextBox1.Text       = "";
                 loadCaptcha();
             }
             else
             {
                 loadCaptcha();
                 Label1.Text     = "Registration Error!";
                 Label2.Text     = "Try Again with proper credentials.";
                 Username.Text   = "";
                 Email.Text      = "";
                 ZipCode.Text    = "";
                 CellNumber.Text = "";
                 TextBox1.Text   = "";
             }
         }
         else
         {
             TextBox1.Text = "";
             loadCaptcha();
             Label1.Text         = "";
             LinkButton1.Visible = false;
             Label2.Text         = "Enter Correct Captcha!";
         }
     }
     catch (Exception ex)
     {
         loadCaptcha();
         Label1.Text = "Registration Error!";
         Label2.Text = ex.ToString();
     }
 }
Exemplo n.º 2
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            LoginRegisterSvcRef.Service1Client obj = new LoginRegisterSvcRef.Service1Client();
            EncryptDecryptDLL.Class1           c   = new EncryptDecryptDLL.Class1();
            string encPswd      = c.encryptMethod(TextBox2.Text);
            string encCnfrmPswd = c.encryptMethod(TextBox4.Text);
            string result       = obj.addUser(TextBox1.Text, encPswd, encCnfrmPswd, DropDownList1.Text);

            Label9.Text   = result;
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            Label10.Text  = "";
        }
Exemplo n.º 3
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         bool result;
         LoginRegisterSvcRef.Service1Client client = new LoginRegisterSvcRef.Service1Client();
         EncryptDecryptDLL.Class1           c      = new EncryptDecryptDLL.Class1();
         string encPswd = c.encryptMethod(Password.Text);
         if (TextBox1.Text.Equals(myStr))
         {
             result = client.login(Username.Text, encPswd, "Staff");
             if (result)
             {
                 HttpCookie usercookie = new HttpCookie("details");
                 usercookie["username"] = Username.Text;
                 usercookie["Role"]     = "Staff";
                 usercookie.Expires     = System.DateTime.Now.AddDays(30);
                 Response.Cookies.Add(usercookie);
                 //Response.Redirect("Home.aspx");
                 Response.Redirect("http://webstrar13.fulton.asu.edu/page0/StaffPage.aspx");
             }
             else
             {
                 result = client.login(Username.Text, encPswd, "Manager");
                 if (result)
                 {
                     HttpCookie usercookie = new HttpCookie("details");
                     usercookie["username"] = Username.Text;
                     usercookie["Role"]     = "Manager";
                     usercookie.Expires     = System.DateTime.Now.AddDays(30);
                     Response.Cookies.Add(usercookie);
                     //Response.Redirect("Home.aspx");
                     Response.Redirect("http://webstrar13.fulton.asu.edu/page0/StaffPage.aspx");
                 }
                 else
                 {
                     Label1.Text = "Login failed!";
                     Label2.Text = "Username or Password Incorrect.";
                     loadCaptcha();
                     TextBox1.Text = "";
                 }
             }
         }
         else
         {
             TextBox1.Text = "";
             loadCaptcha();
             Label1.Text = "";
             Label2.Text = "Enter Correct Captcha!";
         }
     }
     catch (Exception ex)
     {
         loadCaptcha();
         Label1.Text = "Error!" + ex.ToString();
         Label2.Text = "";
     }
 }