Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //Submit data to server. Check if account already exists, if not, save the new account
            //and update Session object. Redirects to member page.
            string imageString = Session["imageString"].ToString();

            if (imageString.Equals(TextBox4.Text))
            {
                EncryptionService.Service1Client proxy = new EncryptionService.Service1Client();
                Account account = new Account(proxy.encrypt(TextBox1.Text), proxy.encrypt(TextBox5.Text),
                                              proxy.encrypt(TextBox6.Text), proxy.encrypt(TextBox7.Text));
                if (!(account.find()))
                {
                    account.saveAccount();

                    if (Session["memberLoggedIn"] == null)
                    {
                        Session["memberLoggedIn"] = true;
                        Session["email"]          = proxy.encrypt(TextBox5.Text);
                        Response.Redirect("Member.aspx", false);
                    }
                }
                else
                {
                    //alert user if duplicat email/account
                    ClientScript.RegisterStartupScript(this.GetType(), "duplicateAccount", "duplicateAccount()", true);
                }
            }
            else
            {
                //alert user that image string failed
                TextBox4.Text = "";
                ClientScript.RegisterStartupScript(this.GetType(), "failed", "failed()", true);
                //use ASU service to get image and string
                ImageVerifier.ServiceClient proxy = new ImageVerifier.ServiceClient();
                Session["imageString"] = proxy.GetVerifierString(imageLength);
                Image1.ImageUrl        = Uri + Session["imageString"].ToString();
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //State manaegment with Session object
            if (Session["staff2LoggedIn"] == null)
            {
                Response.Redirect("Default.aspx", false);
            }
            else
            {
                //asp table to show customer/user data for level 2 staff
                Account account = new Account();
                EncryptionService.Service1Client proxy = new EncryptionService.Service1Client();
                string[] emails = account.getallEmails();

                int rowCt = emails.Length;
                int row;
                int colCt = 6;
                int col;
                for (row = 1; row <= rowCt; row++)
                {
                    TableRow tableRow = new TableRow();
                    Table1.Rows.Add(tableRow);
                    for (col = 1; col <= colCt; col++)
                    {
                        TableCell cell = new TableCell();
                        if (col <= 4)
                        {
                            cell.Text = proxy.decrypt(account.getStaff2Data(emails[row - 1])[col - 1]);
                        }
                        else
                        {
                            cell.Text = account.getStaff2Data(emails[row - 1])[col - 1];
                        }
                        tableRow.Cells.Add(cell);
                    }
                }
            }
        }
        protected void LinkButton_Click(object sender, EventArgs e)
        {
            //Manage session states after login
            //Assign session variables to specific roles after login
            //validate login
            Account account = new Account();

            EncryptionService.Service1Client proxy = new EncryptionService.Service1Client();
            if (account.validate(proxy.encrypt(TextBox1.Text), proxy.encrypt(TextBox2.Text)))
            {
                string role = account.getGroup(proxy.encrypt(TextBox1.Text));
                if (role == "Customer")
                {
                    Session["memberLoggedIn"] = true;
                    Session["email"]          = proxy.encrypt(TextBox1.Text);
                    Response.Redirect("Member.aspx", false);
                }
                else if (role == "Staff1")
                {
                    Session["staff1LoggedIn"] = true;
                    Session["email"]          = proxy.encrypt(TextBox1.Text);
                    Response.Redirect("Staff1.aspx", false);
                }
                else if (role == "Staff2")
                {
                    //Staff 2 has access to all groups
                    Session["staff1LoggedIn"] = true;
                    Session["staff2LoggedIn"] = true;
                    Session["memberLoggedIn"] = true;
                    Session["email"]          = proxy.encrypt(TextBox1.Text);
                    Response.Redirect("Staff2.aspx", false);
                }
            }
            else
            {
                Response.Write("<script>alert('Incorrect email or incorrect password. Have you registered yet?');</script>");
            }
        }
Exemple #4
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     EncryptionService.Service1Client proxy = new EncryptionService.Service1Client();
     TextBox4.Text = proxy.decrypt(TextBox3.Text);
 }