private static UserComment MapComment(IDataReader reader) { UserComment c = new UserComment(); int startingIndex = 0; c.Id = reader.GetSafeInt32(startingIndex++); c.Comment = reader.GetSafeString(startingIndex++); c.CommentDate = reader.GetSafeDateTime(startingIndex++); c.IsFlagged = reader.GetSafeBool(startingIndex++); c.IsVisible = reader.GetSafeBool(startingIndex++); c.ParentId = reader.GetSafeInt32(startingIndex++, null); c.OwnerId = reader.GetSafeInt32(startingIndex++); c.OwnerType = reader.GetSafeEnum<CommentOwnerType>(startingIndex++); c.Deleted = reader.GetSafeBool(startingIndex++); c.DeletedDate = reader.GetSafeDateTime(startingIndex++); c.LanguageCode = reader.GetSafeString(startingIndex++); c.UpdateDate = reader.GetSafeDateTime(startingIndex++); c.Title = reader.GetSafeString(startingIndex++); c.Profile.Handle = reader.GetSafeString(startingIndex++); c.Profile.Avatar = reader.GetSafeString(startingIndex++); return c; }
public List<UserComment> SelectPlanCommentsByUserId(string UserId) { List<UserComment> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.UserPlans_SelectCommentsByUserId" , inputParamMapper: delegate (SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@UserId", UserId); } , map: delegate (IDataReader reader, short set) { UserComment c = new UserComment(); int startingIndex = 0; c.Id = reader.GetSafeInt32(startingIndex++); c.Comment = reader.GetSafeString(startingIndex++); c.CommentDate = reader.GetSafeDateTime(startingIndex++); c.IsFlagged = reader.GetSafeBool(startingIndex++); c.IsVisible = reader.GetSafeBool(startingIndex++); c.ParentId = reader.GetSafeInt32(startingIndex++, null); c.OwnerId = reader.GetSafeInt32(startingIndex++); c.OwnerType = reader.GetSafeEnum<CommentOwnerType>(startingIndex++); c.Deleted = reader.GetSafeBool(startingIndex++); c.DeletedDate = reader.GetSafeDateTime(startingIndex++); c.LanguageCode = reader.GetSafeString(startingIndex++); c.UpdateDate = reader.GetSafeDateTime(startingIndex++); c.Title = reader.GetSafeString(startingIndex++); if (list == null) { list = new List<UserComment>(); } list.Add(c); } ); return list; }