예제 #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)
            }));
        }
예제 #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));
        }
        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);
        }
예제 #4
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));
        }
예제 #6
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()
     }));
 }
예제 #7
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
            }));
        }