protected void SignUp_Click(object sender, EventArgs e)
    {
        talk2it tq     = new talk2it();
        Random  r      = new Random();
        Random  random = new Random();
        string  r1     = "";
        int     i;

        for (i = 1; i < 11; i++)
        {
            r1 += random.Next(0, 9).ToString();
        }
        //  Response.Write(r1);
        string date1 = d1.SelectedValue + "-" + month.SelectedValue + "-" + year.SelectedValue;
        string e1    = email.Text;

        ////////////////////

        /* UnicodeEncoding uEncode = new UnicodeEncoding();
         * byte[] bytPassword = uEncode.GetBytes(pass1.Text);
         * SHA512Managed sha = new SHA512Managed();
         * byte[] hash = sha.ComputeHash(bytPassword);
         * string pass=Convert.ToBase64String(hash);
         *//////////////
        if (pass1.Text != pass2.Text)
        {
            notify.Text      = "Password do not match";
            notify.ForeColor = System.Drawing.Color.Red;
        }
        else
        if (notify.Text == "")
        {
            if (gender.SelectedValue == "Male")
            {
                tq.dodml("INSERT INTO users_tb(fname,lname,email,password,bdate,gender,image,status,a_code,isActive) VALUES('" + fname.Text + "','" + lname.Text + "','" + email.Text + "','" + pass1.Text + "'," + date1 + ",'M','default.png',0,'" + r1 + "',0)");
                notify.Text      = "User added successfully";
                notify.ForeColor = System.Drawing.Color.Green;
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Thank You For Joining IT...');", true);
                Response.Redirect("login.aspx");
            }
            else
            {
                tq.dodml("INSERT INTO users_tb(fname,lname,email,password,bdate,gender,image,status,a_code,isActive) VALUES('" + fname.Text + "','" + lname.Text + "','" + email.Text + "','" + pass1.Text + "'," + date1 + ",'F','default.png',0,'" + r1 + "',0)");
                notify.Text      = "User added successfully";
                notify.ForeColor = System.Drawing.Color.Green;
                Response.Write("<script>alert('Thank you for Joining to IT')</script>");
                Response.Redirect("login.aspx");
            }
        }
        cleardata();
    }
 protected void Upload(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
         FileUpload1.PostedFile.SaveAs(Server.MapPath("images/user/") + fileName);
         //Response.Write(fileName);
         talk2it t2i = new talk2it();
         //Response.Write("UPDATE users_tb SET image='" + fileName + "' WHERE uid=" + Session["uid"] + ";");
         t2i.dodml("UPDATE users_tb SET image='" + fileName + "' WHERE uid=" + Session["uid"] + ";");
         //Response.Write("Image Uploaded successfully");
         bind_image();
     }
 }
    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "archive")
        {
            string mid = e.CommandArgument.ToString();

            talk2it t2i = new talk2it();
            t2i.dodml("update messages_tb set archive_status=1 where mid= " + mid);

            dt = tq.getTable("SELECT users_tb.uid,users_tb.fname,users_tb.lname,messages_tb.* FROM users_tb ,messages_tb WHERE  messages_tb.rid=" + uid + " AND messages_tb.sid=users_tb.uid AND messages_tb.delete_status=0  AND messages_tb.archive_status=0 AND messages_tb.trash_status=0 ORDER BY messages_tb.date_time DESC");
            if (dt.Rows.Count != 0)
            {
                GridView2.DataSource = dt;
                GridView2.DataBind();
            }
        }
    }