Beispiel #1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (status.Value == "")
            {
            }
            else
            {
                SqlConnection cn = new SqlConnection();
                cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
                SqlCommand        cmd  = new SqlCommand("select * from wallpost", cn);
                DataSet           ds   = new DataSet();
                SqlDataAdapter    ad   = new SqlDataAdapter(cmd);
                SqlCommandBuilder cmdb = new SqlCommandBuilder(ad);
                ad.Fill(ds);

                DataRow dr = ds.Tables[0].NewRow();
                dr[1] = Session["uname"].ToString();
                dr[2] = status.Value;
                dr[3] = System.DateTime.Now.ToString();
                dr[5] = 0;
                ds.Tables[0].Rows.Add(dr);
                ad.Update(ds);
                cn.Close();
            }
            status.Value = "";
            wall.Controls.Clear();
            abc A = new abc();

            A.noti(Session["uname"].ToString(), 0);
            fillpost();
        }
Beispiel #2
0
        protected void send_comment(object sender, EventArgs e)
        {
            TextBox       t    = (TextBox)sender;
            string        wid  = t.ID;
            string        text = t.Text;
            SqlConnection cn   = new SqlConnection();

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

            ad.Fill(ds);
            DataRow dr = ds.Tables[0].NewRow();

            dr[1] = wid;
            dr[2] = Session["uname"].ToString();
            dr[3] = text;
            dr[4] = System.DateTime.Now.ToString();
            ds.Tables[0].Rows.Add(dr);
            ad.Update(ds);
            cn.Close();
            t.Text = "";
            abc A = new abc();

            A.noti(Session["uname"].ToString(), 2);
            wall.Controls.Clear();
            fillpost();
        }
        protected void b_click(object sender, EventArgs e)
        {
            Button        b    = (Button)sender;
            string        send = Session["uname"].ToString();
            string        rec  = b.CommandName;
            string        dos  = System.DateTime.Now.ToString();
            SqlConnection cn   = new SqlConnection();

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

            ad.Fill(ds);


            DataRow dr = ds.Tables[0].NewRow();

            dr[1] = send;
            dr[2] = rec;
            dr[3] = dos;
            ds.Tables[0].Rows.Add(dr);
            ad.Update(ds);

            cn.Close();
            abc A = new abc();

            A.noti(Session["uname"].ToString(), 3);
        }
Beispiel #4
0
        protected void like_post(object sender, EventArgs e)
        {
            LinkButton l   = (LinkButton)sender;
            string     wid = l.CommandName;

            string        pliked = string.Empty;
            int           clike  = 0;
            int           i      = 1;
            SqlConnection cn     = new SqlConnection();

            cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            cn.Open();
            string        str = "select * from wallpost where wid='" + wid + "'";
            SqlCommand    cmd = new SqlCommand(str, cn);
            SqlDataReader dr  = cmd.ExecuteReader();

            if (dr.Read())
            {
                if (dr[4].ToString() == "")
                {
                    pliked = Session["uname"].ToString();
                }
                else
                {
                    pliked = dr[4].ToString() + '/' + Session["uname"].ToString();
                }
                clike = Convert.ToInt32(dr[5].ToString()) + i;
            }
            dr.Close();
            cmd.ExecuteNonQuery();
            cn.Close();
            SqlConnection cn1 = new SqlConnection();

            cn1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ToString();
            cn1.Open();
            string     str1 = "update wallpost set peopleliked=@Peopleliked,likecount=@Likecount where wid='" + wid + "'";
            SqlCommand cmd1 = new SqlCommand(str1, cn1);

            SqlParameter p1 = new SqlParameter("Peopleliked", pliked);
            SqlParameter p2 = new SqlParameter("Likecount", clike);

            cmd1.Parameters.Add(p1);
            cmd1.Parameters.Add(p2);
            cmd1.ExecuteNonQuery();
            cn1.Close();
            abc A = new abc();

            A.noti(Session["uname"].ToString(), 1);
        }