Example #1
0
        public string SendEventPost(string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();
            DateTime         startDateD       = reusable_Methods.FormatDateFromDateTimePicker(startDate);
            DateTime         endDateD         = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int        postId      = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {
                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();
            }
            return(concatinater.ToString());

            #endregion
        }
Example #2
0
        private string BuildSingleMessage(DataTable table)
        {
            string        date         = null;
            StringBuilder concatinater = new StringBuilder();

            foreach (DataRow row in table.Rows)
            {
                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(DateTime.Parse((row["DateTime"]).ToString()));
                //date = Convert.ToDateTime(row["DateTime"]).ToString("M");

                //Building single message view box
                concatinater.Append("<div class='SingleViewmsgeWrapper' id='");
                concatinater.Append(row["messageID"].ToString());

                ////concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a class='btnMemberProfile' id='");
                concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a href='#' class='btnMemberProfile replyMsge' style='font-weight:normal; font-size: 1.2em; ' id='");
                concatinater.Append(row["FriendID"].ToString());
                concatinater.Append("' >");
                concatinater.Append(row["Friend"].ToString());
                concatinater.Append("</a><span class='DateWithTime ui-corner-all floatright' style='font-size: 1.2em;' >  ");
                concatinater.Append(date);
                concatinater.Append("</span></h2> </div>");
                concatinater.Append("<p class=''>");
                concatinater.Append(row["MessageText"].ToString());
                concatinater.Append("</p></div>");
            }
            return(concatinater.ToString());
        }
Example #3
0
        public string FriendRequestAcceptedNotification()
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Reusable_Methods reusable_Methods = new Reusable_Methods(aMember);

            return(reusable_Methods.FriendRequestAcceptedNotifications());
        }
Example #4
0
        public string MessageNotification()
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Reusable_Methods reusable_Methods = new Reusable_Methods(aMember);

            return(reusable_Methods.MessageNotifications());
        }
Example #5
0
        public int[] GetAllNotifications()
        {
            Member           aMember          = new Member(Context.Session["memberID"].ToString());
            Reusable_Methods reusable_Methods = new Reusable_Methods(aMember);

            int messages       = reusable_Methods.CountMessageNotifications();
            int friendRequests = reusable_Methods.CountFriendRequestSentNotifications();
            int tags           = reusable_Methods.CountTagNotifications();
            int events         = reusable_Methods.CountEventNotifications();



            int[] notifications = new int[10];
            notifications[0] = messages;
            notifications[1] = friendRequests;
            notifications[2] = tags;
            notifications[3] = events;

            return(notifications);
        }
