Exemplo n.º 1
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
                return Content("Access denied");

            var appVersions = _appVersionService
                .GetPaged(command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = appVersions,
                Total = appVersions.TotalCount
            };

            return Json(gridModel);
        }
Exemplo n.º 2
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageUsers))
                return AccessDeniedView();

            var customerRoles = _userService.GetAllUserRoles(true);

            var gridModel = new DataSourceResult {
                Data = customerRoles.Select(PrepareUserRoleModel),
                Total = customerRoles.Count
            };

            return Json(gridModel);
        }
Exemplo n.º 3
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageScheduleTasks))
                return AccessDeniedView();

            var models = _scheduleTaskService.GetAllTasks(true)
                .Select(PrepareScheduleTaskModel)
                .ToList();
            var gridModel = new DataSourceResult {
                Data = models,
                Total = models.Count
            };

            return Json(gridModel);
        }
Exemplo n.º 4
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAppVersions))
                return AccessDeniedView();

            var appVersions = _appVersionService
                .GetPaged(command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = appVersions.Select(x => {
                    var model = x.ToModel();
                    model.CreateON = _dateTimeHelper.ConvertToUserTime(model.CreateON);
                    return model;
                    }),
                Total = appVersions.TotalCount
            };

            return Json(gridModel);
        }
Exemplo n.º 5
0
        public ActionResult List(DataSourceRequest command) {
            //if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
            //    return AccessDeniedView();

            var customers = _userService.GetOnlineUsers(DateTime.UtcNow.AddMinutes(-30),
                null, command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = customers.Select(x => new OnlineUserModel {
                    Id = x.Id,
                    UserInfo = x.Email,
                    LastIpAddress = x.LastIpAddress,
                    LastActivityDate = _dateTimeHelper.ConvertToUserTime(x.LastActivityDateUtc, DateTimeKind.Utc)
                }),
                Total = customers.TotalCount
            };

            return Json(gridModel);
        }
Exemplo n.º 6
0
        public ActionResult Resources(int languageId, DataSourceRequest command,
            Nut.Web.Framework.Kendoui.Filter filter = null, IEnumerable<Sort> sort = null) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
                return AccessDeniedView();

            var language = _languageService.GetLanguageById(languageId);

            var resources = _localizationService
                .GetAllResourceValues(languageId)
                .OrderBy(x => x.Key)
                .Select(x => new LanguageResourceModel {
                    LanguageId = languageId,
                    LanguageName = language.Name,
                    Id = x.Value.Key,
                    Name = x.Key,
                    Value = x.Value.Value,
                })
                    .AsQueryable()
                    .Filter(filter)
                    .Sort(sort);

            var gridModel = new DataSourceResult {
                Data = resources.PagedForCommand(command),
                Total = resources.Count()
            };

            return Json(gridModel);
        }
Exemplo n.º 7
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
                return AccessDeniedView();

            var languages = _languageService.GetAllLanguages(true);
            var gridModel = new DataSourceResult {
                Data = languages.Select(x => x.ToModel()),
                Total = languages.Count()
            };
            return new JsonResult {
                Data = gridModel
            };
        }
Exemplo n.º 8
0
        public ActionResult ListLogs(DataSourceRequest command, ActivityLogSearchModel model) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog))
                return AccessDeniedView();

            DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.DefaultStoreTimeZone);

            DateTime? endDateValue = (model.CreatedOnTo == null) ? null
                            : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.DefaultStoreTimeZone).AddDays(1);

            var activityLog = _activityLogService.GetAllActivities(startDateValue, endDateValue, null, model.ActivityLogTypeId, command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = activityLog.Select(x => {
                    var m = x.ToModel();
                    m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    return m;

                }),
                Total = activityLog.TotalCount
            };
            return Json(gridModel);
        }
Exemplo n.º 9
0
        public ActionResult List(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageUsers))
                return AccessDeniedView();

            var departments = _departmentService
                .GetPaged(command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = departments.Select(x => {
                    var m = x.ToModel();
                    m.Breadcrumb = x.GetFormattedBreadCrumb(_departmentService);
                    return m;
                }),
                Total = departments.TotalCount
            };

            return Json(gridModel);
        }
Exemplo n.º 10
0
        public ActionResult ListSelect(DataSourceRequest command) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
                return AccessDeniedView();

            var pluginDescriptors = _pluginFinder.GetPluginDescriptors(LoadPluginsMode.All).ToList();
            var gridModel = new DataSourceResult {
                Data = pluginDescriptors.Select(x => PreparePluginModel(x, false, false))
                .OrderBy(x => x.Group)
                .ToList(),
                Total = pluginDescriptors.Count()
            };

            return Json(gridModel);
        }
Exemplo n.º 11
0
        public ActionResult UserList(DataSourceRequest command, UserListModel model,
            [ModelBinder(typeof(CommaSeparatedModelBinder))] int[] searchUserRoleIds) {
            //we use own own binder for searchCustomerRoleIds property 
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageUsers))
                return AccessDeniedView();

            var customers = _userService.GetAllUsers(
                UserRoleIds: searchUserRoleIds,
                departmentId: model.SearchDepartmentId,
                email: model.SearchEmail,
                username: model.SearchUsername,
                pageIndex: command.Page - 1,
                pageSize: command.PageSize);
            var gridModel = new DataSourceResult {
                Data = customers.Select(PrepareUserModelForList),
                Total = customers.TotalCount
            };

            return Json(gridModel);
        }
Exemplo n.º 12
0
        public ActionResult AllSettings(DataSourceRequest command,
            Nut.Web.Framework.Kendoui.Filter filter = null, IEnumerable<Sort> sort = null) {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
                return AccessDeniedView();

            var settings = _settingService
                .GetAllSettings()
                .Select(x => {
                    string storeName;
                    if (x.StoreId == 0) {
                        storeName = _localizationService.GetResource("Admin.Configuration.Settings.AllSettings.Fields.StoreName.AllStores");
                    } else {
                        var store = _storeService.GetStoreById(x.StoreId);
                        storeName = store != null ? store.Name : "Unknown";
                    }
                    var settingModel = new SettingModel {
                        Id = x.Id,
                        Name = x.Name,
                        Value = x.Value,
                        Store = storeName,
                        StoreId = x.StoreId
                    };
                    return settingModel;
                })
                .AsQueryable()
                .Filter(filter)
                .Sort(sort);

            var gridModel = new DataSourceResult {
                Data = settings.PagedForCommand(command).ToList(),
                Total = settings.Count()
            };

            return Json(gridModel);
        }
Exemplo n.º 13
0
        public ActionResult AsyncList(string sessionId) {

            var pictures = _pictureService.GetPictures(sessionId: sessionId);

            var gridModel = new DataSourceResult {
                Data = pictures.Select(x => {
                    return new {
                        Name = x.SeoFilename,
                        SessionId = x.SessionId,
                        Id = x.Id,
                        MimeType = x.MimeType,
                        Url = _pictureService.GetPictureUrl(x, 200)
                    };
                }),
                Total = pictures.TotalCount
            };

            return Json(gridModel);

        }