예제 #1
0
        void fillfriend()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from friend where (receiver='" + Session["fname"].ToString() + "'or sender='" + Session["fname"].ToString() + "') and status='1' order by dor desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);

            a = new ArrayList();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr[1].ToString() == Session["fname"].ToString())
                {
                    a.Add(dr[2].ToString());
                }

                else
                {
                    a.Add(dr[1].ToString());
                }
            }


            foreach (object o in a)
            {
                LinkButton l = new LinkButton();
                l.Text = o.ToString();


                int t = A.chkpicstat(o.ToString());
                if (t == 0)
                {
                    if (A.chkgender(o.ToString()))
                    {
                        friend.Controls.Add(new LiteralControl("<li><img src='temp/b.jpg' alt='Profile Pics' width='55' height='60'>"));
                    }
                    else
                    {
                        friend.Controls.Add(new LiteralControl("<li><img src='temp/g.jpg' alt='Profile Pics' width='55' height='60'>"));
                    }
                }
                else
                {
                    friend.Controls.Add(new LiteralControl("<li><img src='Account/" + o.ToString() + "/p.jpg' alt='Profile Pics' width='55' height='60'>"));
                }

                friend.Controls.Add(new LiteralControl("</li>"));
            }
            cn.Close();
        }
예제 #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                if ((Path.GetExtension(FileUpload1.PostedFile.FileName).Substring(1) == "jpg") || (Path.GetExtension(FileUpload1.PostedFile.FileName).Substring(1) == "JPG"))
                {
                    abc A = new abc();

                    int t = A.chkpicstat(Session["uname"].ToString());
                    if (t == 0)
                    {
                        if (A.chkgender(Session["uname"].ToString()))
                        {
                            fi = new FileInfo(Server.MapPath("temp") + "\\b.jpg");
                            fi.CopyTo(Server.MapPath("Profileimg" + "\\" + Session["uname"].ToString()) + "\\p" + i + ".jpg");
                        }
                        else
                        {
                            fi = new FileInfo(Server.MapPath("temp") + "\\g.jpg");
                            fi.CopyTo(Server.MapPath("Profileimg" + "\\" + Session["uname"].ToString()) + "\\p" + i + ".jpg");
                        }
                    }
                    else
                    {
                        fi = new FileInfo(Server.MapPath("Account" + "\\" + Session["uname"].ToString()) + "\\p.jpg");
                        string        nn = Server.MapPath("Profileimg" + "\\" + Session["uname"].ToString());
                        DirectoryInfo d  = new DirectoryInfo(nn);
                        FileInfo[]    f  = d.GetFiles();
                        j = f.Count();
                        k = i + j;
                        fi.CopyTo(Server.MapPath("Profileimg" + "\\" + Session["uname"].ToString()) + "\\p" + k + ".jpg");
                    }
                    FileUpload1.SaveAs(Server.MapPath("Account" + "\\" + Session["uname"].ToString() + "\\p.jpg"));
                    SqlConnection cn = new SqlConnection();
                    cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
                    cn.Open();
                    string     str = "update reg set PStatus=1 where Email='" + Session["uname"].ToString() + "'";
                    SqlCommand cmd = new SqlCommand(str, cn);

                    cmd.ExecuteNonQuery();
                    cn.Close();
                }
                else
                {
                    alert1.Visible = true;
                    Label3.Text    = "OOPs! Only jpg Format images can be uploaded";
                }
            }
            catch
            {
                alert1.Visible = true;
                Label3.Text    = "OOPs! Choose the image you want to upload";
            }
        }
