public async Task <ActionResult <IEnumerable <RequisicaoTableViewModel> > > getUsuarioRequisicao([FromBody] DataTablesResponseViewModel model)
        {
            string filtro          = model.Search.Value;
            int    ordernar        = model.Order[0].Column;
            string ordernarDirecao = model.Order[0].Dir;

            int            _draw           = model.Draw;
            int            startRec        = model.Start;
            int            pageSize        = model.Length;
            IsolationLevel _isolationLevel = IsolationLevel.ReadUncommitted;
            ISqlBase       sqlBase         = SqlServerFactory.Create();

            GerenciarUsuario gerenciarUsuario = GerenciarUsuario.Create(sqlBase, _isolationLevel);


            IList <IdentityUserClaim <string> > usuarios = await gerenciarUsuario.getRequisicoes(startRec, filtro, pageSize, model.empresaUsuarioFuncao.EmpresaId, model.empresaUsuarioFuncao.UsuarioId);

            IList <RequisicaoTableViewModel> tableRequisicao = ((List <IdentityUserClaim <string> >)usuarios).ConvertAll(new Converter <IdentityUserClaim <string>, RequisicaoTableViewModel>(UsuarioConverter.converterIdentityUserClaimParaClaim));

            List <RequisicaoTableViewModel> requisicoesOrdenadas = UsuarioConfiguracao.ordenacaoTableUsuarioRequisicoes(ordernar, ordernarDirecao, tableRequisicao);

            int totalRegistros = gerenciarUsuario.totalRegistro;

            var retorno = this.Json(new { draw = _draw, recordsTotal = totalRegistros, recordsFiltered = totalRegistros, data = requisicoesOrdenadas });

            return(retorno);
        }
Пример #2
0
        public MaterialContexto getContexto()
        {
            var optionsBuilder = new DbContextOptionsBuilder <MaterialContexto>();

            optionsBuilder.UseSqlServer(SqlServerFactory.Create().getConnection());
            return(MaterialContexto.Create(optionsBuilder.Options));
        }
Пример #3
0
        public async Task <ActionResult <IEnumerable <RequisicaoTableViewModel> > > getsRequisicoes([FromBody] DataTablesResponseViewModel model)
        {
            string filtro          = model.Search.Value;
            int    ordernar        = model.Order[0].Column;
            string ordernarDirecao = model.Order[0].Dir;

            int            _draw           = model.Draw;
            int            startRec        = model.Start;
            int            pageSize        = model.Length;
            IsolationLevel _isolationLevel = IsolationLevel.ReadUncommitted;
            ISqlBase       sqlBase         = SqlServerFactory.Create();
            FuncaoManager  funcaoManager   = FuncaoManager.Create(sqlBase, _isolationLevel);

            List <IdentityRoleClaim <string> > funcoesRequisicoes = await funcaoManager.getsRequisicoes(model.empresaUsuarioFuncao.FuncaoId, startRec, filtro, pageSize);

            IList <RequisicaoTableViewModel> tableFuncaoRequisicao = funcoesRequisicoes.ConvertAll(new Converter <IdentityRoleClaim <string>, RequisicaoTableViewModel>(FuncaoConverter.converterIdentityRoleClaimParaClaim));

            IList <RequisicaoTableViewModel> funcoesRequisicoesOrdenadas = FuncaoConfiguracao.ordenacaoTableFuncoesRequisicoes(ordernar, ordernarDirecao, tableFuncaoRequisicao);

            int totalRegistros = funcaoManager.totalRegistro;

            var retorno = this.Json(new { draw = _draw, recordsTotal = totalRegistros, recordsFiltered = totalRegistros, data = funcoesRequisicoesOrdenadas });

            return(retorno);
        }
Пример #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });
            services.AddDbContext <UsuarioContexto>(options =>
                                                    options.UseSqlServer(SqlServerFactory.Create().getConnection()));
            services.AddDefaultIdentity <IdentityUser>().AddRoles <IdentityRole>()
            .AddEntityFrameworkStores <UsuarioContexto>()
            .AddDefaultTokenProviders();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            services.AddCors();
            services.AddAuthentication(options =>
            {
                options.DefaultScheme          = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            });
            services.AddTransient <IEmailSender, AuthMessageSender>();
        }
 private ServicoFactory(IsolationLevel isolationLevel)
 {
     sqlBase             = SqlServerFactory.Create();
     this.isolationLevel = isolationLevel;
 }