Exemple #1
0
        public ActionResult Index(int?idDepartment)
        {
            if (!_reportSecurityService.CanReadResourceOperatorInfo())
            {
                return(RedirectToAction("ForbiddenError", "Home"));
            }
            var departments = _reportService.GetAllowedDepartments();

            if (_reportSecurityService.CanVisiblieAllDepartmentsMark())
            {
                departments = new List <Department>
                {
                    new Department
                    {
                        Name         = "Все организации",
                        IdDepartment = 0
                    }
                }.Concat(departments);
            }
            return(View(new ReportResourceOperatorViewModel
            {
                Departments = departments,
                IdDepartment = ValueProviderHelper.GetValue("IdDepartment", System.Web.HttpContext.Current, idDepartment)
            }));
        }
Exemple #2
0
        public new ValueProviderResult GetValue(string key)
        {
            var context = HttpContext.Current;
            var options = GetReportOptions();

            options.Department = ValueProviderHelper.GetValue <string>("Department", context, null);
            options.Date       = ValueProviderHelper.GetValue("Date", context, DateTime.Now.Date);
            return(new ValueProviderResult(options,
                                           JsonConvert.SerializeObject(options),
                                           CultureInfo.InvariantCulture));
        }
Exemple #3
0
 public bool ContainsPrefix(string prefix)
 {
     try
     {
         var action    = ValueProviderHelper.GetControllerActionByContext(HttpContext.Current);
         var parameter = action.GetParameters().FirstOrDefault(p => p.Name == prefix);
         return(parameter != null && parameter.ParameterType == typeof(T));
     }
     catch (AmbiguousMatchException)
     {
         return(false);
     }
 }
 public override IValueProvider GetValueProvider(ControllerContext controllerContext)
 {
     try
     {
         var action = ValueProviderHelper.GetControllerActionByContext(HttpContext.Current);
         return(action.GetParameters().Any(p => p.ParameterType == typeof(T)) ?
                new FilterOptionsValueProvider <FilterOptions>() : null);
     }
     catch (AmbiguousMatchException)
     {
         return(null);
     }
 }
        protected T GetReportOptions()
        {
            var context       = HttpContext.Current;
            var reportOptions = new T
            {
                SortField          = ValueProviderHelper.GetValue <string>("SortField", context, null),
                SortDirection      = ValueProviderHelper.GetValue("SortDirection", context, SortDirection.Asc),
                ReportDisplayStyle =
                    ValueProviderHelper.GetValue("ReportDisplayStyle", context, ReportDisplayStyle.Cards)
            };

            return(reportOptions);
        }
 public override IValueProvider GetValueProvider(ControllerContext controllerContext)
 {
     try
     {
         var action = ValueProviderHelper.GetControllerActionByContext(HttpContext.Current);
         return(action.GetParameters().Any(p => p.ParameterType == typeof(ReportDepartmentAndResourceRightsOptions)) ?
                new ReportDepartmentAndResourceRightsOptionsValueProvider() : null);
     }
     catch (AmbiguousMatchException)
     {
         return(null);
     }
 }
Exemple #7
0
        protected T GetFilterOptions()
        {
            var context       = HttpContext.Current;
            var filterOptions = new T
            {
                PageSize      = ValueProviderHelper.GetValue("PageSize", context, 25),
                PageIndex     = ValueProviderHelper.GetValue("PageIndex", context, 0),
                Filter        = ValueProviderHelper.GetValue <string>("Filter", context, null),
                SortField     = ValueProviderHelper.GetValue <string>("SortField", context, null),
                SortDirection = ValueProviderHelper.GetValue("SortDirection", context, SortDirection.Asc)
            };

            return(filterOptions);
        }
        public new ValueProviderResult GetValue(string key)
        {
            var context = HttpContext.Current;
            var options = GetReportOptions();

            options.Login         = ValueProviderHelper.GetValue <string>("Login", context, null);
            options.Snp           = ValueProviderHelper.GetValue <string>("Snp", context, null);
            options.Department    = ValueProviderHelper.GetValue <string>("Department", context, null);
            options.Unit          = ValueProviderHelper.GetValue <string>("Unit", context, null);
            options.Date          = ValueProviderHelper.GetValue("Date", context, DateTime.Now.Date);
            options.UsersCategory = ValueProviderHelper.GetValue("UsersCategory", context, UsersCategory.ActiveUsers);
            return(new ValueProviderResult(options,
                                           JsonConvert.SerializeObject(options),
                                           CultureInfo.InvariantCulture));
        }