예제 #3
0
        void fillpendingreq()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from friend where receiver='" + Session["uname"].ToString() + "' and status='0' order by fid desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            r = new returnname();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Label  l = new Label();
                string s = r.name(dr[1].ToString());
                l.Text = s;
                request.Controls.Add(new LiteralControl("<div class='panel panel-default relative text-center'>"));
                A = new abc();
                int t = A.chkpicstat(dr[1].ToString());
                if (t == 0)
                {
                    if (A.chkgender(dr[1].ToString()))
                    {
                        request.Controls.Add(new LiteralControl("<img src='temp/b.jpg' class='media-object' height='50' width='60'  style='margin-top:10px'>"));
                    }
                    else
                    {
                        request.Controls.Add(new LiteralControl("<img src='temp/g.jpg' class='media-object' height='50' width='60'  style='margin-top:10px'>"));
                    }
                }
                else
                {
                    request.Controls.Add(new LiteralControl("<img src='Account/" + dr[1].ToString() + "/p.jpg' class='media-object' height='50' width='60'  style='margin-top:10px'>"));
                }
                request.Controls.Add(l);
                request.Controls.Add(new LiteralControl(" <div class='panel-body panel-boxed text-center'><div class='rating'>"));
                string str1 = "<a href='accept.aspx?reqid=" + dr[0].ToString() + "' class='btn btn-primary'>Accept</a>";
                request.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;"));
                string str2 = "<a href='reject.aspx?reqid=" + dr[0].ToString() + "' class='btn btn-danger'>Reject</a>";
                request.Controls.Add(new LiteralControl(str1));
                request.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;"));
                request.Controls.Add(new LiteralControl(str2));
                request.Controls.Add(new LiteralControl("</div><hr/></div></div>"));
                request.Controls.Add(new LiteralControl("<br/>"));
            }
            cn.Close();
        }
예제 #4
0
        public void notmsg()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from notification order by nid desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            int c = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                c++;
                if (a.Contains(dr[1].ToString()))
                {
                    abc A  = new abc();
                    int t1 = A.chkpicstat(dr[1].ToString());
                    if (t1 == 0)
                    {
                        if (A.chkgender(dr[1].ToString()))
                        {
                            noti.Controls.Add(new LiteralControl("<div class='media'><div class='media-left'><a href='#'><img src='temp/b.jpg' class='media-object' width='60' height='60'></a></div>"));
                        }
                        else
                        {
                            noti.Controls.Add(new LiteralControl("<div class='media'><div class='media-left'><a href='#'><img src='temp/g.jpg' class='media-object' width='60' height='60'></a></div>"));
                        }
                    }
                    else
                    {
                        noti.Controls.Add(new LiteralControl("<div class='media'><div class='media-left'><a href='#'><img src='Account/" + dr[1].ToString() + "/p.jpg'  class='media-object' width='60' height='60'></a></div>"));
                    }
                    returnname r = new returnname();
                    noti.Controls.Add(new LiteralControl("<div class='media-body message'><div class='panel panel-default'><div class='panel-heading panel-heading-white'><a href='#'>" + r.name(dr[1].ToString()) + "</a></div><div class='panel-body'><p>" + dr[2].ToString() + "</p></div></div></div></div>"));
                }
            }

            cmd.Dispose();
            cn.Close();
            if (c == 0)
            {
                noti.Controls.Add(new LiteralControl("<div class='panel panel-default'><div class='panel-body'><p style='text-align:center'>There are no notifications. </p></div></div>"));
            }
        }
예제 #5
0
        protected void follow()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from follow where followrec='" + Session["uname"].ToString() + "' ", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            int c = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                c++;
                abc A = new abc();
                int t = A.chkpicstat(dr[1].ToString());
                if (t == 0)
                {
                    if (A.chkgender(dr[1].ToString()))
                    {
                        dispfollow.Controls.Add(new LiteralControl("<a href='#' data-toggle='tooltip' data-placement='bottom' title='" + r.name(dr[1].ToString()) + "'><img src='temp/b.jpg' class='img-circle' width='50' height='50'></a>"));
                    }
                    else
                    {
                        dispfollow.Controls.Add(new LiteralControl("<a href='#' data-toggle='tooltip' data-placement='bottom' title='" + r.name(dr[1].ToString()) + "'><img src='temp/g.jpg' class='img-circle' width='50' height='50'></a>"));
                    }
                }
                else
                {
                    dispfollow.Controls.Add(new LiteralControl("<a href='#' data-toggle='tooltip' data-placement='bottom' title='" + r.name(dr[1].ToString()) + "'><img src='Account/" + dr[1].ToString() + "/p.jpg' class='img-circle' width='50' height='50'></a>"));
                }
            }
            if (c == 0)
            {
                dispfollow.Controls.Add(new LiteralControl("No Followers..."));
            }
        }
