Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["uid"] == null && Session["email"] == null)
        {
            //Response.WriteFile("login.aspx");
            Response.Redirect("login.aspx");
        }
        else
        {
            uid   = Convert.ToInt32(Session["uid"]);
            email = Session["email"].ToString();
            //

            if (!IsPostBack)
            {
                load_data();
            }
        }
        talk2it t2i = new talk2it();

        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + "AND archive_status=0 AND trash_status=0 AND delete_status=0");
        msg_in.Text      = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE sid=" + Session["uid"]);
        msg_sent.Text    = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=1");
        msg_archive.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND trash_status=1");
        msg_trash.Text   = dt.Rows[0].ItemArray.GetValue(0).ToString();
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["uid"] == null && Session["email"] == null)
        {
            //Response.WriteFile("login.aspx");
            Response.Redirect("login.aspx");
        }
        else
        {
            uid   = Convert.ToInt32(Session["uid"]);
            email = Session["email"].ToString();
            //

            dt = tq.getTable("SELECT users_tb.uid,users_tb.fname,users_tb.lname,messages_tb.* FROM users_tb ,messages_tb WHERE  messages_tb.sid=" + 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();
            }
        }
        talk2it t2i = new talk2it();

        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=0 AND trash_status=0 AND delete_status=0");
        msg_in.Text      = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE sid=" + Session["uid"]);
        msg_sent.Text    = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=1");
        msg_archive.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND trash_status=1");
        msg_trash.Text   = dt.Rows[0].ItemArray.GetValue(0).ToString();
    }
Ejemplo n.º 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        talk2it tq = new talk2it();

        DataTable dt = tq.getTable("SELECT uid,status FROM users_tb WHERE email='" + email.Text + "' AND password='******' AND isBlocked='false'");

        if (dt.Rows.Count == 0)
        {
            notify.Text      = "Please signup to login";
            notify.ForeColor = System.Drawing.Color.Red;
            //notify.BackColor = System.Drawing.Color.Red;
        }
        else
        {
            if (dt.Rows[0].ItemArray.GetValue(1).ToString() == "1")
            {
                Session["uid"]   = dt.Rows[0].ItemArray.GetValue(0).ToString();
                Session["email"] = email.Text;
                Response.Redirect("admin_home.aspx");
            }
            else
            {
                Session["uid"]   = dt.Rows[0].ItemArray.GetValue(0).ToString();
                Session["email"] = email.Text;
                Response.Redirect("home.aspx");
            }
        }
    }
    public void bind_image()
    {
        talk2it t2i = new talk2it();

        ds1 = t2i.getds("SELECT image FROM users_tb WHERE uid=" + Session["uid"].ToString() + ";");

        DataList1.DataSource = ds1;
        DataList1.DataBind();
    }
Ejemplo n.º 5
0
    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();
     }
 }
Ejemplo n.º 7
0
    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();
            }
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["uid"] == null && Session["email"] == null)
        {
            Response.Redirect("login.aspx");
        }
        else
        {
            uidd = Session["uid"].ToString();
            bind_image();

            /*  string[] filePaths = Directory.GetFiles(Server.MapPath("images/user/"));
             * List<ListItem> files = new List<ListItem>();
             * foreach (string filePath in filePaths)
             * {
             *    string fileName = Path.GetFileName(filePath);
             *    files.Add(new ListItem(fileName, "images/user/" + fileName));
             * }
             * GridView1.DataSource = files;
             * GridView1.DataBind();*/
            talk2it t2i = new talk2it();
            dt               = new DataTable();
            dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=0 AND trash_status=0 AND delete_status=0");
            msg_in.Text      = dt.Rows[0].ItemArray.GetValue(0).ToString();
            dt               = new DataTable();
            dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE sid=" + Session["uid"]);
            msg_sent.Text    = dt.Rows[0].ItemArray.GetValue(0).ToString();
            dt               = new DataTable();
            dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=1");
            msg_archive.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
            dt               = new DataTable();
            dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND trash_status=1");
            msg_trash.Text   = dt.Rows[0].ItemArray.GetValue(0).ToString();

            int    uid   = Convert.ToInt32(Session["uid"]);
            string email = Session["email"].ToString();
        }

        dt = tq.getTable("SELECT * FROM users_tb  ");
        if (dt.Rows.Count != 0)
        {
            string name   = dt.Columns[1].ToString() + " " + dt.Columns[2].ToString();
            string gender = dt.Columns[6].ToString();
            string image  = dt.Columns[7].ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        bind_image();

        /*  string[] filePaths = Directory.GetFiles(Server.MapPath("images/user/"));
         * List<ListItem> files = new List<ListItem>();
         * foreach (string filePath in filePaths)
         * {
         *    string fileName = Path.GetFileName(filePath);
         *    files.Add(new ListItem(fileName, "images/user/" + fileName));
         * }
         * GridView1.DataSource = files;
         * GridView1.DataBind();*/
        talk2it t2i = new talk2it();

        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=0 AND trash_status=0 AND delete_status=0");
        msg_in.Text      = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE sid=" + Session["uid"]);
        msg_sent.Text    = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND archive_status=1");
        msg_archive.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
        dt               = new DataTable();
        dt               = t2i.getTable("SELECT count(*) FROM messages_tb WHERE rid=" + Session["uid"] + " AND trash_status=1");
        msg_trash.Text   = dt.Rows[0].ItemArray.GetValue(0).ToString();
        if (Session["uid"] == null && Session["email"] == null)
        {
            Response.Redirect("login.aspx");
        }
        else
        {
            int    uid   = Convert.ToInt32(Session["uid"]);
            string email = Session["email"].ToString();
            //Response.Write(uid);
            int f = 0, s = 0, r = 0;

            dt = tq.getTable("SELECT f_list,r_receive,r_send FROM friends_tb WHERE fid=" + uid);
            if (dt.Rows.Count != 0)
            {
                if (Convert.ToInt32(dt.Rows[0]) == uid)
                {
                    string[] separators = { "," };
                    string   value      = dt.Rows[0].ToString();
                    string[] words      = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var word in words)
                    {
                        f = f + 1;
                    }
                }
                //Console.WriteLine(word);
            }
            //int f_req=r-f;
        }

        dt = tq.getTable("SELECT * FROM users_tb  ");
        if (dt.Rows.Count != 0)
        {
            string name   = dt.Columns[1].ToString() + " " + dt.Columns[2].ToString();
            string gender = dt.Columns[6].ToString();
            string image  = dt.Columns[7].ToString();
        }
    }