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 = "";
     }
 }
 protected void Button3_Click(object sender, EventArgs e)
 {
     LoginRegisterSvcRef.Service1Client obj1 = new LoginRegisterSvcRef.Service1Client();
     String[] result1 = obj1.viewStaff();
     ListBox2.Items.Clear();
     foreach (string r1 in result1)
     {
         ListBox2.Items.Add(r1);
     }
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     LoginRegisterSvcRef.Service1Client obj = new LoginRegisterSvcRef.Service1Client();
     String[] result = obj.viewUser();
     ListBox1.Items.Clear();
     foreach (string r in result)
     {
         ListBox1.Items.Add(r);
     }
 }
        protected void Button6_Click(object sender, EventArgs e)
        {
            LoginRegisterSvcRef.Service1Client obj = new LoginRegisterSvcRef.Service1Client();
            string result = obj.deleteUser(TextBox3.Text, DropDownList2.Text);

            Label10.Text  = result;
            Label9.Text   = "";
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
        }
 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();
     }
 }
        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  = "";
        }
 protected void Button4_Click(object sender, EventArgs e)
 {
     LoginRegisterSvcRef.Service1Client obj1 = new LoginRegisterSvcRef.Service1Client();
     String[] result1 = obj1.viewManager();
     ListBox3.Items.Clear();
     foreach (string r1 in result1)
     {
         ListBox3.Items.Add(r1);
     }
     Label9.Text   = "";
     Label10.Text  = "";
     TextBox1.Text = "";
     TextBox2.Text = "";
     TextBox3.Text = "";
     TextBox4.Text = "";
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         LoginRegisterSvcRef.Service1Client obj = new LoginRegisterSvcRef.Service1Client();
         String[] result = obj.viewOrders();
         ListBox1.Items.Clear();
         foreach (string r in result)
         {
             ListBox1.Items.Add(r);
         }
     }
     catch (Exception ex)
     {
         ListBox1.Items.Clear();
         ListBox1.Items.Add("Error!" + ex.ToString());
     }
 }
Beispiel #9
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string  tot     = Request.QueryString["total"];
            decimal total   = Convert.ToDecimal(tot);
            Random  orderNo = new Random();

            if ((TextBox1.Text.Equals("")) || (TextBox2.Text.Equals("")) || (TextBox3.Text.Equals("")) || (TextBox4.Text.Equals("")) || (TextBox5.Text.Equals("")) || (TextBox6.Text.Equals("")))
            {
                Label3.Text = "Please fill in all the fields!";
            }
            else
            {
                NewsSvcRef.Service1Client obj = new NewsSvcRef.Service1Client();
                string result = obj.cardVerify(TextBox4.Text, DropDownList1.Text);
                if (result.Equals("Valid Card!"))
                {
                    int    orderNum = orderNo.Next(100000, 999999);
                    string date     = System.DateTime.Now.ToString();
                    LoginRegisterSvcRef.Service1Client obj1 = new LoginRegisterSvcRef.Service1Client();
                    string r = obj1.addOrder(orderNum, TextBox1.Text, TextBox2.Text, date, total);
                    if (r.Equals("Success"))
                    {
                        Label4.Text           = "";
                        Label5.Text           = "";
                        Label6.Text           = "";
                        Label7.Text           = "";
                        Label8.Text           = "";
                        Label9.Text           = "";
                        Label10.Text          = "";
                        Label11.Text          = "";
                        TextBox1.Visible      = false;
                        TextBox2.Visible      = false;
                        TextBox3.Visible      = false;
                        TextBox4.Visible      = false;
                        TextBox5.Visible      = false;
                        TextBox6.Visible      = false;
                        DropDownList1.Visible = false;
                        Button2.Visible       = false;
                        Label2.Text           = "Order placed succesfully! Your Order Number is: " + orderNum.ToString() + ". Thank you!";
                    }
                    else
                    {
                        Label4.Text           = "";
                        Label5.Text           = "";
                        Label6.Text           = "";
                        Label7.Text           = "";
                        Label8.Text           = "";
                        Label9.Text           = "";
                        Label10.Text          = "";
                        Label11.Text          = "";
                        TextBox1.Visible      = false;
                        TextBox2.Visible      = false;
                        TextBox3.Visible      = false;
                        TextBox4.Visible      = false;
                        TextBox5.Visible      = false;
                        TextBox6.Visible      = false;
                        DropDownList1.Visible = false;
                        Button2.Visible       = false;
                        Label2.Text           = r;
                    }
                }
                else
                {
                    Label3.Text = result;
                }
            }
        }