예제 #1
0
        public JsonResult AuditLog(WorkItemAuditLogCriteria criteria)
        {
            var page = _workItemAuditLogQueries.GetChanges(criteria);

            return Json(new
            {
                total = page.TotalPages,
                page = page.CurrentPage,
                records = page.TotalItems,
                rows = (from item in page.Items
                        select new
                        {
                            id = item.WorkOrderNumber,
                            cell = new object[]
                                            {
                                                item.Field,
                                                item.OldValue,
                                                item.NewValue,
                                                item.Timestamp.ToShortDateString(),
                                                item.HistUserName,
                                                item.HistFullName,
                                                item.HistEmailAddress
                                            }
                        }).ToArray()

            });
        }
예제 #2
0
        public Page<WorkItemHistoryDetail> GetChanges(WorkItemAuditLogCriteria criteria)
        {
            var sql = Sql.Builder
               .OrderBy(criteria.OrderBy + " " + criteria.OrderByDirection)
               .Where("workOrderNumber=@0", criteria.WorkOrderNumber);

            if (criteria.Field.ToLower() != "all") sql.And("field=@0", criteria.Field);

            return _repository.PagedQuery<WorkItemHistoryDetail>(criteria.PageNumber, criteria.ItemsPerPage, sql.SQL, sql.Arguments);
        }