예제 #6
0
        void fillpen()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from friend where (receiver='" + Session["uname"].ToString() + "'or sender='" + Session["uname"].ToString() + "') and status='1' order by dor desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            int c = 0;

            a = new ArrayList();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                c++;
                if (dr[1].ToString() == Session["uname"].ToString())
                {
                    a.Add(dr[2].ToString());
                }

                else
                {
                    a.Add(dr[1].ToString());
                }
            }
            foreach (object o in a)
            {
                LinkButton b12 = new LinkButton();
                b12.Text = r.name(o.ToString());

                b12.Style.Add("font-size", "15px");
                b12.Attributes.Add("href", "javascript:register_popup('" + r.id1(o.ToString()) + "' , '" + r.name(o.ToString()) + "');");

                flist.Controls.Add(new LiteralControl("<table><tr><td><img src='img/d.png'  id='" + r.id1(o.ToString()) + "-i'   /></td>"));
                flist.Controls.Add(new LiteralControl("<td style='width:8px'></td>"));
                A = new abc();
                int t = A.chkpicstat(o.ToString());
                if (t == 0)
                {
                    if (A.chkgender(o.ToString()))
                    {
                        flist.Controls.Add(new LiteralControl("<td><img src='temp/b.jpg' alt='image' class='img-circle' width='60' height='60'></td>"));
                    }
                    else
                    {
                        flist.Controls.Add(new LiteralControl("<td><img src='temp/g.jpg' alt='image' class='img-circle' width='60' height='60'></td>"));
                    }
                }
                else
                {
                    flist.Controls.Add(new LiteralControl("<td><img src='Account/" + o.ToString() + "/p.jpg' alt='image' class='img-circle' width='60' height='60'></td>"));
                }
                flist.Controls.Add(new LiteralControl("<td style='width:15px'></td>"));
                flist.Controls.Add(new LiteralControl("<td>"));
                flist.Controls.Add(b12);
                flist.Controls.Add(new LiteralControl("</td></tr></table>"));
                //flist.Controls.Add(new LiteralControl("</li>"));
            }
            cn.Close();
            if (c == 0)
            {
                flist.Controls.Add(new LiteralControl("<p>No Friends yet...!</p>"));
            }
        }
