public IActionResult GetReport(string urnNo, string prNo, string unitId, string categoryId, string supplierId, DateTime?dateFrom, DateTime?dateTo, int page, int size, string Order = "{}")
        {
            int    offset = Convert.ToInt32(Request.Headers["x-timezone-offset"]);
            string accept = Request.Headers["Accept"];

            try
            {
                var data = facade.GetReport(urnNo, prNo, unitId, categoryId, supplierId, dateFrom, dateTo, page, size, Order, offset);

                return(Ok(new
                {
                    apiVersion = ApiVersion,
                    data = data.Item1,
                    info = new { total = data.Item2 },
                    message = General.OK_MESSAGE,
                    statusCode = General.OK_STATUS_CODE
                }));
            }
            catch (Exception e)
            {
                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                    .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result));
            }
        }
        public void Should_Success_GetReport()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext);
            var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME).Result;
            var response = facade.GetReport(dataUtil.URNNo, "", dataUtil.UnitId, "", dataUtil.SupplierId, null, null, 1, 25, "{}", 1);

            Assert.NotEqual(response.Data.Count, 0);
        }
Esempio n. 3
0
        public async Task Should_Success_GetReport()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext);
            var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME);

            var response = facade.GetReport(dataUtil.URNNo, "", dataUtil.UnitId, "", dataUtil.SupplierId, null, null, 1, 25, "{}", 1);

            Assert.NotEmpty(response.Data);
        }