diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll
index ef12a8f5..00a30a34 100644
Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ
diff --git a/Step/Controllers/WebApi/ReportController.cs b/Step/Controllers/WebApi/ReportController.cs
index 81aa33b1..2510b65a 100644
--- a/Step/Controllers/WebApi/ReportController.cs
+++ b/Step/Controllers/WebApi/ReportController.cs
@@ -41,17 +41,23 @@ namespace Step.Controllers.WebApi
}
[Route("programs"), HttpPost]
- public IHttpActionResult GetProgramHistoryData(DTONameFilter filter)
+ public IHttpActionResult GetProgramHistoryData(DTOPageAndFilterModel filter)
{
StreamReader sr = new StreamReader("./Report/Programs.xml");
XmlSerializer xmlSerializer = new XmlSerializer(typeof(DTOHistogramModel));
DTOHistogramModel schema = xmlSerializer.Deserialize(sr) as DTOHistogramModel;
+ // FIlter
schema.Occurrences = schema.Occurrences.Where(x =>
x.ProgName.Contains(filter.Name) &&
DateTime.Parse(x.StartDate) >= filter.StartDate && DateTime.Parse(x.EndDate) <= filter.EndDate
-
- ).ToList();
+ )
+ .ToList();
+
+ // Count pages
+ schema.Pages = (int)Math.Ceiling((double)schema.Occurrences.Count() / (double)filter.PageSize);
+ // Skip previous pages
+ schema.Occurrences = schema.Occurrences.Skip(filter.Page - 1 * filter.PageSize).Take(filter.PageSize).ToList();
return Ok(schema);
}
@@ -67,6 +73,11 @@ namespace Step.Controllers.WebApi
public string Name { get; set; }
}
+ public class DTOPageAndFilterModel : DTONameFilter
+ {
+ public int PageSize;
+ public int Page;
+ }
///
/// PIE CHART
///
@@ -159,6 +170,8 @@ namespace Step.Controllers.WebApi
[XmlArray("programs")]
[XmlArrayItem("program", typeof(DTOHistogramItemModel))]
public List Occurrences { get; set; }
+
+ public int Pages { get; set; }
}
public class DTOHistogramItemModel