示例#1
0
        public IEnumerable <ItemHistory> GetItemHistory(
            int?itemId,
            ItemHistoryType itemType,
            DateTime from,
            DateTime to,
            out DateTime?createdDate,
            out DateTime?deletedDate,
            out bool hasRestoredDelete)
        {
            if (!Enum.IsDefined(typeof(ItemHistoryType), itemType))
            {
                throw new InvalidEnumArgumentException("itemType", (int)itemType, typeof(ItemHistoryType));
            }

            var createdDateParam       = new ObjectParameter("CreatedDate", typeof(DateTime));
            var deletedDateParam       = new ObjectParameter("DeletedDate", typeof(DateTime));
            var hasRestoredDeleteParam = new ObjectParameter("HasRestoredDelete", typeof(bool));

            var itemHistory =
                this.MomentaDb.GetItemHistory(
                    itemId,
                    itemType.ToString(),
                    from,
                    to,
                    createdDateParam,
                    deletedDateParam,
                    hasRestoredDeleteParam).ToList();

            createdDate = createdDateParam.Value == DBNull.Value
                              ? (DateTime?)null
                              : DateTime.SpecifyKind((DateTime)createdDateParam.Value, DateTimeKind.Utc);
            deletedDate = deletedDateParam.Value == DBNull.Value
                              ? (DateTime?)null
                              : DateTime.SpecifyKind((DateTime)deletedDateParam.Value, DateTimeKind.Utc);

            hasRestoredDelete = hasRestoredDeleteParam.Value != DBNull.Value && (bool)hasRestoredDeleteParam.Value;

            return(itemHistory);
        }
示例#2
0
 public IEnumerable<ItemRestoredDeleteHistory> GetItemRestoredDeleteHistory(
     int? itemId, ItemHistoryType itemType)
 {
     return this.MomentaDb.GetItemRestoredDeleteHistory(itemId, itemType.ToString());
 }
示例#3
0
        public IEnumerable<ItemHistory> GetItemHistory(
            int? itemId,
            ItemHistoryType itemType,
            DateTime from,
            DateTime to,
            out DateTime? createdDate,
            out DateTime? deletedDate,
            out bool hasRestoredDelete)
        {
            if (!Enum.IsDefined(typeof(ItemHistoryType), itemType))
            {
                throw new InvalidEnumArgumentException("itemType", (int)itemType, typeof(ItemHistoryType));
            }

            var createdDateParam = new ObjectParameter("CreatedDate", typeof(DateTime));
            var deletedDateParam = new ObjectParameter("DeletedDate", typeof(DateTime));
            var hasRestoredDeleteParam = new ObjectParameter("HasRestoredDelete", typeof(bool));

            var itemHistory =
                this.MomentaDb.GetItemHistory(
                    itemId,
                    itemType.ToString(),
                    from,
                    to,
                    createdDateParam,
                    deletedDateParam,
                    hasRestoredDeleteParam).ToList();

            createdDate = createdDateParam.Value == DBNull.Value
                              ? (DateTime?)null
                              : DateTime.SpecifyKind((DateTime)createdDateParam.Value, DateTimeKind.Utc);
            deletedDate = deletedDateParam.Value == DBNull.Value
                              ? (DateTime?)null
                              : DateTime.SpecifyKind((DateTime)deletedDateParam.Value, DateTimeKind.Utc);

            hasRestoredDelete = hasRestoredDeleteParam.Value != DBNull.Value && (bool)hasRestoredDeleteParam.Value;

            return itemHistory;
        }
示例#4
0
 public IEnumerable <ItemRestoredDeleteHistory> GetItemRestoredDeleteHistory(
     int?itemId, ItemHistoryType itemType)
 {
     return(this.MomentaDb.GetItemRestoredDeleteHistory(itemId, itemType.ToString()));
 }