Example #6
0
        public string RefreshChats(int groupID)
        {
            ChatDAL             chatDAL = new ChatDAL();
            List <Article_Post> at      = chatDAL.getAllChats(groupID);
            string chatString           = null;

            foreach (var ChatMessage in at)
            {
                Group  group      = new Group(groupID);
                Member thisMember = new Member(ChatMessage.MemberID);


                //    Post post = new Post(postID);
                //  Article_Post thisArticle = chatDAL.getChatText(ref post);

                //BulabulaApp.Other_Classes. date new = reusable_Methods.FormatDateTime(aPost.CreateDate);
                Reusable_Methods reusable_Methods = new Reusable_Methods();
                string           date             = reusable_Methods.FormatDateTimeForChat(ChatMessage.CreateDate);
                thisMember = chatDAL.GetMemberDisplayName(thisMember);

                ChatText.Append(" <div class='chatMemberWrapper'>");
                ChatText.Append("<div class='memberNameSection  '> <a id=");
                ChatText.Append(thisMember.MemberId);
                ChatText.Append(" class='btnMemberProfile pointer' ><em>");
                ChatText.Append(thisMember.DisplayName);
                ChatText.Append("</em></a></div>");
                ChatText.Append("</a></div>");
                ChatText.Append("<div class='chatContentSection '>");
                ChatText.Append(ChatMessage.ArticleText);
                ChatText.Append("</div> <div class='clr'></div>");
                ChatText.Append("</div>");
                chatString = ChatText.ToString();
            }//end foreach

            return(chatString);
        }
        public string[] AddCommentnRefresh(int postID, string commentTxt, int lastCommentID)
        {
            NewsfeedDAL newsfeedDAL = new NewsfeedDAL();
            MessagesDAL messageDAL = new MessagesDAL();
            Comments comment = new Comments();
            StringBuilder commentBuilder = new StringBuilder();

            //Decrypting the member ID
            comment.MemberId = Context.Session["memberID"].ToString();

            comment.CommentText = commentTxt;
            comment.PostId = postID;
            comment.Commentid = lastCommentID;
            messageDAL.InsertComment(comment);

            //Insert notification
            NotificationDAL notificationDAL = new NotificationDAL();

            Post aPost = new Post(postID);

            List<Member> MemberList = new List<Member>();
            MemberList = notificationDAL.GetPostOwner(aPost);
            string friendId = MemberList[0].MemberId;
            Member aFriend = new Member(friendId);

            Member aMember = new Member(Context.Session["memberID"].ToString());

            if (aMember.MemberId != aFriend.MemberId)
            {
                notificationDAL.InsertCommentedOnPostNotification(aMember, aFriend, aPost);
            }

            //Refreshing the Comment count
            Post post = new Post();
            post.PostId = comment.PostId;

            //###################################
            //refreshing Comments
            //###################################

            DataTable comments = newsfeedDAL.GetRefreshComments(post, comment);

            foreach (DataRow row in comments.Rows)
            {
                date = Convert.ToDateTime(row["CreateDate"]).ToString("M");

                //Building single message view box
                commentBuilder.Append("<div id='");
                commentBuilder.Append((row["CommentID"]).ToString());

                commentBuilder.Append("' class='aComment'><div class='deleteComment floatright'>");

                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {

                    commentBuilder.Append("<a class='btnDleteComment ui-icon ui-icon-close tip' title='Delete this comment'></a>");
                }
                else
                {
                    commentBuilder.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..'></a>");
                }

                commentBuilder.Append("</div><h5><a style='font-weight:normal;' ");
                commentBuilder.Append("id='" + (row["MemberID"]).ToString() + "'> ");

                commentBuilder.Append(row["Friend"].ToString());
                commentBuilder.Append("</a><span class='DateWithTime ui-corner-all floatright'>");

                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                commentBuilder.Append(date);
                commentBuilder.Append("</span></h5><p>");
                commentBuilder.Append((row["CommentText"]).ToString());
                commentBuilder.Append("</p></div>");
                //End Building

            }
                        //Array with the       //number of commeents         //new comments
              var comentArray =  new string[] { messageDAL.CountComments(post).ToString(), commentBuilder.ToString()};

            return comentArray;
        }
        public string GetAllComments(int postID)
        {
            Post post = new Post();
            Comments comment = new Comments();
            MessagesDAL m = new MessagesDAL();
            string date = "";

            post.PostId = postID;
            StringBuilder comnt = new StringBuilder();
            DataTable comments = m.GetAllComments(post);

            foreach (DataRow row in comments.Rows)
            {

                Reusable_Methods reusable_Methods = new Reusable_Methods();

                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                //Building single message view box
                comnt.Append("<div id='");
                comnt.Append((row["CommentID"]).ToString());
                comnt.Append("' class='aComment'><div class='deleteComment floatright'>");

                comment.Commentid = int.Parse(row["CommentID"].ToString());

                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {

                    comnt.Append("<a class='btnDleteComment ui-icon ui-icon-close tip floatLeft' title='Delete this comment' ></a>");
                }
                else
                {
                    //comnt.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..' ></a>");
                     comnt.Append("<a class='button left big floatLeft likeComment '");

                      RateAndTagDAL dal = new RateAndTagDAL();

                            string memberId = Context.Session["memberID"].ToString();
                            Member amember = new Member(memberId);

                            //Check if member not liked
                            if (dal.CommentRatingExists(amember, comment) ==0)
                            {
                                //if member not liked
                                //concatinater.Append(" homeLikeBtn");
                                comnt.Append("' title='");
                                comnt.Append("Like this comment");
                                comnt.Append("'  >");
                                comnt.Append("Like");
                            }
                            else
                            {
                                //if member is liked
                              //  concatinater.Append(" homeUnlikeBtn");
                                comnt.Append("' title='");
                                comnt.Append("Unlike this comment");
                                comnt.Append("'  >");
                                comnt.Append("Unlike");
                            }

                            comnt.Append("</a>");

                     comnt.Append("<a class='button right big floatLeft reportComment' title='Report this comment'>Report </a>");
                }

                comnt.Append("</div><h5><a style='font-weight:normal;' ");
                comnt.Append("id='" + (row["MemberID"]).ToString() + "'> ");
                comnt.Append(row["Friend"].ToString());
                comnt.Append("</a><span class='DateWithTime ui-corner-all floatright'>");
                comnt.Append(date);
                comnt.Append("</span></h5><p>");
                comnt.Append((row["CommentText"]).ToString());
                comnt.Append("</p></div>");
                //End Building

            }

            return comnt.ToString();
            //End Refresh
        }
        public string[] AddFirstComment(string postID, string commentTxt)
        {
            Comments comment = new Comments();
            comment.MemberId = Context.Session["memberID"].ToString();
            comment.CommentText = commentTxt;
            Post post = new Post();
            post.PostId = int.Parse(postID);
            comment.PostId = post.PostId;
            messageDAL.InsertComment(comment);
            StringBuilder commentBuilder = new StringBuilder();

            //###################################
            //refreshing Comments
            //###################################
            DataTable comments = messageDAL.GetAllComments(post);

               // DataTable comments = newsFeedDAL.GetRefreshComments(post, comment);

            foreach (DataRow row in comments.Rows)
            {
                date = Convert.ToDateTime(row["CreateDate"]).ToString("M");

                //Building single message view box
                commentBuilder.Append("<div id='");
                commentBuilder.Append((row["CommentID"]).ToString());

                commentBuilder.Append("' class='aComment'><div class='deleteComment floatright'>");

                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {

                    commentBuilder.Append("<a class='btnDleteComment ui-icon ui-icon-close tip' title='Delete this comment'></a>");
                }
                else
                {
                    commentBuilder.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..'></a>");
                }

                commentBuilder.Append("</div><h5><a style='font-weight:normal;' ");
                commentBuilder.Append("id='" + (row["MemberID"]).ToString() + "'> ");

                commentBuilder.Append(row["Friend"].ToString());
                commentBuilder.Append("</a><span class='DateWithTime ui-corner-all floatright'>");

                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                commentBuilder.Append(date);
                commentBuilder.Append("</span></h5><p>");
                commentBuilder.Append((row["CommentText"]).ToString());
                commentBuilder.Append("</p></div>");
                //End Building

            }

            //Array with the       //number of commeents         //new comments
            var comentArray = new string[] { messageDAL.CountComments(post).ToString(), commentBuilder.ToString() };

            return comentArray;
        }