예제 #7
0
        void fillpost()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from wallpost order by wid desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            r = new returnname();
            validfriend v1 = new validfriend();

            a.Add(Session["uname"].ToString());
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (a.Contains(dr[1].ToString()))
                {
                    if (v1.stat(dr[1].ToString()))
                    {
                        LinkButton l1 = new LinkButton();
                        l1.Text = "Like";
                        TextBox text = new TextBox();
                        text.Attributes["class"] = "form-control";
                        l1.CommandName           = dr[0].ToString();
                        l1.Click += new EventHandler(like_post);

                        text.ID = dr[0].ToString();

                        string s = r.name(dr[1].ToString());
                        text.AutoPostBack = true;
                        text.TextChanged += new EventHandler(send_comment);
                        A = new abc();
                        int t1 = A.chkpicstat(dr[1].ToString());
                        if (t1 == 0)
                        {
                            if (A.chkgender(dr[1].ToString()))
                            {
                                wall.Controls.Add(new LiteralControl("<div class='timeline-block'><div class='panel panel-default'><div class='panel-heading'><div class='media'><div class='media-left'> <a><img src='temp/b.jpg' class='media-object' width='60' height='60'></a></div><div class='media-body'><a class='pull-right text-muted'><i class='icon-reply-all-fill fa fa-2x '></i></a><a href='#'>" + s + "</a><span>on&nbsp;" + dr[3].ToString() + "</span></div></div></div><div class='panel-body'><p>" + dr[2].ToString().Replace(System.Environment.NewLine, "<br>") + "</p></div><div class='view-all-comments'><a href='#'><i class='fa fa-thumbs-o-up'></i>"));
                            }
                            else
                            {
                                wall.Controls.Add(new LiteralControl("<div class='timeline-block'><div class='panel panel-default'><div class='panel-heading'><div class='media'><div class='media-left'> <a><img src='temp/g.jpg' class='media-object' width='60' height='60'></a></div><div class='media-body'><a class='pull-right text-muted'><i class='icon-reply-all-fill fa fa-2x '></i></a><a href='#'>" + s + "</a><span>on&nbsp;" + dr[3].ToString() + "</span></div></div></div><div class='panel-body'><p>" + dr[2].ToString().Replace(System.Environment.NewLine, "<br>") + "</p></div><div class='view-all-comments'><a href='#'><i class='fa fa-thumbs-o-up'></i>"));
                            }
                        }
                        else
                        {
                            wall.Controls.Add(new LiteralControl(" <div class='timeline-block'><div class='panel panel-default'><div class='panel-heading'><div class='media'><div class='media-left'> <a><img src='Account/" + dr[1].ToString() + "/p.jpg' class='media-object' width='60' height='60'></a></div><div class='media-body'><a class='pull-right text-muted'><i class='icon-reply-all-fill fa fa-2x '></i></a><a href='#'>" + s + "</a><span>on&nbsp;" + dr[3].ToString() + "</span></div></div></div><div class='panel-body'><p>" + dr[2].ToString().Replace(System.Environment.NewLine, "<br>") + "</p></div><div class='view-all-comments'><a href='#'><i class='fa fa-thumbs-o-up'></i>"));
                        }
                        string[] b = dr[4].ToString().Split('/');
                        if (!A.islike(Session["uname"].ToString(), l1.CommandName))
                        {
                            wall.Controls.Add(l1);
                        }
                        if (dr[5].ToString() == "0")
                        {
                            wall.Controls.Add(new LiteralControl("</a><span></span></div><ul class='comments'>"));
                        }
                        else
                        {
                            wall.Controls.Add(new LiteralControl("</a><span> "));
                            for (int i = 0; i < b.Length; i++)
                            {
                                wall.Controls.Add(new LiteralControl(" " + b[i] + ""));
                            }
                            wall.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;" + dr[5].ToString() + "Likes</a></span></div><ul class='comments'>"));
                        }
                        cmd.Dispose();
                        cn.Close();
                        SqlConnection cn1 = new SqlConnection();
                        cn1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
                        SqlCommand        cmd1  = new SqlCommand("select * from comment order by cid asc", cn1);
                        DataSet           ds1   = new DataSet();
                        SqlDataAdapter    ad1   = new SqlDataAdapter(cmd1);
                        SqlCommandBuilder cmdb1 = new SqlCommandBuilder(ad1);
                        ad1.Fill(ds1);
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            string[] st = dr1[4].ToString().Split(' ');
                            if (dr1[1].ToString().Contains(text.ID))
                            {
                                wall.Controls.Add(new LiteralControl("<li class='media'><div class='media-left'><a href='#'>"));

                                int t = A.chkpicstat(dr1[2].ToString());
                                if (t == 0)
                                {
                                    if (A.chkgender(dr1[2].ToString()))
                                    {
                                        wall.Controls.Add(new LiteralControl("<img src='temp/b.jpg' class='media-object' width='60' height='60'>"));
                                    }
                                    else
                                    {
                                        wall.Controls.Add(new LiteralControl("<img src='temp/g.jpg' class='media-object' width='60' height='60'>"));
                                    }
                                }
                                else
                                {
                                    wall.Controls.Add(new LiteralControl("<img src='Account/" + dr1[2].ToString() + "/p.jpg' class='media-object' width='60' height='60'>"));
                                }
                                wall.Controls.Add(new LiteralControl("</a></div><div class='media-body'><a href='#' class='comment-author pull-left'>" + r.name(dr1[2].ToString()) + "</a><span>" + dr1[3].ToString() + "</span><div class='comment-date'>" + st[0] + "</div></div></li>"));
                            }
                        }
                        wall.Controls.Add(new LiteralControl(" <li class='comment-form'><div class='input-group'><span class='input-group-btn'><a href='#' class='btn btn-default'><i class='fa fa-comments'></i></a></span>"));

                        wall.Controls.Add(text);
                        wall.Controls.Add(new LiteralControl("</div></li></ul></div></div>"));

                        cmd1.Dispose();
                        cn1.Close();
                    }
                }
            }
        }
