Пример #1
0
 //
 // GET: /EditQueue/
 public ActionResult Index(EditQueueFilter filter)
 {
     using (var editQueueManager = new EditQueueManager())
     {
         var list = editQueueManager.GetEditQueueItems(filter);
         ViewBag.EditFilter = filter;
         ViewBag.IsUserAdmin = (Session["IsAdministrator"] != null && (bool)Session["IsAdministrator"] == true);
         if (IsUserSignedIn)
         {
             ViewBag.UserProfile = new UserManager().GetUser(int.Parse(Session["UserID"].ToString()));
         }
         return View(list);
     }
 }
Пример #2
0
        public List<Model.EditQueueItem> GetEditQueueItems(EditQueueFilter filter)
        {
            var sourceList =
                DataModel.EditQueueItems.Where(
                    i => (
                        (filter.ShowProcessed || (filter.ShowProcessed == false && i.IsProcessed == false))
                        && (filter.DateFrom == null || (filter.DateFrom != null && i.DateSubmitted >= filter.DateFrom))
                        && (filter.DateTo == null || (filter.DateTo != null && i.DateSubmitted <= filter.DateTo))
                        && (filter.ShowEditsOnly == false || (filter.ShowEditsOnly == true && i.PreviousData != null))
                        )).OrderByDescending(e => e.DateSubmitted);

            var cpManager = new POIManager();
            var outputList = new List<Model.EditQueueItem>();

            //perform object level differencing on json contents of edit queue items (very expensive), used to get summary and count of differences per item
            foreach (var editQueueItem in sourceList)
            {
                outputList.Add(GetItemWithDifferences(editQueueItem, cpManager, false));
            }

            return outputList.Where(i => i.Differences.Count >= filter.MinimumDifferences).Take(filter.MaxResults).ToList();
        }