public RoleListModel(string HolderName)
        {
            int result = 0;

            Filter    = new RoleListFilter();
            AppParams = new ApplicationParameters();

            int TotalItems = 0;

            this.HolderName          = HolderName;
            this.Filter.ItemsPerPage = (HttpContext.Current.Request["s"] != null && int.TryParse(HttpContext.Current.Request["s"], out result)) ? result : int.Parse(AppParams.AppUiPagingSize.Value);
            this.Filter.CurrentPage  = (HttpContext.Current.Request["p"] != null && int.TryParse(HttpContext.Current.Request["p"], out result)) ? result : 1;

            this.Filter.SortColumn   = (HttpContext.Current.Request["c"] != null && int.TryParse(HttpContext.Current.Request["c"], out result)) ? result : 1;
            this.Filter.SortOrderAsc = (HttpContext.Current.Request["o"] != null && (int.TryParse(HttpContext.Current.Request["o"], out result)) ? (result == 1 ? true : false) : true);

            this.Filter.SortColumnName = "RoleID";
            switch (this.Filter.SortColumn)
            {
            case 2: this.Filter.SortColumnName = "Name"; break;

            case 3: this.Filter.SortColumnName = "MemberCount"; break;

            case 6: this.Filter.SortColumnName = "Created"; break;

            case 7: this.Filter.SortColumnName = "Modified"; break;

            case 5: this.Filter.SortColumnName = "Settings"; break;
            }

            this.Roles      = Web.Admin.Logic.Collections.Roles.Get(Filter, out TotalItems);
            this.TotalItems = TotalItems;
        }
Beispiel #2
0
        public async Task <dynamic> AutoComplete([FromUri] RoleListFilter filter)
        {
            filter = filter ?? new RoleListFilter();
            var result = await _sqlData.Role.AutoComplete(filter);

            return(new { Result = JsonConvert.DeserializeObject(result) });
        }
        public RoleListModel(string HolderName)
        {
            int result = 0;
            Filter = new RoleListFilter();
            AppParams = new ApplicationParameters();

            int TotalItems = 0;
            this.HolderName = HolderName;
            this.Filter.ItemsPerPage = (HttpContext.Current.Request["s"] != null && int.TryParse(HttpContext.Current.Request["s"], out result)) ? result : int.Parse(AppParams.AppUiPagingSize.Value);
            this.Filter.CurrentPage = (HttpContext.Current.Request["p"] != null && int.TryParse(HttpContext.Current.Request["p"], out result)) ? result : 1;

            this.Filter.SortColumn = (HttpContext.Current.Request["c"] != null && int.TryParse(HttpContext.Current.Request["c"], out result)) ? result : 1;
            this.Filter.SortOrderAsc = (HttpContext.Current.Request["o"] != null && (int.TryParse(HttpContext.Current.Request["o"], out result)) ? (result == 1 ? true : false) : true);

            this.Filter.SortColumnName = "RoleID";
            switch (this.Filter.SortColumn)
            {
                case 2: this.Filter.SortColumnName = "Name"; break;
                case 3: this.Filter.SortColumnName = "MemberCount"; break;
                case 6: this.Filter.SortColumnName = "Created"; break;
                case 7: this.Filter.SortColumnName = "Modified"; break;
                case 5: this.Filter.SortColumnName = "Settings"; break;
            }

            this.Roles = Web.Admin.Logic.Collections.Roles.Get(Filter, out TotalItems);
            this.TotalItems = TotalItems;
        }
Beispiel #4
0
        public JsonResult GetRoles(RolePaginInfo PaginInfo)
        {
            RoleListFilter Filter = new RoleListFilter();

            Filter.CurrentPage  = PaginInfo.CurrentPage;
            Filter.ItemsPerPage = PaginInfo.ItemsPerPage;
            Filter.SortOrderAsc = PaginInfo.SortOrderAsc;
            Filter.SortColumn   = PaginInfo.SortColumn;

            Filter.SortColumnName = "RoleID";
            switch (PaginInfo.SortColumn)
            {
            case 2: Filter.SortColumnName = "Name"; break;

            case 3: Filter.SortColumnName = "MemberCount"; break;

            case 6: Filter.SortColumnName = "Created"; break;

            case 7: Filter.SortColumnName = "Modified"; break;

            case 5: Filter.SortColumnName = "Settings"; break;
            }

            var totalItems = 0;
            var roles      = Web.Admin.Logic.Collections.Roles.Get(Filter, out totalItems);

            return(Json(new
            {
                Html = this.RenderPartialView("_RoleList", new RoleListModel(PaginInfo.HolderName, roles, Filter, totalItems))
            }, JsonRequestBehavior.AllowGet));
        }
 public RoleListModel()
 {
     Roles               = new List <Role>();
     Filter              = new RoleListFilter();
     HolderName          = "";
     Filter.ItemsPerPage = 5;
     Filter.CurrentPage  = 1;
     AppParams           = new ApplicationParameters();
 }
 public RoleListModel()
 {
     Roles = new List<Role>();
     Filter = new RoleListFilter();
     HolderName = "";
     Filter.ItemsPerPage = 5;
     Filter.CurrentPage = 1;
     AppParams = new ApplicationParameters();
 }
        public RoleListModel(String HolderName, List <Role> Roles, RoleListFilter Filter, int TotalItems)
        {
            this.Filter = new RoleListFilter();

            this.HolderName          = HolderName;
            this.Roles               = Roles;
            this.Filter.CurrentPage  = Filter.CurrentPage;
            this.Filter.ItemsPerPage = Filter.ItemsPerPage;
            this.Filter.SortColumn   = Filter.SortColumn;
            this.Filter.SortOrderAsc = Filter.SortOrderAsc;
            this.TotalItems          = TotalItems;
        }
        public RoleListModel(String HolderName, List<Role> Roles, RoleListFilter Filter, int TotalItems)
        {
            this.Filter = new RoleListFilter();

            this.HolderName = HolderName;
            this.Roles = Roles;
            this.Filter.CurrentPage = Filter.CurrentPage;
            this.Filter.ItemsPerPage = Filter.ItemsPerPage;
            this.Filter.SortColumn = Filter.SortColumn;
            this.Filter.SortOrderAsc = Filter.SortOrderAsc;
            this.TotalItems = TotalItems;
        }
        public JsonResult GetRoles(RolePaginInfo PaginInfo)
        {
            RoleListFilter Filter = new RoleListFilter();
            Filter.CurrentPage = PaginInfo.CurrentPage;
            Filter.ItemsPerPage = PaginInfo.ItemsPerPage;
            Filter.SortOrderAsc = PaginInfo.SortOrderAsc;
            Filter.SortColumn = PaginInfo.SortColumn;

            Filter.SortColumnName = "RoleID";
            switch (PaginInfo.SortColumn)
            {
                case 2: Filter.SortColumnName = "Name"; break;
                case 3: Filter.SortColumnName = "MemberCount"; break;
                case 6: Filter.SortColumnName = "Created"; break;
                case 7: Filter.SortColumnName = "Modified"; break;
                case 5: Filter.SortColumnName = "Settings"; break;
            }

            var totalItems = 0;
            var roles = Web.Admin.Logic.Collections.Roles.Get(Filter, out totalItems);

            return Json(new
            {
                Html = this.RenderPartialView("_RoleList", new RoleListModel(PaginInfo.HolderName, roles,Filter,totalItems))
            }, JsonRequestBehavior.AllowGet);
        }