Пример #1
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            string password = TextBox7.Text;

            MD5 md5Hash = MD5.Create();

            string hash = GetMd5Hash(md5Hash, password);


            hash = hash.Substring(3, 12);

            ARMEntities dbcontext = new ARMEntities();



            string imageURL = "~/Images/Defualt.png";

            if (Page.IsValid)
            {
                dbcontext.createUser(TextBox9.Text, TextBox6.Text, TextBox13.Text, TextBox5.Text, TextBox3.Text, TextBox10.Text, hash, TextBox4.Text,
                                     TextBox11.Text, TextBox12.Text, imageURL);


                ARMEntities            dbContext = new ARMEntities();
                getCustomerInfo_Result obj       = dbContext.getCustomerInfo(TextBox9.Text).FirstOrDefault();


                Session["userName"] = obj.userName;
                Session["name"]     = obj.userName;

                Session["imageURL"] = obj.imageURL;


                Response.Redirect("~/Customer/Home.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "hwaa", "alert('Invalid data');", true);
                Response.Redirect("~/Login.aspx");
            }
        }
Пример #2
0
        //Ecncrypt the pass word and send to database
        // <summary>
        // Redirecting to the relevent page depending on the user
        // </summary>
        // <param name="sender"></param>
        // <param name="e"></param>
        protected void Button2_Click(object sender, EventArgs e)
        {
            string password = TextBox2.Text;

            MD5 md5Hash = MD5.Create();

            string hash = GetMd5Hash(md5Hash, password);


            hash = hash.Substring(3, 12);



            int result = DBHnadler.validateUser(TextBox1.Text, hash);

            if (result == 1)
            {
                ARMEntities            dbContext = new ARMEntities();
                getCustomerInfo_Result obj       = dbContext.getCustomerInfo(TextBox1.Text).FirstOrDefault();


                Session["userName"] = obj.userName;
                Session["name"]     = obj.userName;

                Session["imageURL"] = obj.imageURL;


                Response.Redirect("~/Customer/Home.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "hwaa", "alert('Either username or password incorrect');", true);

                TextBox1.Text = "";
                TextBox2.Text = "";
            }
        }