/// <summary> /// Takes an prepopulated IDataReader and creates an array of NSpotComments /// </summary> public static List<NSpotComment> PopulateObject(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<NSpotComment> arr = new List<NSpotComment>(); NSpotComment obj; while (dr.Read()) { obj = new NSpotComment(); if (list.IsColumnPresent("NSpotCommentID")) { obj._nSpotCommentID = (int)dr["NSpotCommentID"]; } if (list.IsColumnPresent("NSpotID")) { obj._nSpotID = (int)dr["NSpotID"]; } if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; } if (list.IsColumnPresent("Text")) { obj._text = (string)dr["Text"]; } if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; } arr.Add(obj); } dr.Close(); return arr; }
public AjaxComment PostComment(string type, string WebID, string CommentText) { AjaxComment ajaxComment = new AjaxComment(); member = (Member)Session["Member"]; if (type == "n") { NSpot nspot = NSpot.GetNSpotByNSpotWebID(WebID); NSpotComment comment = new NSpotComment(); comment.NSpotID = nspot.NSpotID; comment.MemberID = member.MemberID; comment.Text = CommentText; comment.DTCreated = DateTime.Now; comment.Save(); ajaxComment = AjaxComment.GetAjaxNSpotCommentByNSpotCommentIDWithJoin(comment.NSpotCommentID); ajaxComment.TotalNumberOfComments = "0"; } return ajaxComment; }