예제 #8
0
        void fillmessage()
        {
            r = new returnname();
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from message where (receiver='" + Session["uname"].ToString() + "'or sender='" + Session["uname"].ToString() + "') order by msgid desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            b = new ArrayList();
            b.Add(Session["uname"].ToString());
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (b.Contains(dr[1].ToString()))
                {
                    string sender = r.name(dr[1].ToString());
                    msg.Controls.Add(new LiteralControl("<div class='media'><div class='media-body message'><div class='panel panel-default'><div class='panel-heading panel-heading-white'><div class='pull-right'><small class='text-muted'>" + dr[4].ToString() + "</small></div><a href='#'>" + sender + "</a></div><div class='panel-body'>" + dr[3].ToString() + "</div></div></div><div class='media-right'>"));
                    abc A = new abc();
                    int t = A.chkpicstat(dr[1].ToString());
                    if (t == 0)
                    {
                        if (A.chkgender(dr[1].ToString()))
                        {
                            msg.Controls.Add(new LiteralControl("<img src='temp/b.jpg' alt='' class='media-object' width='60'></div></div><br/>"));
                        }
                        else
                        {
                            msg.Controls.Add(new LiteralControl("<img src='temp/g.jpg' alt='' class='media-object' width='60'></div></div><br/>"));
                        }
                    }
                    else
                    {
                        msg.Controls.Add(new LiteralControl("<img src='Account/" + dr[1].ToString() + "/p.jpg' alt='' class='media-object' width='60'></div></div><br/>"));
                    }
                }
                if (b.Contains(dr[2].ToString()))
                {
                    string receiver = r.name(dr[1].ToString());
                    int    t        = A.chkpicstat(dr[1].ToString());
                    if (t == 0)
                    {
                        if (A.chkgender(dr[1].ToString()))
                        {
                            msg.Controls.Add(new LiteralControl("<div class='media'><div class='media-left'><img src='temp/b.jpg' alt='' class='media-object' width='60'></div>  <div class='media-body message'><div class='panel panel-default'><div class='panel-heading panel-heading-white'><div class='pull-right'><small class='text-muted'>" + dr[4].ToString() + "</small></div><a href='#'>" + receiver + "</a></div><div class='panel-body'>" + dr[3].ToString() + "</div></div></div></div><br/>"));
                        }
                        else
                        {
                            msg.Controls.Add(new LiteralControl("<div class='media'><div class='media-left'><img src='temp/g.jpg' alt='' class='media-object' width='60'></div>  <div class='media-body message'><div class='panel panel-default'><div class='panel-heading panel-heading-white'><div class='pull-right'><small class='text-muted'>" + dr[4].ToString() + "</small></div><a href='#'>" + receiver + "</a></div><div class='panel-body'>" + dr[3].ToString() + "</div></div></div></div><br/>"));
                        }
                    }
                    else
                    {
                        msg.Controls.Add(new LiteralControl(" <div class='media'><div class='media-left'><img src='Account/" + dr[1].ToString() + "/p.jpg' alt='' class='media-object' width='60'></div>  <div class='media-body message'><div class='panel panel-default'><div class='panel-heading panel-heading-white'><div class='pull-right'><small class='text-muted'>" + dr[4].ToString() + "</small></div><a href='#'>" + receiver + "</a></div><div class='panel-body'>" + dr[3].ToString() + "</div></div></div></div><br/>"));
                    }
                }
            }
            cn.Close();
        }
예제 #9
0
        void fillfriend()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from friend where (receiver='" + Session["uname"].ToString() + "'or sender='" + Session["uname"].ToString() + "') and status='1' order by dor desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            int c = 0;

            a = new ArrayList();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                c++;
                if (dr[1].ToString() == Session["uname"].ToString())
                {
                    a.Add(dr[2].ToString());
                }

                else
                {
                    a.Add(dr[1].ToString());
                }
            }


            foreach (object o in a)
            {
                returnname r = new returnname();
                LinkButton l = new LinkButton();
                l.Text        = o.ToString();
                l.ForeColor   = System.Drawing.Color.White;
                l.Font.Name   = "Comic Sans MS";
                l.CommandName = r.name(o.ToString());
                l.Click      += new EventHandler(l_click);
                A             = new abc();
                int t = A.chkpicstat(o.ToString());
                if (t == 0)
                {
                    if (A.chkgender(o.ToString()))
                    {
                        frnds.Controls.Add(new LiteralControl("<li class='list-group-item active'><div class='media'><div class='media-left'><img src='temp/b.jpg' alt='' class='media-object' width='65' height='60'></div> <div class='media-body'><span class='user'>" + l.CommandName + ""));
                    }
                    else
                    {
                        frnds.Controls.Add(new LiteralControl("<li class='list-group-item active'><div class='media'><div class='media-left'><img src='temp/g.jpg' alt='' class='media-object' width='65' height='60'></div> <div class='media-body'><span class='user'>" + l.CommandName + ""));
                    }
                }
                else
                {
                    frnds.Controls.Add(new LiteralControl(" <li class='list-group-item active'><div class='media'><div class='media-left'><img src='Account/" + o.ToString() + "/p.jpg' alt='' class='media-object' width='65' height='60'></div> <div class='media-body'><span class='user'>" + l.CommandName + ""));
                }
                frnds.Controls.Add(l);
                frnds.Controls.Add(new LiteralControl("</span></div></div></li><hr/>"));
            }
            cn.Close();
            if (c == 0)
            {
                frnds.Controls.Add(new LiteralControl("<p>Sorry there are no friends whom you can chat.</p>"));
            }
        }
