public void CT7_List() { POSMonitorService service = (POSMonitorService)_service.FindService <Model.Connector.POSMonitor>(); List <Criteria> criterias = new List <Criteria>(); criterias.Add(new Criteria() { Field = "status", Operator = "eq", Value = "1" }); criterias.Add(new Criteria() { Field = "TransactionDate", Operator = "eq", Value = _monitor.TransactionDate.ToString("dd/MM/yyyy") }); var lista = service.List(criterias, 1, 0).Result; Assert.IsNotNull(lista); Assert.IsTrue(lista.Count != 0); lista.ForEach(l => { Console.WriteLine($"id: {l.RecId}, data: {l.TransactionDate}, filial: {l.BranchId}-{l.BranchId}"); }); }
public void CT6_InitMonitoring() { POSMonitorService service = (POSMonitorService)_service.FindService <Model.Connector.POSMonitor>(); InitMonitorArgs args = new InitMonitorArgs() { startDate = Convert.ToDateTime("03/03/2020") }; Assert.That(() => service.InitMonitoring(args).Wait(), Throws.Nothing); Task.Delay(2000); List <Criteria> criterias = new List <Criteria>(); criterias.Add(new Criteria() { Field = "BranchId", Operator = "eq", Value = "1" }); criterias.Add(new Criteria() { Field = "TransactionDate", Operator = "eq", Value = args.startDate.Value.ToString("yyyyMMdd") }); var lista = _service.List <Model.Connector.POSMonitor>(criterias).Result; Assert.IsNotNull(lista); Assert.IsTrue(lista.Count != 0); }
async public Task <ActionResult> ListSummary([FromBody] Core.QueryRequest request) { ActionResult result = BadRequest(); POSMonitorService monitorService = (POSMonitorService)Service.FindService <Model.POSMonitor>(); List <Criteria> criterias = new List <Criteria>(); long page = request.page == null ? -1 : request.page.Value; long size = request.size == null ? -1 : request.size.Value; request?.criterias.ForEach(c => { bool ignoreCriteria = false; if (c.Field.ToLower().Equals("status") && c.Value == "-1") { ignoreCriteria = true; } if (!ignoreCriteria) { criterias.Add(new Criteria() { Field = c.Field, Operator = c.Operator, Value = c.Value }); } }); try { var lista = await monitorService.ListSummary(criterias, page, size); Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = true, data = lista, message = null }; result = Ok(response); } catch (Exception ex) { Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = false, data = null, message = ex.Message }; result = BadRequest(response); } return(result); }
public void CT6_SelectSummary() { POSMonitorService service = (POSMonitorService)_service.FindService <Model.Connector.POSMonitor>(); List <Criteria> criterias = new List <Criteria>(); criterias.Add(new Criteria() { Field = "status", Operator = "eq", Value = "1" }); var lista = service.ListSummary(criterias).Result; Assert.IsNotNull(lista); Assert.IsTrue(lista.Count != 0); lista.ForEach(l => { Console.WriteLine($"id: {l.RecId}, data: {l.TransactionDate}, filial: {l.BranchId}-{l.BranchName}, tickets: {l.CountTickets}, total: {l.SumTickets}"); }); }
async public Task <ActionResult> InitMonitor([FromBody] InitMonitorRequest request) { ActionResult result = BadRequest(); POSMonitorService monitorService = (POSMonitorService)Service.FindService <Model.POSMonitor>(); try { await monitorService.InitMonitoring(new InitMonitorArgs() { branchIdLegacy = request.branchIdLegacy }); Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = true, data = null, message = null }; result = Ok(response); } catch (Exception ex) { Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = false, data = null, message = ex.Message }; result = BadRequest(response); } return(result); }