Exemplo n.º 1
0
    protected void lbtnDeleteComment_Click(object sender, EventArgs e)
    {
        GridViewRow row  = ((GridViewRow)((LinkButton)sender).NamingContainer);
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");

        CommentsDAL.deleteComments(hfId.Value);
    }
Exemplo n.º 2
0
    protected void txtComments_TextChanged(object sender, EventArgs e)
    {
        GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);

        TextBox     txtcomments = (TextBox)row.FindControl("txtComments");
        HiddenField hfId        = (HiddenField)row.FindControl("HiddenFieldId");

        UserBO objUser = new UserBO();

        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        CommentsBO objClass = new CommentsBO();

        objClass.MyComments = txtcomments.Text;
        objClass.AtId       = hfId.Value;
        objClass.Type       = Global.WALL;
        objClass.UserId     = Session["UserId"].ToString();
        objClass.FirstName  = objUser.FirstName;
        objClass.LastName   = objUser.LastName;

        if (!objClass.MyComments.Equals(""))
        {
            CommentsDAL.insertComments(objClass);
        }

        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtcomments.ClientID + "').value = '';", true);

        GridView gridviewComments = (GridView)row.FindControl("GridViewComments");

        gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, hfId.Value, 2);
        gridviewComments.DataBind();

        LoadWall(50);
    }
Exemplo n.º 3
0
    // @@@@@@@@@@@@@@@@@@@@ by Nabeel
    protected void lbtnViewComments_Click(object sender, EventArgs e)
    {
        GridViewRow row  = ((GridViewRow)((LinkButton)sender).NamingContainer);
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");

        GridView gridviewComments = (GridView)row.FindControl("GridViewComments");

        gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, hfId.Value, 100);
        gridviewComments.DataBind();
    }
Exemplo n.º 4
0
    protected void InsertComments()
    {
        UserBO objUser = new UserBO();

        objUser = UserBLL.getUserByUserId(Userid);

        CommentsBO objClass = new CommentsBO();

        objClass.MyComments = txtComments.Text;
        objClass.AtId       = Photoid;
        objClass.Type       = Global.PHOTO;
        objClass.UserId     = Userid;
        objClass.FirstName  = objUser.FirstName;
        objClass.LastName   = objUser.LastName;

        if (!objClass.MyComments.Equals(""))
        {
            CommentsDAL.insertComments(objClass);
        }

        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtComments.ClientID + "').value = '';", true);
        List <string> lst = new List <string>();

        lst = CommentsDAL.getCommentsUserIdbyAtId(Global.PHOTO, Photoid);

        LoadDataListComments();
        if (Isfollow == true)
        {
            foreach (string item in lst)
            {
                UserBO objUserNotify = new UserBO();
                objUserNotify = UserBLL.getUserByUserId(item);
                msgtext       = "Dear Pyramid Plus user, Comments on your photos. ";
                NotificationBO objNotify = new NotificationBO();
                objNotify.MyNotification = "<a  href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> comments on <a  href=\"ViewPhoto.aspx?PhotoId=" + Photoid + "\">photo</a>";



                objNotify.AtId        = Photoid;
                objNotify.Type        = Global.PHOTO;
                objNotify.UserId      = item;
                objNotify.FirstName   = objUserNotify.FirstName;
                objNotify.LastName    = objUserNotify.LastName;
                objNotify.FriendId    = Userid;
                objNotify.FriendFName = objUser.FirstName;
                objNotify.FriendLName = objUser.LastName;
                objNotify.Status      = false;
                // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email);
                //sendEmail(objUserNotify.Email);
                NotificationBLL.insertNotification(objNotify);
            }
        }
    }
Exemplo n.º 5
0
    protected void txtComments_TextChanged(object sender, EventArgs e)
    {
        GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);

        TextBox     txtcomments = (TextBox)row.FindControl("txtComments");
        HiddenField hfId        = (HiddenField)row.FindControl("HiddenFieldWallId");

        UserBO objUser = new UserBO();

        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        CommentsBO objClass = new CommentsBO();

        objClass.MyComments = ConvertUrlsToLinks(txtcomments.Text);
        objClass.AtId       = hfId.Value;
        objClass.Type       = Global.WALL;
        objClass.UserId     = Session["UserId"].ToString();
        objClass.FirstName  = objUser.FirstName;
        objClass.LastName   = objUser.LastName;

        if (!objClass.MyComments.Equals(""))
        {
            CommentsDAL.insertComments(objClass);
        }

        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtcomments.ClientID + "').value = '';", true);

        GridView gridviewComments = (GridView)row.FindControl("GridViewComments");

        gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, hfId.Value, 2);
        gridviewComments.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            = " Comments on <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);
        }
        ////////////////////////////////////////
    }
Exemplo n.º 6
0
    protected void YouLikes()
    {
        foreach (GridViewRow gvr in GridViewWall.Rows)
        {
            if (gvr.RowType == DataControlRowType.DataRow)
            {
                LinkButton  linkLike      = (LinkButton)gvr.FindControl("lbtnLike");
                Label       labelLike     = (Label)gvr.FindControl("lblLike");
                LinkButton  linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser");
                HiddenField hfId          = (HiddenField)gvr.FindControl("HiddenFieldId");

                long likecount = LikesBLL.countPost(hfId.Value, Global.WALL);
                if (likecount > 0)
                {
                    linkLikeCount.Text = likecount.ToString() + " Users";
                }
                else
                {
                    linkLikeCount.Visible = false;
                }

                LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments");
                long       totalcomments     = CommentsDAL.countComment(hfId.Value, Global.WALL);
                if (totalcomments > 2)
                {
                    linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments";
                }
                else
                {
                    linkcountComments.Visible = false;
                }
                LikesBO objClass = new LikesBO();
                objClass.AtId   = hfId.Value;
                objClass.Type   = Global.WALL;
                objClass.UserId = Session["UserId"].ToString();
                bool islike = LikesBLL.youLikes(objClass);
                if (islike)
                {
                    labelLike.Text = "You Like This";
                    linkLike.Text  = "UnLike";
                }

                else
                {
                    labelLike.Text = "";
                    linkLike.Text  = "Like";
                }
            }
        }
    }