Example #10
0
        private string BuildSingleMessage(DataTable table)
        {
            string date = null;
            StringBuilder concatinater = new StringBuilder();

            foreach (DataRow row in table.Rows)
            {
                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(DateTime.Parse((row["DateTime"]).ToString()));
                //date = Convert.ToDateTime(row["DateTime"]).ToString("M");

                //Building single message view box
                concatinater.Append("<div class='SingleViewmsgeWrapper' id='");
                concatinater.Append(row["messageID"].ToString());

                ////concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a class='btnMemberProfile' id='");
                concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a href='#' class='btnMemberProfile replyMsge' style='font-weight:normal; font-size: 1.2em; ' id='");
                concatinater.Append(row["FriendID"].ToString());
                concatinater.Append("' >");
                concatinater.Append(row["Friend"].ToString());
                concatinater.Append("</a><span class='DateWithTime ui-corner-all floatright' style='font-size: 1.2em;' >  ");
                concatinater.Append(date);
                concatinater.Append("</span></h2> </div>");
                concatinater.Append("<p class=''>");
                concatinater.Append(row["MessageText"].ToString());
                concatinater.Append("</p></div>");

            }
            return concatinater.ToString();
        }
Example #11
0
        private void OpenWrapper(int i)
        {
            #region OPENING WRAPPER
            aPost = (Post)ArrayPosts[i];

            ArrayMembers = bl.GetMemberDisplayName(aPost.MemberId);
            countMembers = ArrayMembers.Count;

            for (int a = 0; a < countMembers; ++a)
            {
                aMember = (Member)ArrayMembers[a];

                NotificationDAL notificationDAL = new NotificationDAL();
                Group group = new Group(aPost.GroupId);

                string groupDescription = notificationDAL.GetGroupDescription2(group);
                if (aPost.PostType != "Article")
                {

                    concatinater.Append("<div class='aPost ");

                    switch (aPost.PostType)
                    {
                        case "Text":
                            concatinater.Append("typeOfText");
                            ClientUpdateType = "Text";
                            break;
                        case "Event":
                            concatinater.Append("typeOfEvent");
                            ClientUpdateType = "Event";
                            break;
                        case "Photo":
                            concatinater.Append("typeOfPhoto");
                            ClientUpdateType = "Photo";
                            break;
                        case "Article":
                            concatinater.Append("typeOfArticle");
                            ClientUpdateType = "Article";
                            break;
                        case "Video":
                            concatinater.Append("typeOfVideo");
                            ClientUpdateType = "Video";
                            break;
                        case "File":
                            concatinater.Append("typeOfFile");
                            ClientUpdateType = "File";
                            break;
                        default:

                            break;


                    }


                    concatinater.Append("' id='");
                    concatinater.Append(aPost.PostId);
                    concatinater.Append("'><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> Posted by: <a href='#' id='");
                    concatinater.Append(aPost.MemberId);
                    concatinater.Append("' class='btnMemberProfile' style='font-weight:normal; '>");
                    concatinater.Append(aMember.DisplayName);

                    bool isForMember = false;

                    string date = "";



                    date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                    try
                    {
                        tempMemberID = Context.Session["memberID"].ToString();

                    }
                    catch
                    {
                        tempMemberID = ClientUpdateMemberID;

                    }

                    if (aPost.MemberId == tempMemberID)
                    { isForMember = true; }

                    if (GroupID == aPost.GroupId)
                    {


                    }
                    else
                    {
                        concatinater.Append("</a> <span class='space'></span> in group: <a id='");
                        ClientUpdateGroupID = aPost.GroupId;
                        concatinater.Append(aPost.GroupId);

                        concatinater.Append("' class='btnGoToGroupPage groupDesc'>");
                        concatinater.Append(groupDescription);

                    }

                    concatinater.Append("</a>");
                    if (isForMember)
                    {
                        concatinater.Append("<span class='ui-icon ui-icon-closethick floatright deletePost pointer ' title ='Delete this post' style='display:none;'></span>");
                    }

                    concatinater.Append("<span class='DateWithTime ui-corner-all floatright'>");
                    concatinater.Append(date);
                    //concatinater.Append(Convert.ToDateTime(aPost.CreateDate).ToString("D"));
                    concatinater.Append("</span></h2></div> <div class='postContentArea'> <div> ");


                }
                else
                {
                    string sessionMemberID = "";
                    ChatDAL chatDAL = new ChatDAL();
                    try
                    {
                        sessionMemberID = Context.Session["memberID"].ToString();

                    }
                    catch
                    {
                        sessionMemberID = ClientUpdateMemberID;

                    }

                    Member thisMember = new Member(sessionMemberID);


                    Post post = new Post(aPost.PostId);
                    Article_Post thisArticle = chatDAL.getChatText(ref post);

                    //BulabulaApp.Other_Classes. date new = reusable_Methods.FormatDateTime(aPost.CreateDate);
                    Reusable_Methods reusable_Methods = new Reusable_Methods();
                    string date = reusable_Methods.FormatDateTimeForChat(post.CreateDate);
                    thisMember = chatDAL.GetMemberDisplayName(thisMember);

                    ChatText.Append(" <div id='");
                    ChatText.Append(aPost.PostId);
                    ChatText.Append("' class='chatMemberWrapper'>");
                    ChatText.Append("<div class='memberNameSection  '> <a id=");
                    ChatText.Append(thisMember.MemberId);
                    ChatText.Append(" class='btnMemberProfile pointer' ><em>");
                    ChatText.Append(thisMember.DisplayName);
                    ChatText.Append("</em></a></div>");
                    ChatText.Append("</a></div>");
                    ChatText.Append("<div class='chatContentSection '>");
                    ChatText.Append(thisArticle.ArticleText);



                    ChatText.Append("</div> <div class='clr'></div><span class='time'>");
                    ChatText.Append(date);
                    ChatText.Append(" <span> </div>");
                    string chatString = ChatText.ToString();
                }
            }
            #endregion
        }
