Exemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     ServiceDeplyTanDao.Service1Client addService = new ServiceDeplyTanDao.Service1Client();
     try
     {
         if (addService.addAcoundt(TextBox1.Text, TextBox2.Text, 1) == "success")
         {
             Label1.Text      = "Successfully Added New User!";
             Label1.ForeColor = System.Drawing.Color.Green;
         }
         else if (addService.addAcoundt(TextBox1.Text, TextBox2.Text, 1) == "exist")
         {
             Label1.Text      = "Member Already Exists, Failed to Add";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
         else
         {
             Label1.Text      = "Something Went Wrong :( Failed to Add";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
         Label1.Visible = true;
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
     }
 }
Exemplo n.º 2
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     ServiceDeplyTanDao.Service1Client proxy = new ServiceDeplyTanDao.Service1Client();
     if (proxy.myAuthenticate(UserBox.Text, PassBox.Text))
     {
         HttpCookie myCookie = new HttpCookie("StaffCookieID");
         myCookie.Expires = DateTime.Now.AddMonths(-7);
         Response.Cookies.Add(myCookie);
         myCookie = new HttpCookie("MemberCookieID");
         FormsAuthentication.RedirectFromLoginPage(UserBox.Text, CheckBox1.Checked);
         usernameMaster = UserBox.Text;
         //SiteMaster.SetName(usernameMaster);
         myCookie["Name"] = UserBox.Text;
         myCookie["Pass"] = DllCrypto.Class1.Encrypt(PassBox.Text);
         myCookie.Expires = DateTime.Now.AddMonths(6);
         Response.Cookies.Add(myCookie);
         Session["username"] = UserBox.Text;
         Session["role"]     = "1";
         //Response.Redirect("Member/Member.aspx");
     }
     else
     {
         MessageLabel.Text = "Invalid Username or passowrd.";
     }
 }
Exemplo n.º 3
0
        protected void CreateButton_Click(object sender, EventArgs e)
        {
            bool resultM = false;

            ServiceDeplyTanDao.Service1Client proxy2 = new ServiceDeplyTanDao.Service1Client();

            try
            {
                if (!Session["generatedString"].Equals(VerifyStringBox.Text))
                {
                    ResultLabel.Text = "The string enter is incorrect, try it again!";
                }
                else
                {
                    ResultLabel.Text = Session["generatedString"].ToString();

                    if (!String.IsNullOrWhiteSpace(UserNameBox.Text) &&
                        !String.IsNullOrWhiteSpace(ConfirmPassBox.Text) &&
                        !String.IsNullOrWhiteSpace(PasswordBox.Text))
                    {
                        if (ConfirmPassBox.Text == PasswordBox.Text)
                        {
                            int    role     = 1;
                            String response = proxy2.addAcoundt(UserNameBox.Text, PasswordBox.Text, role);
                            if (response.Equals("success"))
                            {
                                Session["registration"] = "success";
                                ResultLabel.Text        = "Sucessfull Create Member accound ";
                                Response.Redirect("Login.aspx");
                            }
                            else if (response.Equals("exist"))
                            {
                                ResultLabel.Text = "The User name already exit! Pleae choose different user name. ";
                            }
                        }
                        else
                        {
                            ResultLabel.Text = "Password and Confirm Password does not match!" + ConfirmPassBox.Text + " " +
                                               PasswordBox.Text;
                        }
                    }
                    else
                    {
                        ResultLabel.Text = "PLease enter all require!";
                    }
                }
            }
            catch (Exception ex)
            {
                ResultLabel.Text = ex.ToString();
            }
        }
Exemplo n.º 4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         ServiceDeplyTanDao.Service1Client proxy = new ServiceDeplyTanDao.Service1Client();
         string[] response = new string[2];
         response = proxy.search(UserBox.Text, 1);
         if (response[0].Equals("notFound"))
         {
             MessageLabel.Text = "User names does not exit !";
         }
         else if (response[0].Equals(UserBox.Text))
         {
             HttpCookie myCookie = new HttpCookie("StaffCookieID");
             myCookie.Expires = DateTime.Now.AddMonths(-7);
             Response.Cookies.Add(myCookie);
             myCookie = new HttpCookie("MemberCookieID");
             string pass = response[1];
             pass = DllCrypto.Class1.Decrypt(pass);
             if (PassBox.Text.Equals(pass))
             {
                 myCookie["Name"] = UserBox.Text;
                 myCookie["Pass"] = DllCrypto.Class1.Encrypt(PassBox.Text);
                 myCookie.Expires = DateTime.Now.AddMonths(6);
                 Response.Cookies.Add(myCookie);
                 Session["username"] = UserBox.Text;
                 Session["role"]     = "1";
                 Response.Redirect("Member.aspx");
             }
             else
             {
                 MessageLabel.Text = "Incorrect password !";
             }
         }
         else
         {
             MessageLabel.Text = response[0].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageLabel.Text = ex.Message;
     }
 }
Exemplo n.º 5
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            //Clear contents
            TextBox3.Text = "";

            ServiceDeplyTanDao.Service1Client displayService = new ServiceDeplyTanDao.Service1Client();

            string xmlToDisplay = displayService.returnXML("Member.xml");

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(xmlToDisplay);


            foreach (XmlNode node in xmlDoc.SelectNodes("//Member"))
            {
                TextBox3.Text += "Member Username:    "******"user_name"].InnerText + "\n";
            }
        }
Exemplo n.º 6
0
 protected void Button3_Click(object sender, EventArgs e)
 {
     ServiceDeplyTanDao.Service1Client searchService = new ServiceDeplyTanDao.Service1Client();
     try
     {
         if (searchService.search(TextBox1.Text, 1)[0] == "notFound")
         {
             Label1.Text      = "Failed to Find User";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
         else
         {
             Label1.Text      = "Successfully Found User!";
             Label1.ForeColor = System.Drawing.Color.Green;
         }
         Label1.Visible = true;
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
     }
 }
Exemplo n.º 7
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     ServiceDeplyTanDao.Service1Client deleteService = new ServiceDeplyTanDao.Service1Client();
     try
     {
         if (deleteService.removeFromXML(TextBox1.Text, 1))
         {
             Label1.Text      = "Successfully Deleted User!";
             Label1.ForeColor = System.Drawing.Color.Green;
         }
         else
         {
             Label1.Text      = "Something Went Wrong :( Failed to Delete User";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
         Label1.Visible = true;
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
     }
 }