Esempio n. 1
0
        public async Task <DataSourceResult> PrepareDeviceLicenseListModel(DeviceLicenseSearchModel searchModel, License license)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (license == null)
            {
                throw new ArgumentNullException(nameof(license));
            }

            var deviceLicense = await _licenseService.GetDeviceLicense(
                licenseId : license.Id,
                pageIndex : searchModel.Page - 1,
                pageSize : searchModel.PageSize);

            var result = new DataSourceResult
            {
                Data = deviceLicense.Select(device =>
                {
                    var model       = device.ToModel <DeviceLicenseModel>();
                    model.StoreName = device.Store != null ? device.Store.P_BranchNo + " - " + device.Store.P_Name : string.Empty;

                    return(model);
                }),
                Total = deviceLicense.TotalCount
            };

            return(result);
        }
Esempio n. 2
0
        public async Task <IActionResult> DeviceLicenseList(DeviceLicenseSearchModel searchModel)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManagePlugins))
            {
                return(AccessDeniedKendoGridJson());
            }

            var license = await _licenseService.GetLicenseById(searchModel.LicenseId) ??
                          throw new ArgumentException("No license found with the specified id");

            var model = await _licenseModelFactory.PrepareDeviceLicenseListModel(searchModel, license);

            return(Json(model));
        }
Esempio n. 3
0
        private Task PrepareFeatureSearchModel(DeviceLicenseSearchModel searchModel, License license)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (license == null)
            {
                throw new ArgumentNullException(nameof(license));
            }

            searchModel.LicenseId = license.Id;
            searchModel.SetGridPageSize();

            return(Task.FromResult(searchModel));
        }