public static void AddComment(Comment comment)
 {
     CommentsDataSource comDS = new CommentsDataSource();
     CommentEntry comm = new CommentEntry();
     Converter.CopyFields(comment, comm);
     comDS.AddComment(comm);
 }
        public static Comment GetComment(string id)
        {
            CommentsDataSource comDS = new CommentsDataSource();

            CommentEntry comm = comDS.GetById(id);

            return CreateCommentEnumerator(new List<CommentEntry>() { comm }).FirstOrDefault();
        }
        public static IEnumerable<Comment> GetDatasetComments(string datasetId, string parentType, string container)
        {
            var commentDS = new CommentsDataSource();

            var comments = from g in commentDS.SelectAll()
                          where g.DatasetId == datasetId && g.ParentType == parentType && container == g.PartitionKey
                          select g;

            return CreateCommentEnumerator(comments);
        }
        public static IEnumerable<Comment> GetByParentAndUser(string parentId, string container, string parentType, string user)
        {
            CommentsDataSource comDS = new CommentsDataSource();

            var comments = from g in comDS.SelectAll()
                          where g.DatasetId == parentId && g.PartitionKey == container && g.ParentType == parentType && g.Email == user
                          select g;

            return CreateCommentEnumerator(comments);
        }
        public ActionResult DeleteRequest(string rowKey)
        {
            Request re = RequestRepository.GetRequest(rowKey);
            if (re == null)
                throw new ApplicationException("Requested request does not exist.");

            var commentsDataSource = new CommentsDataSource();
            commentsDataSource.UpdateStatusByParent(rowKey, "Request", "Hidden");

            re.Status = "Hidden";
            RequestRepository.UpdateRequest(re);

            //string result = string.Format("<h2 style='color:red'>Request: \"{0}\" is deleted</h2>", re.Subject);
            //return Json(result);
            return Json(new StatusInfo { Status = re.Status, Show = true });
        }
        public static IEnumerable<Comment> GetComments(DateTime? fromDate, DateTime? toDate)
        {
            // We should use values SqlDateTime.MinValue otherwies exception during query execution
            //January 1, 1753.
            if (!fromDate.HasValue)
                fromDate = SqlDateTime.MinValue.Value;

            //December 31, 9999.
            if (!toDate.HasValue)
                toDate = DateTime.Now;

            var commentDS = new CommentsDataSource();

            var comments = (from comm in commentDS.SelectAllWithHidden()
                            where comm.PostedOn >= fromDate && comm.PostedOn <= toDate
                            select comm).AsEnumerable();

            return CreateCommentEnumerator(comments);
        }
        public static IEnumerable<String> GetSubscribers(string objectId, string container, string parentType, string exclude)
        {
            CommentsDataSource comDS = new CommentsDataSource();
            var results = from com in comDS.SelectAll()
                          where com.Notify == true
                          && com.Email != ""
                          && com.DatasetId == objectId
                          && com.PartitionKey == container
                          && com.ParentType == parentType
                          && com.RowKey != exclude
                          select com;

            return results.AsEnumerable().Select(c => c.Email).Distinct();
        }
 public static void DeleteComment(string id)
 {
     CommentsDataSource comDS = new CommentsDataSource();
     comDS.DeleteComment(id);
 }
 public static void DeleteByParent(string parentId, string container)
 {
     CommentsDataSource comDS = new CommentsDataSource();
     comDS.DeleteByParent(parentId, container);
 }
예제 #10
0
 public static void Update(Comment comment)
 {
     CommentsDataSource comDS = new CommentsDataSource();
     CommentEntry comm = comDS.GetById(comment.RowKey);
     Converter.CopyFields(comment, comm);
     comDS.Update(comm);
 }
        public DatasetCommentsDataSource()
        {
            IEnumerable<EntitySet> entitySets = new List<EntitySet>();

            foreach (Container container in ContainerAliases)
            {
                var sets = EntitySetRepository.GetEntitySets(container.Alias, null) as List<EntitySet>;
                if (sets != null)
                {
                    entitySets = entitySets.Union(sets);
                }
            }

            var cds = new CommentsDataSource();
            IEnumerable<CommentEntry> comments = cds.SelectAll().Where(t => t.ParentType == ParentType.Dataset.ToString());

            _list = (from es in entitySets
                     join c in comments on es.EntitySetName equals c.DatasetId
                     select new DatasetComment(es.EntityId, es.Name, es.Description, es.CategoryValue, es.ContainerAlias, es.LastUpdateDate, es.EntitySetName, c.Subject, c.Username, c.Email, c.PostedOn));

            _list = _list.OrderBy(c => c.CommentDate)
                .OrderBy(c => c.DatasetName)
                .OrderBy(c => c.DatasetCategoryValue)
                .OrderBy(c => c.DatasetContainerAlias);
        }
예제 #12
0
        private void LoadComments()
        {
            CommentsDataSource ds = new CommentsDataSource();

            Comments = new List <Comment>(CommentRepository.GetDatasetComments(DatasetId, ParentType.ToString(), Container));
        }
예제 #13
0
 private void LoadComments()
 {
     CommentsDataSource ds = new CommentsDataSource();
     Comments = new List<Comment>(CommentRepository.GetDatasetComments(DatasetId, ParentType.ToString(), Container));
 }