Example #12
0
        public string RefreshChats(int groupID)
        {
            ChatDAL chatDAL = new ChatDAL();
        List<Article_Post> at = chatDAL.getAllChats(groupID);
        string chatString = null;
        foreach (var ChatMessage in at)
        {
            Group group = new Group(groupID);
            Member thisMember = new Member(ChatMessage.MemberID);


        //    Post post = new Post(postID);
          //  Article_Post thisArticle = chatDAL.getChatText(ref post);

            //BulabulaApp.Other_Classes. date new = reusable_Methods.FormatDateTime(aPost.CreateDate);
            Reusable_Methods reusable_Methods = new Reusable_Methods();
            string date = reusable_Methods.FormatDateTimeForChat(ChatMessage.CreateDate);
            thisMember = chatDAL.GetMemberDisplayName(thisMember);

            ChatText.Append(" <div class='chatMemberWrapper'>");
            ChatText.Append("<div class='memberNameSection  '> <a id=");
            ChatText.Append(thisMember.MemberId);
            ChatText.Append(" class='btnMemberProfile pointer' ><em>");
            ChatText.Append(thisMember.DisplayName);
            ChatText.Append("</em></a></div>");
            ChatText.Append("</a></div>");
            ChatText.Append("<div class='chatContentSection '>");
            ChatText.Append(ChatMessage.ArticleText);
            ChatText.Append("</div> <div class='clr'></div>");
            ChatText.Append("</div>");
            chatString = ChatText.ToString();
        
        }//end foreach

        return chatString;
        }
