Example #1
0
    //////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////


    protected void lbtnFeedDetail_Click(object sender, EventArgs e)
    {
        GridViewRow          row = ((GridViewRow)((LinkButton)sender).NamingContainer);
        PopupControlExtender pce = row.FindControl("PopupControlExtenderTicker") as PopupControlExtender;

        ImageButton imbtnPhoto = (ImageButton)row.FindControl("imbtnPhoto");
        ImageButton imbtnVideo = (ImageButton)row.FindControl("imbtnVideo");
        HiddenField hfId       = (HiddenField)row.FindControl("HiddenFieldId");
        HiddenField hfWallId   = (HiddenField)row.FindControl("HiddenFieldWallId");

        TickerBO objClass = new TickerBO();

        objClass = TickerBLL.getTickerByTickerId(hfId.Value);



        string   sValue           = hfWallId.Value;
        GridView gridviewComments = (GridView)row.FindControl("GridViewComments");
        //LinkButton btn = (LinkButton)gvr.FindControl("LinkButton2");
        WallBO objWall = new WallBO();

        objWall = WallBLL.getWallByWallId(sValue);

        if (objWall.Type == Global.PHOTO || objWall.Type == Global.TAG_PHOTO)
        {
            imbtnPhoto.ImageUrl = "../../Resources/ThumbnailPhotos/" + objClass.EmbedPost + ".jpg";
            imbtnPhoto.Visible  = true;
        }
        if (objWall.Type == Global.VIDEO || objWall.Type == Global.TAG_VIDEO || objWall.Type == Global.POST_VIDEOLINK || objWall.Type == Global.TAG_VIDEOLINK)
        {
            imbtnVideo.Visible = true;
        }


        YouLikes(row);
        CountShare(row);
        gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, sValue, 2);
        gridviewComments.DataBind();
        Comment_YouLikes(row);

        pce.DataBind();
    }
Example #2
0
    protected void lbtnLike_Click(object sender, EventArgs e)
    {
        string               statuslike  = "like a post";
        GridViewRow          row         = ((GridViewRow)((LinkButton)sender).NamingContainer);
        LinkButton           linkLike    = (LinkButton)row.FindControl("lbtnLike");
        Label                labelLike   = (Label)row.FindControl("lblLike");
        Literal              literalpost = (Literal)row.FindControl("Literal1");
        HiddenField          hfId        = (HiddenField)row.FindControl("HiddenFieldWallId");
        HiddenField          hfType      = (HiddenField)row.FindControl("HiddenFieldType");
        HiddenField          hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedTickerPost");
        PopupControlExtender pce         = row.FindControl("PopupControlExtenderTicker") as PopupControlExtender;
        UserBO               objUser     = new UserBO();

        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());
        if (linkLike.Text == "Like")
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId      = hfId.Value;
            objClass.Type      = Global.WALL;
            objClass.UserId    = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName  = objUser.LastName;
            LikesBLL.insertLikes(objClass);
            labelLike.Text = "";
            linkLike.Text  = "UnLike";
            statuslike     = "like a post";
        }
        else
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId   = hfId.Value;
            objClass.Type   = Global.WALL;
            objClass.UserId = Session["UserId"].ToString();
            LikesBLL.unLikes(objClass);
            labelLike.Text = "";
            linkLike.Text  = "Like";
            statuslike     = "unlike a post";
        }

        pce.DataBind();

        /////////////////////////////////////Friends recent activities
        if (!userid.Equals(Session["UserId"].ToString()))
        {
            UserBO objFUser = new UserBO();
            objFUser = UserBLL.getUserByUserId(userid);

            WallBO objWall = new WallBO();
            objWall.PostedByUserId  = Session["UserId"].ToString();
            objWall.WallOwnerUserId = Session["UserId"].ToString();
            objWall.FirstName       = objUser.FirstName;
            objWall.LastName        = objUser.LastName;
            objWall.Post            = "Like a <a  href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post";
            objWall.AddedDate       = DateTime.Now;
            objWall.Type            = Global.PROFILE_CHANGE;
            WallBLL.insertWall(objWall);
        }
        ////////////////////////////////////////
        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////

        List <UserFriendsBO> list = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);

        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in list)
        {
            TickerBO objTicker = new TickerBO();


            objTicker.PostedByUserId    = Session["UserId"].ToString();
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName         = objUser.FirstName;
            objTicker.LastName          = objUser.LastName;
            objTicker.Post      = literalpost.Text;
            objTicker.Title     = statuslike;
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type      = Convert.ToInt32(hfType.Value);
            objTicker.EmbedPost = hfEmbedPost.Value;
            objTicker.WallId    = hfId.Value;
            TickerBLL.insertTicker(objTicker);
        }
        TickerBO objTickerUser = new TickerBO();


        objTickerUser.PostedByUserId    = Session["UserId"].ToString();
        objTickerUser.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUser.FirstName         = objUser.FirstName;
        objTickerUser.LastName          = objUser.LastName;
        objTickerUser.Post      = literalpost.Text;
        objTickerUser.Title     = statuslike;
        objTickerUser.AddedDate = DateTime.UtcNow;
        objTickerUser.Type      = Convert.ToInt32(hfType.Value);
        objTickerUser.EmbedPost = hfEmbedPost.Value;
        objTickerUser.WallId    = hfId.Value;

        TickerBLL.insertTicker(objTickerUser);
        ////////////////////////////////////////////////////////////////////////////////////
    }