Esempio n. 1
0
        public void friendrequest()
        {
            return_ nn     = new return_();
            String  new_my = nn.bal_("unid", Session["unid"].ToString(), 4);

            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cnstring"].ToString();
            cn.Open();


            String        s   = " SELECT * FROM frndz where  cid=" + new_my + "  and status=0";
            SqlCommand    cmd = new SqlCommand(s, cn);
            SqlDataReader dr  = cmd.ExecuteReader();

            frndrequest.Controls.Add(new LiteralControl("<div class='table-responsive'>"));
            frndrequest.Controls.Add(new LiteralControl("<table  class='table cart-table table-striped'>"));
            frndrequest.Controls.Add(new LiteralControl("<thead>"));
            frndrequest.Controls.Add(new LiteralControl("<tr>"));
            frndrequest.Controls.Add(new LiteralControl("<th>Name</th>"));
            frndrequest.Controls.Add(new LiteralControl("<th>Accept</th>"));

            frndrequest.Controls.Add(new LiteralControl("<th>Reject</th>"));


            frndrequest.Controls.Add(new LiteralControl("</tr>"));
            frndrequest.Controls.Add(new LiteralControl("</thead>"));
            frndrequest.Controls.Add(new LiteralControl("<tbody>"));

            int count = 0;

            while (dr.Read())
            {
                count++;


                frndrequest.Controls.Add(new LiteralControl("<tr>"));

                retu_name na = new retu_name();


                string val_t = "";


                val_t = na.name_(Int32.Parse(dr[1].ToString()));



                frndrequest.Controls.Add(new LiteralControl("<td><span class='glyphicon glyphicon-user'></span> " + val_t));

                frndrequest.Controls.Add(new LiteralControl("</td>"));

                frndrequest.Controls.Add(new LiteralControl("<td><span class='glyphicon glyphicon-check'></span> "));
                LinkButton l = new LinkButton();
                l.Text        = "Accept";
                l.CommandName = dr[0].ToString();
                EventHandler eh = new EventHandler(accept);
                l.Click += eh;



                frndrequest.Controls.Add(l);

                frndrequest.Controls.Add(new LiteralControl("</td>"));
                frndrequest.Controls.Add(new LiteralControl("<td><span class='glyphicon glyphicon-trash'></span> "));
                LinkButton l1 = new LinkButton();
                l1.Text        = "Reject";
                l1.CommandName = dr[0].ToString();
                EventHandler eh1 = new EventHandler(reject_);
                l1.Click    += eh1;
                l1.ForeColor = System.Drawing.Color.IndianRed;

                frndrequest.Controls.Add(l1);

                frndrequest.Controls.Add(new LiteralControl("</td>"));

                frndrequest.Controls.Add(new LiteralControl("</tr>"));
            }
            frndrequest.Controls.Add(new LiteralControl("</tbody></table></div>"));

            cmd.Dispose();
            cn.Close();
            if (count == 0)
            {
                frndrequest.Controls.Add(new LiteralControl("No Friend Request Found"));
            }
        }
Esempio n. 2
0
        public void friendlist()
        {
            return_ nn     = new return_();
            String  new_my = nn.bal_("unid", Session["unid"].ToString(), 4);

            Label4.Text = new_my;
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cnstring"].ToString();
            cn.Open();


            String        s   = " SELECT * FROM frndz where (sid=" + new_my + " or cid=" + new_my + ")  and status=1";
            SqlCommand    cmd = new SqlCommand(s, cn);
            SqlDataReader dr  = cmd.ExecuteReader();

            frnd.Controls.Add(new LiteralControl("<div class='table-responsive'>"));
            frnd.Controls.Add(new LiteralControl("<table  class='table cart-table table-striped'>"));
            frnd.Controls.Add(new LiteralControl("<thead>"));
            frnd.Controls.Add(new LiteralControl("<tr>"));
            frnd.Controls.Add(new LiteralControl("<th>Name</th>"));
            frnd.Controls.Add(new LiteralControl("<th>Status</th>"));

            int iid = 0;

            frnd.Controls.Add(new LiteralControl("</tr>"));
            frnd.Controls.Add(new LiteralControl("</thead>"));
            frnd.Controls.Add(new LiteralControl("<tbody>"));
            int count = 0;

            while (dr.Read())
            {
                count++;


                frnd.Controls.Add(new LiteralControl("<tr>"));

                retu_name na = new retu_name();


                string val_t = "";
                if (dr[1].ToString().Equals(new_my))
                {
                    val_t = na.name_(Int32.Parse(dr[2].ToString()));
                    iid   = Int32.Parse(dr[2].ToString());
                }
                else if (dr[2].ToString().Equals(new_my))
                {
                    val_t = na.name_(Int32.Parse(dr[1].ToString()));
                    iid   = Int32.Parse(dr[1].ToString());
                }



                LinkButton b12 = new LinkButton();
                b12.Text = val_t;

                b12.Style.Add("font-size", "15px");
                b12.Attributes.Add("href", "javascript:register_popup('" + iid + "' , '" + val_t + "');");

                frnd.Controls.Add(new LiteralControl("<td><span class='glyphicon glyphicon-user'></span> "));
                frnd.Controls.Add(b12);
                frnd.Controls.Add(new LiteralControl("</td>"));

                frnd.Controls.Add(new LiteralControl("<td> <img src='css/d.png'  id='" + iid + "-i'   />"));


                frnd.Controls.Add(new LiteralControl("</td>"));

                frnd.Controls.Add(new LiteralControl("</tr>"));
            }
            frnd.Controls.Add(new LiteralControl("</tbody></table></div>"));

            cmd.Dispose();
            cn.Close();
            if (count == 0)
            {
                frnd.Controls.Add(new LiteralControl("No Friends  Found"));
            }
        }