Example #13
0
        public string SendEventPost(string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();
            DateTime startDateD = reusable_Methods.FormatDateFromDateTimePicker(startDate);
            DateTime endDateD = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int postId = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {

                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();

            }
            return concatinater.ToString();
            #endregion



        }
Example #14
0
        public string[] AddCommentnRefresh(int postID, string commentTxt, int lastCommentID)
        {
            NewsfeedDAL   newsfeedDAL    = new NewsfeedDAL();
            MessagesDAL   messageDAL     = new MessagesDAL();
            Comments      comment        = new Comments();
            StringBuilder commentBuilder = new StringBuilder();


            //Decrypting the member ID
            comment.MemberId = Context.Session["memberID"].ToString();

            comment.CommentText = commentTxt;
            comment.PostId      = postID;
            comment.Commentid   = lastCommentID;
            messageDAL.InsertComment(comment);

            //Insert notification
            NotificationDAL notificationDAL = new NotificationDAL();

            Post aPost = new Post(postID);

            List <Member> MemberList = new List <Member>();

            MemberList = notificationDAL.GetPostOwner(aPost);
            string friendId = MemberList[0].MemberId;
            Member aFriend  = new Member(friendId);

            Member aMember = new Member(Context.Session["memberID"].ToString());

            if (aMember.MemberId != aFriend.MemberId)
            {
                notificationDAL.InsertCommentedOnPostNotification(aMember, aFriend, aPost);
            }

            //Refreshing the Comment count
            Post post = new Post();

            post.PostId = comment.PostId;


            //###################################
            //refreshing Comments
            //###################################

            DataTable comments = newsfeedDAL.GetRefreshComments(post, comment);

            foreach (DataRow row in comments.Rows)
            {
                date = Convert.ToDateTime(row["CreateDate"]).ToString("M");

                //Building single message view box
                commentBuilder.Append("<div id='");
                commentBuilder.Append((row["CommentID"]).ToString());

                commentBuilder.Append("' class='aComment'><div class='deleteComment floatright'>");



                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {
                    commentBuilder.Append("<a class='btnDleteComment ui-icon ui-icon-close tip' title='Delete this comment'></a>");
                }
                else
                {
                    commentBuilder.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..'></a>");
                }

                commentBuilder.Append("</div><h5><a style='font-weight:normal;' ");
                commentBuilder.Append("id='" + (row["MemberID"]).ToString() + "'> ");



                commentBuilder.Append(row["Friend"].ToString());
                commentBuilder.Append("</a><span class='DateWithTime ui-corner-all floatright'>");

                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                commentBuilder.Append(date);
                commentBuilder.Append("</span></h5><p>");
                commentBuilder.Append((row["CommentText"]).ToString());
                commentBuilder.Append("</p></div>");
                //End Building
            }
            //Array with the       //number of commeents         //new comments
            var comentArray = new string[] { messageDAL.CountComments(post).ToString(), commentBuilder.ToString() };

            return(comentArray);
        }
