public ConfigurationModel()
 {
     TestAddress                  = new AddressModel();
     Companies                    = new List <SelectListItem>();
     TaxOriginAddressTypes        = new List <SelectListItem>();
     TaxTransactionLogSearchModel = new TaxTransactionLogSearchModel();
 }
        public async Task <IActionResult> LogList(TaxTransactionLogSearchModel searchModel)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageTaxSettings))
            {
                return(await AccessDeniedDataTablesJson());
            }

            //prepare filter parameters
            var createdFromValue = searchModel.CreatedFrom.HasValue
                ? (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.CreatedFrom.Value, await _dateTimeHelper.GetCurrentTimeZoneAsync())
                : null;
            var createdToValue = searchModel.CreatedTo.HasValue
                ? (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.CreatedTo.Value, await _dateTimeHelper.GetCurrentTimeZoneAsync()).AddDays(1)
                : null;

            //get tax transaction log
            var taxtransactionLog = await _taxTransactionLogService.GetTaxTransactionLogAsync(createdFromUtc : createdFromValue, createdToUtc : createdToValue,
                                                                                              pageIndex : searchModel.Page - 1, pageSize : searchModel.PageSize);

            //prepare grid model
            var model = await new TaxTransactionLogListModel().PrepareToGridAsync(searchModel, taxtransactionLog, () =>
            {
                return(taxtransactionLog.SelectAwait(async logItem => new TaxTransactionLogModel
                {
                    Id = logItem.Id,
                    StatusCode = logItem.StatusCode,
                    Url = logItem.Url,
                    CustomerId = logItem.CustomerId,
                    CreatedDate = await _dateTimeHelper.ConvertToUserTimeAsync(logItem.CreatedDateUtc, DateTimeKind.Utc)
                }));
            });

            return(Json(model));
        }
Exemple #3
0
        public virtual IActionResult LogList(TaxTransactionLogSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedKendoGridJson());
            }

            //prepare filter parameters
            var createdFromValue = searchModel.CreatedFrom.HasValue
                ? (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.CreatedFrom.Value, _dateTimeHelper.CurrentTimeZone) : null;
            var createdToValue = searchModel.CreatedTo.HasValue
                ? (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.CreatedTo.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1) : null;

            //get tax transaction log
            var taxtransactionLog = _taxTransactionLogService.GetTaxTransactionLog(createdFromUtc: createdFromValue,
                                                                                   createdToUtc: createdToValue, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize);

            //prepare grid model
            var model = new TaxTransactionLogListModel
            {
                //fill in model values from the entity
                Data = taxtransactionLog.Select(logItem => new TaxTransactionLogModel
                {
                    Id          = logItem.Id,
                    StatusCode  = logItem.StatusCode,
                    Url         = logItem.Url,
                    CustomerId  = logItem.CustomerId,
                    CreatedDate = _dateTimeHelper.ConvertToUserTime(logItem.CreatedDateUtc, DateTimeKind.Utc)
                }),
                Total = taxtransactionLog.TotalCount
            };

            return(Json(model));
        }
 /// <summary>
 /// Prepare tax transaction log list model
 /// </summary>
 /// <param name="model">Tax transaction log list model</param>
 private void PrepareLogModel(TaxTransactionLogSearchModel model)
 {
     //prepare page parameters
     model.SetGridPageSize();
 }