Ejemplo n.º 1
0
        /// <summary>
        /// gets all the comments for an AskAFriend Question since the last request
        /// </summary>
        /// <param name="MemberCommentID"></param>
        /// <returns></returns>
        public static AjaxAAFComment[] GetAAFCommentsByWebAskAFriendSinceLastIDWithJoin(string WebAskAFriendID, string LastWebAskAFriendCommentID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_GetAAFCommentsByWebAskAFriendSinceLastIDWithJoin");

            db.AddInParameter(dbCommand, "WebAskAFriendID", DbType.String, WebAskAFriendID);
            db.AddInParameter(dbCommand, "LastWebAskAFriendCommentID", DbType.String, LastWebAskAFriendCommentID);

            //execute the stored procedure
            AjaxAAFComment[] AskAFriendComments = new AjaxAAFComment[0];

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                AskAFriendComments = AjaxAAFComment.PopulateAjaxComment(dr);
                dr.Close();
            }
            return(AskAFriendComments);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        public static AjaxAAFComment[] PopulateAjaxComment(IDataReader dr)
        {
            List <AjaxAAFComment> commentArr = new List <AjaxAAFComment>();
            AjaxAAFComment        ajaxComment;

            while (dr.Read())
            {
                ajaxComment = new AjaxAAFComment();

                ajaxComment.WebCommentID   = (string)dr["WebCommentID"];
                ajaxComment.WebMemberID    = (string)dr["WebMemberID"];
                ajaxComment.NickName       = (string)dr["NickName"];
                ajaxComment.PhotoUrl       = "user/" + (string)dr["PhotoUrl"];
                ajaxComment.Text           = (string)dr["Text"];
                ajaxComment.DateTimePosted = TimeDistance.TimeAgo((DateTime)dr["DTCreated"]);
                ajaxComment.DTCreated      = (DateTime)dr["DTCreated"];

                commentArr.Add(ajaxComment);
            }

            return(commentArr.ToArray());
        }