Exemple #1
0
        private void GetEventPosts()
        {
            Event_Post aEvent;
            ArrayList  ArrayEvents;

            ArrayEvents = bl.GetPost(aPost);
            int c = ArrayEvents.Count;

            for (int j = 0; j < c; ++j)
            {
                aEvent = (Event_Post)ArrayEvents[j];



                concatinater.Append("<table class='eventWrapper' style=' width:100%;'> <tbody> <tr ><td style='font-weight: bold; width:30%;'>"); //Opening table
                concatinater.Append("Name: ");
                concatinater.Append("</td><td style=''>");
                concatinater.Append(aEvent.EventName);

                concatinater.Append("</td></tr> <tr><td style='font-weight: bold;'>");
                concatinater.Append("Type: ");
                concatinater.Append("</td><td>");
                concatinater.Append(aEvent.EventType);

                concatinater.Append("</td></tr> <tr><td style='font-weight: bold;'>");
                concatinater.Append("Venue: ");
                concatinater.Append("</td><td>");
                concatinater.Append(aEvent.EventVenue);

                concatinater.Append("</td></tr> <tr><td style='font-weight: bold;'>");
                concatinater.Append("Host: ");
                concatinater.Append("</td><td>");
                concatinater.Append(aEvent.Host);

                concatinater.Append("</td></tr> <tr><td style='font-weight: bold;'>");
                concatinater.Append("Start Date: ");
                concatinater.Append("</td><td>");
                concatinater.Append(reusable_Methods.FormatDateTime(aEvent.StartDate));

                concatinater.Append("</td></tr> <tr><td style='font-weight: bold;'>");
                concatinater.Append("End Date: ");
                concatinater.Append("</td><td>");
                concatinater.Append(reusable_Methods.FormatDateTime(aEvent.EndDate));

                concatinater.Append("</td></tr></tbody></table>");//Closing table



                concatinater.Append("<div class='eventDetailsWrapper'> <div ><a title='click to view details'  class='btnViewDetails pointer'>View details</a></div><p class='eventDetails'>");
                concatinater.Append(aEvent.EventDetails);
                concatinater.Append("</p></div>");
            }
        }
Exemple #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());
        }
        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;
        }
        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();
        }
        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);
        }