예제 #10
0
        void fillfriend()
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            SqlCommand        cmd  = new SqlCommand("select * from friend where (receiver='" + Session["uname"].ToString() + "'or sender='" + Session["uname"].ToString() + "') and status='1' order by dor desc", cn);
            DataSet           ds   = new DataSet();
            SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
            SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);

            ad.Fill(ds);
            int c = 0;

            a = new ArrayList();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr[1].ToString() == Session["uname"].ToString())
                {
                    a.Add(dr[2].ToString());
                }

                else
                {
                    a.Add(dr[1].ToString());
                }
            }


            foreach (object o in a)
            {
                c++;
                returnname r = new returnname();
                LinkButton l = new LinkButton();
                l.Text   = o.ToString();
                l.Click += new EventHandler(l_click);
                Button b  = new Button();
                Button b1 = new Button();
                b.Text  = "Follow";
                b1.Text = "Unfriend";
                b.Attributes["class"]  = "btn btn-default btn-sm";
                b1.Attributes["class"] = "btn btn-success btn-sm";
                b.CommandName          = l.Text;
                b1.CommandName         = l.Text;
                b.Click  += new EventHandler(b_click);
                b1.Click += new EventHandler(b1_click);
                panel.Controls.Add(new LiteralControl("<div class='col-md-6 col-lg-4 item'><div class='panel panel-default'><div class='panel-heading'><div class='media'><div class='pull-left'>"));
                abc A = new abc();
                int t = A.chkpicstat(o.ToString());
                if (t == 0)
                {
                    if (A.chkgender(o.ToString()))
                    {
                        panel.Controls.Add(new LiteralControl("<img src='temp/b.jpg' alt='People' class='media-object img-circle' width='40' height='40'>"));
                    }
                    else
                    {
                        panel.Controls.Add(new LiteralControl("<img src='temp/g.jpg' alt='People' class='media-object img-circle' width='40' height='40'>"));
                    }
                }
                else
                {
                    panel.Controls.Add(new LiteralControl("<img src='Account/" + o.ToString() + "/p.jpg' alt='People' class='media-object img-circle' width='40' height='40'>"));
                }
                panel.Controls.Add(new LiteralControl("</div><div class='media-body'><h4 class='media-heading margin-v-5'>"));
                panel.Controls.Add(new LiteralControl("" + r.name(o.ToString()) + "<br/>"));
                panel.Controls.Add(l);
                panel.Controls.Add(new LiteralControl("</h4></div></div></div><div class='panel-footer'><div class='row'><div class='col-xs-6 col-sm-6 col-md-6'>"));
                if (!v.isinfollow(Session["uname"].ToString(), b.CommandName))
                {
                    panel.Controls.Add(b);
                }
                panel.Controls.Add(new LiteralControl("</div><div class='col-xs-6 col-sm-6 col-md-6'>"));
                panel.Controls.Add(b1);
                panel.Controls.Add(new LiteralControl("</div></div></div></div></div>"));
            }
            cn.Close();
            if (c == 0)
            {
                panel.Controls.Add(new LiteralControl("<div class='panel panel-default'><div class='panel-body'><p style='text-align:center'>There is no Friends of your's search for Friends. </p></div></div>"));
            }
        }