Example #15
0
        public string GetAllComments(int postID)
        {
            Post        post    = new Post();
            Comments    comment = new Comments();
            MessagesDAL m       = new MessagesDAL();
            string      date    = "";

            post.PostId = postID;
            StringBuilder comnt    = new StringBuilder();
            DataTable     comments = m.GetAllComments(post);

            foreach (DataRow row in comments.Rows)
            {
                Reusable_Methods reusable_Methods = new Reusable_Methods();

                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                //Building single message view box
                comnt.Append("<div id='");
                comnt.Append((row["CommentID"]).ToString());
                comnt.Append("' class='aComment'><div class='deleteComment floatright'>");

                comment.Commentid = int.Parse(row["CommentID"].ToString());

                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {
                    comnt.Append("<a class='btnDleteComment ui-icon ui-icon-close tip floatLeft' title='Delete this comment' ></a>");
                }
                else
                {
                    //comnt.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..' ></a>");
                    comnt.Append("<a class='button left big floatLeft likeComment '");

                    RateAndTagDAL dal = new RateAndTagDAL();

                    string memberId = Context.Session["memberID"].ToString();
                    Member amember  = new Member(memberId);

                    //Check if member not liked
                    if (dal.CommentRatingExists(amember, comment) == 0)
                    {
                        //if member not liked
                        //concatinater.Append(" homeLikeBtn");
                        comnt.Append("' title='");
                        comnt.Append("Like this comment");
                        comnt.Append("'  >");
                        comnt.Append("Like");
                    }
                    else
                    {
                        //if member is liked
                        //  concatinater.Append(" homeUnlikeBtn");
                        comnt.Append("' title='");
                        comnt.Append("Unlike this comment");
                        comnt.Append("'  >");
                        comnt.Append("Unlike");
                    }

                    comnt.Append("</a>");

                    comnt.Append("<a class='button right big floatLeft reportComment' title='Report this comment'>Report </a>");
                }

                comnt.Append("</div><h5><a style='font-weight:normal;' ");
                comnt.Append("id='" + (row["MemberID"]).ToString() + "'> ");
                comnt.Append(row["Friend"].ToString());
                comnt.Append("</a><span class='DateWithTime ui-corner-all floatright'>");
                comnt.Append(date);
                comnt.Append("</span></h5><p>");
                comnt.Append((row["CommentText"]).ToString());
                comnt.Append("</p></div>");
                //End Building
            }

            return(comnt.ToString());
            //End Refresh
        }