Exemple #9
0
 public ActionResult GetDataTable(int?idDepartment)
 {
     if (!_reportSecurityService.CanReadResourceOperatorInfo())
     {
         return(PartialView("DataTable", null));
     }
     idDepartment = ValueProviderHelper.GetValue("IdDepartment", System.Web.HttpContext.Current, idDepartment);
     if (idDepartment == null)
     {
         return(PartialView("DataTable", null));
     }
     return(PartialView("DataTable", new ReportResourceOperatorViewModel
     {
         IdDepartment = idDepartment,
         ResourceOperators = _reportService.GetResourceOperatorInfo(idDepartment).ToList()
     }));
 }
Exemple #10
0
        public new ValueProviderResult GetValue(string key)
        {
            var context       = HttpContext.Current;
            var filterOptions = GetFilterOptions();

            filterOptions.RequestCategory    = ValueProviderHelper.GetValue("RequestCategory", context, RequestCategory.AllRequests);
            filterOptions.IdRequestStateType = ValueProviderHelper.GetValue <int?>("IdRequestStateType", context, null);
            filterOptions.IdRequestType      = ValueProviderHelper.GetValue <int?>("IdRequestType", context, null);
            filterOptions.DateOfFillingFrom  = ValueProviderHelper.GetValue <DateTime?>("DateOfFillingFrom", context, null);
            if (filterOptions.DateOfFillingFrom != null)
            {
                filterOptions.DateOfFillingFrom = filterOptions.DateOfFillingFrom.Value.Date;
            }
            filterOptions.DateOfFillingTo = ValueProviderHelper.GetValue <DateTime?>("DateOfFillingTo", context, null);
            if (filterOptions.DateOfFillingTo != null)
            {
                filterOptions.DateOfFillingTo = filterOptions.DateOfFillingTo.Value.Date.AddDays(1).AddSeconds(-1);
            }
            return(new ValueProviderResult(filterOptions,
                                           JsonConvert.SerializeObject(filterOptions),
                                           CultureInfo.InvariantCulture));
        }
 public ActionResult GetDataTable(int?idDepartment, int?idRole)
 {
     if (!_reportSecurityService.CanReadAclUserRights())
     {
         return(PartialView("DataTable"));
     }
     idDepartment = ValueProviderHelper.GetValue("IdDepartment", System.Web.HttpContext.Current, idDepartment);
     if (idDepartment == null)
     {
         return(PartialView("DataTable", null));
     }
     idRole = ValueProviderHelper.GetValue("IdRole", System.Web.HttpContext.Current, idRole);
     if (idRole == null)
     {
         return(PartialView("DataTable", null));
     }
     return(View("DataTable", new ReportAclUserRolesViewModel
     {
         IdDepartment = idDepartment,
         IdRole = idRole,
         UserRoles = _reportService.GetAclUserRoles(idDepartment, idRole)
     }));
 }
        public ActionResult Index(int?idDepartment, int?idRole)
        {
            if (!_reportSecurityService.CanReadAclUserRights())
            {
                return(RedirectToAction("ForbiddenError", "Home"));
            }
            var departments = _reportService.GetAllowedDepartments();

            if (_reportSecurityService.CanVisiblieAllDepartmentsMark())
            {
                departments = new List <Department>
                {
                    new Department
                    {
                        Name         = "Все организации",
                        IdDepartment = 0
                    }
                }.Concat(departments);
            }
            var roles = _reportService.GetAclRoles();

            roles = new List <AclRole>
            {
                new AclRole
                {
                    Name   = "Все роли",
                    IdRole = 0
                }
            }.Concat(roles);
            return(View("Index", new ReportAclUserRolesViewModel
            {
                IdDepartment = ValueProviderHelper.GetValue("IdDepartment", System.Web.HttpContext.Current, idDepartment),
                IdRole = ValueProviderHelper.GetValue("IdRole", System.Web.HttpContext.Current, idRole),
                Departments = departments,
                Roles = roles
            }));
        }