protected override IList <LocalizationGridModel> FetchData(GridSettings gridSettings)
        {
            var query = _repository.Query();

            Random rand       = new Random((int)DateTime.Now.Ticks);
            var    gridResult = JqGridHelper.GetGridResult(query, delegate(string fieldName)
            {
                return(fieldName);
            },
                                                           delegate(Localization model)
            {
                return(new LocalizationGridModel()
                {
                    Id = rand.Next(int.MaxValue),
                    //LocalizationId = model.Id,
                    Key = model.Key,
                    Value = model.Value,
                    JavaScript = model.JavaScript,
                    Language = model.Language
                });
            }
                                                           , gridSettings);

            return(gridResult);
        }
示例#2
0
        /// <summary>
        /// Ги зема податоците за сите корисници од тип Администратор по
        /// сите општини и МТВ
        /// </summary>
        /// <param name="gridSettings"></param>
        /// <returns></returns>
        protected override IList <ZelsUsersGridModel> FetchData(GridSettings gridSettings)
        {
            var query = _userRepository.Query()
                        .Where(x => x.Roles.Any(r => r.RoleName == Roles.MunicipalityAdministrator ||
                                                r.RoleName == Roles.ExternalUsers ||
                                                r.RoleName == Roles.UpravenInspektor
                                                ));

            var gridResult = JqGridHelper.GetGridResult(query, delegate(string fieldName)
            {
                switch (fieldName)
                {
                case "Institution.Name":
                    return("Institution.Id");
                }

                return(fieldName);
            },
                                                        delegate(User model)
            {
                return(model.MapToViewModel());
            }
                                                        , gridSettings);

            return(gridResult);
        }
示例#3
0
        protected override IList <PosGridModel> FetchData(GridSettings gridSettings)
        {
            var query = _posRepository.Query();

            var gridResult = JqGridHelper.GetGridResult(query, delegate(string fieldName)
            {
                switch (fieldName)
                {
                    //case "Institution.Name":
                    //    return "Institution.Id";
                }

                return(fieldName);
            },
                                                        delegate(Pos model)
            {
                return(model.MapToViewModel());
            }
                                                        , gridSettings);

            return(gridResult);
        }
        protected override IList <UsersGridModel> FetchData(GridSettings gridSettings)
        {
            var query = _userRepository.Query()
                        .Where(x => x.Roles.Any(r => r.RoleName == Roles.Admin));

            var gridResult = JqGridHelper.GetGridResult(query, delegate(string fieldName)
            {
                switch (fieldName)
                {
                    //case "Institution.Name":
                    //    return "Institution.Id";
                }

                return(fieldName);
            },
                                                        delegate(User model)
            {
                return(model.MapToViewModel());
            }
                                                        , gridSettings);

            return(gridResult);
        }