Example #16
0
        public string[] AddFirstComment(string postID, string commentTxt)
        {
            Comments comment = new Comments();

            comment.MemberId    = Context.Session["memberID"].ToString();
            comment.CommentText = commentTxt;
            Post post = new Post();

            post.PostId    = int.Parse(postID);
            comment.PostId = post.PostId;
            messageDAL.InsertComment(comment);
            StringBuilder commentBuilder = new StringBuilder();


            //###################################
            //refreshing Comments
            //###################################
            DataTable comments = messageDAL.GetAllComments(post);

            // DataTable comments = newsFeedDAL.GetRefreshComments(post, comment);


            foreach (DataRow row in comments.Rows)
            {
                date = Convert.ToDateTime(row["CreateDate"]).ToString("M");

                //Building single message view box
                commentBuilder.Append("<div id='");
                commentBuilder.Append((row["CommentID"]).ToString());

                commentBuilder.Append("' class='aComment'><div class='deleteComment floatright'>");



                if ((row["MemberID"]).ToString() == Session["memberID"].ToString())
                {
                    commentBuilder.Append("<a class='btnDleteComment ui-icon ui-icon-close tip' title='Delete this comment'></a>");
                }
                else
                {
                    commentBuilder.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..'></a>");
                }

                commentBuilder.Append("</div><h5><a style='font-weight:normal;' ");
                commentBuilder.Append("id='" + (row["MemberID"]).ToString() + "'> ");



                commentBuilder.Append(row["Friend"].ToString());
                commentBuilder.Append("</a><span class='DateWithTime ui-corner-all floatright'>");

                Reusable_Methods reusable_Methods = new Reusable_Methods();
                date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"]));

                commentBuilder.Append(date);
                commentBuilder.Append("</span></h5><p>");
                commentBuilder.Append((row["CommentText"]).ToString());
                commentBuilder.Append("</p></div>");
                //End Building
            }

            //Array with the       //number of commeents         //new comments
            var comentArray = new string[] { messageDAL.CountComments(post).ToString(), commentBuilder.ToString() };

            return(comentArray);
        }