Exemplo n.º 7
0
    protected void LoadComments()
    {
        foreach (GridViewRow gvr in GridViewWall.Rows)
        {
            if (gvr.RowType == DataControlRowType.DataRow)
            {
                ImageButton imgbutton        = ((ImageButton)gvr.FindControl("imgCommentsUser"));
                string      sValue           = ((HiddenField)gvr.FindControl("HiddenFieldId")).Value;
                GridView    gridviewComments = (GridView)gvr.FindControl("GridViewComments");

                gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, sValue, 2);
                gridviewComments.DataBind();
                imgbutton.ImageUrl    = Global.PROFILE_PICTURE + Session["UserId"].ToString() + ".jpg";
                imgbutton.PostBackUrl = "ViewProfile.aspx?UserId=" + Session["UserId"].ToString();
            }
        }
    }
Exemplo n.º 8
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();
    }
Exemplo n.º 9
0
        public static List <Newsfeed> RankNewsFeed(List <Newsfeed> lst)
        {
            foreach (var post in lst)
            {
                post.AffinityScore = 0;
                post.PostWeight    = 0;

                if (post.Type == Global.PHOTO || post.Type == Global.TAG_PHOTO)
                {
                    post.PostWeight += Global.WEIGHT_PHOTO;
                }
                else
                if (post.Type == Global.VIDEO || post.Type == Global.TAG_VIDEO)
                {
                    post.PostWeight += Global.WEIGHT_VIDEO;
                }
                else
                if (post.Type == Global.TAG_VIDEOLINK)
                {
                    post.PostWeight += Global.WEIGHT_VIDEOLINK;
                }
                else
                if (post.Type == Global.TEXT_POST)
                {
                    post.PostWeight += Global.WEIGHT_TEXT;
                }
                long likesCount = LikesDAL.countPost(post._id.ToString(), Global.WALL);

                long sharesCount   = ShareDAL.countPost(post._id.ToString(), Global.WALL);
                long commentsCount = CommentsDAL.countComment(post._id.ToString(), Global.WALL);

                post.PostWeight += (int)likesCount;

                post.PostWeight += (int)sharesCount;
                post.PostWeight += (int)commentsCount;

                post.PostRank = post.PostWeight + post.AffinityScore;
            }
            return(lst);
        }
Exemplo n.º 10
0
 protected void LoadDataListComments()
 {
     DataList1.DataSource = CommentsDAL.getComments(Global.VIDEO, Photoid);
     DataList1.DataBind();
 }
Exemplo n.º 11
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///                                      POST LIKE MODULE                                         ////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////

    protected void YouLikes(GridViewRow gvr)
    {
        if (gvr.RowType == DataControlRowType.DataRow)
        {
            LinkButton  linkLike      = (LinkButton)gvr.FindControl("lbtnLike");
            Label       labelLike     = (Label)gvr.FindControl("lblLike");
            LinkButton  linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser");
            HiddenField hfId          = (HiddenField)gvr.FindControl("HiddenFieldWallId");
            HiddenField hfuserId      = (HiddenField)gvr.FindControl("HiddenFieldUserId");
            HiddenField hfdate        = (HiddenField)gvr.FindControl("HiddenFieldAddedDate");
            Label       labeldate     = (Label)gvr.FindControl("lblAddedDate");
            //  Literal literalpost = (Literal)gvr.FindControl("LiteralPost");
            //ImageButton imgbtn = (ImageButton)gvr.FindControl("ImageButton1");


            DateTime date = Convert.ToDateTime(hfdate.Value);
            labeldate.Text = TimeAgo(date);



            //if (literalpost.Text.IndexOf("width") > 0)
            //   imgbtn.Visible = false;

            long likecount = LikesBLL.countPost(hfId.Value, Global.WALL);
            if (likecount > 0)
            {
                linkLikeCount.Text = likecount.ToString() + " Likes";
            }
            else
            {
                linkLikeCount.Visible = false;
            }

            LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments");
            long       totalcomments     = CommentsDAL.countComment(hfId.Value, Global.WALL);
            if (totalcomments > 2)
            {
                linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments";
            }
            else
            {
                linkcountComments.Text = totalcomments.ToString() + " Comments";
            }
            if (totalcomments <= 0)
            {
                linkcountComments.Visible = false;
            }
            HiddenField Userownid  = (HiddenField)gvr.FindControl("HiddenFieldUserId");
            LinkButton  lbtnDelete = (LinkButton)gvr.FindControl("lbtnDelete");

            if (Userownid.Value.Equals(Session["UserId"].ToString()))
            {
                lbtnDelete.Visible = true;
            }

            LikesBO objClass = new LikesBO();
            objClass.AtId   = hfId.Value;
            objClass.Type   = Global.WALL;
            objClass.UserId = Session["UserId"].ToString();
            bool islike = LikesBLL.youLikes(objClass);
            if (islike)
            {
                labelLike.Text = "";
                linkLike.Text  = "UnLike";
            }

            else
            {
                labelLike.Text = "";
                linkLike.Text  = "Like";
            }
        }
    }
Exemplo n.º 12
0
 protected void LoadDataListComments()
 {
     DataListComments.DataSource = CommentsDAL.getComments(Global.PHOTO_ALBUM, Albumid);
     DataListComments.DataBind();
 }