Example #17
0
        private void OpenWrapper(int i)
        {
            #region OPENING WRAPPER
            aPost = (Post)ArrayPosts[i];

            ArrayMembers = bl.GetMemberDisplayName(aPost.MemberId);
            countMembers = ArrayMembers.Count;

            for (int a = 0; a < countMembers; ++a)
            {
                aMember = (Member)ArrayMembers[a];

                NotificationDAL notificationDAL = new NotificationDAL();
                Group           group           = new Group(aPost.GroupId);

                string groupDescription = notificationDAL.GetGroupDescription2(group);
                if (aPost.PostType != "Article")
                {
                    concatinater.Append("<div class='aPost ");

                    switch (aPost.PostType)
                    {
                    case "Text":
                        concatinater.Append("typeOfText");
                        ClientUpdateType = "Text";
                        break;

                    case "Event":
                        concatinater.Append("typeOfEvent");
                        ClientUpdateType = "Event";
                        break;

                    case "Photo":
                        concatinater.Append("typeOfPhoto");
                        ClientUpdateType = "Photo";
                        break;

                    case "Article":
                        concatinater.Append("typeOfArticle");
                        ClientUpdateType = "Article";
                        break;

                    case "Video":
                        concatinater.Append("typeOfVideo");
                        ClientUpdateType = "Video";
                        break;

                    case "File":
                        concatinater.Append("typeOfFile");
                        ClientUpdateType = "File";
                        break;

                    default:

                        break;
                    }


                    concatinater.Append("' id='");
                    concatinater.Append(aPost.PostId);
                    concatinater.Append("'><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> Posted by: <a href='#' id='");
                    concatinater.Append(aPost.MemberId);
                    concatinater.Append("' class='btnMemberProfile' style='font-weight:normal; '>");
                    concatinater.Append(aMember.DisplayName);

                    bool isForMember = false;

                    string date = "";



                    date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                    try
                    {
                        tempMemberID = Context.Session["memberID"].ToString();
                    }
                    catch
                    {
                        tempMemberID = ClientUpdateMemberID;
                    }

                    if (aPost.MemberId == tempMemberID)
                    {
                        isForMember = true;
                    }

                    if (GroupID == aPost.GroupId)
                    {
                    }
                    else
                    {
                        concatinater.Append("</a> <span class='space'></span> in group: <a id='");
                        ClientUpdateGroupID = aPost.GroupId;
                        concatinater.Append(aPost.GroupId);

                        concatinater.Append("' class='btnGoToGroupPage groupDesc'>");
                        concatinater.Append(groupDescription);
                    }

                    concatinater.Append("</a>");
                    if (isForMember)
                    {
                        concatinater.Append("<span class='ui-icon ui-icon-closethick floatright deletePost pointer ' title ='Delete this post' style='display:none;'></span>");
                    }

                    concatinater.Append("<span class='DateWithTime ui-corner-all floatright'>");
                    concatinater.Append(date);
                    //concatinater.Append(Convert.ToDateTime(aPost.CreateDate).ToString("D"));
                    concatinater.Append("</span></h2></div> <div class='postContentArea'> <div> ");
                }
                else
                {
                    string  sessionMemberID = "";
                    ChatDAL chatDAL         = new ChatDAL();
                    try
                    {
                        sessionMemberID = Context.Session["memberID"].ToString();
                    }
                    catch
                    {
                        sessionMemberID = ClientUpdateMemberID;
                    }

                    Member thisMember = new Member(sessionMemberID);


                    Post         post        = new Post(aPost.PostId);
                    Article_Post thisArticle = chatDAL.getChatText(ref post);

                    //BulabulaApp.Other_Classes. date new = reusable_Methods.FormatDateTime(aPost.CreateDate);
                    Reusable_Methods reusable_Methods = new Reusable_Methods();
                    string           date             = reusable_Methods.FormatDateTimeForChat(post.CreateDate);
                    thisMember = chatDAL.GetMemberDisplayName(thisMember);

                    ChatText.Append(" <div id='");
                    ChatText.Append(aPost.PostId);
                    ChatText.Append("' class='chatMemberWrapper'>");
                    ChatText.Append("<div class='memberNameSection  '> <a id=");
                    ChatText.Append(thisMember.MemberId);
                    ChatText.Append(" class='btnMemberProfile pointer' ><em>");
                    ChatText.Append(thisMember.DisplayName);
                    ChatText.Append("</em></a></div>");
                    ChatText.Append("</a></div>");
                    ChatText.Append("<div class='chatContentSection '>");
                    ChatText.Append(thisArticle.ArticleText);



                    ChatText.Append("</div> <div class='clr'></div><span class='time'>");
                    ChatText.Append(date);
                    ChatText.Append(" <span> </div>");
                    string chatString = ChatText.ToString();
                }
            }
            #endregion
        }