public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(Input.Email);

                if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return(RedirectToPage("./ForgotPasswordConfirmation"));
                }

                // For more information on how to enable account confirmation and password reset please
                // visit https://go.microsoft.com/fwlink/?LinkID=532713
                var code = await _userManager.GeneratePasswordResetTokenAsync(user);

                var callbackUrl = Url.Page(
                    "/Account/ResetPassword",
                    pageHandler: null,
                    values: new { code },
                    protocol: Request.Scheme);

                // instanciar objeto email
                var _configAplicacoes =
                    _contexto.AppConfiguracoes_Aplicativo
                    .FirstOrDefault();

                var _objemail = new ObjetoEmailEnvio()
                {
                    ASSUNTO                   = "[ESQUECEU SUA SENHA] House2Invest",
                    COPIA                     = _configAplicacoes.mailToAdd,
                    mailFrom                  = _configAplicacoes.mailFrom,
                    MENSAGEM                  = string.Format($"Olá!!!{Environment.NewLine}<br/>Você solicitou um reset de senha.<br/>Clique <a href='" + callbackUrl + "'>AQUI</a> para alterar a sua senha."),
                    PARA                      = Input.Email,
                    smtpCredentialsEmail      = _configAplicacoes.smtpCredentialsEmail,
                    smtpCredentialsSenha      = _configAplicacoes.smtpCredentialsSenha,
                    smtpEnableSsl             = _configAplicacoes.smtpEnableSsl,
                    smtpHost                  = _configAplicacoes.smtpHost,
                    smtpPort                  = _configAplicacoes.smtpPort,
                    smtpUseDefaultCredentials = _configAplicacoes.smtpUseDefaultCredentials
                };
                var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);

                //await _emailSender.SendEmailAsync(
                //    Input.Email,
                //    "Reset Password",
                //    $"Please reset your password by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

                return(RedirectToPage("./ForgotPasswordConfirmation"));
            }

            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");
            var _erroValid = false;
            var ip         = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
            var _ips       = new string[] { ip, "value2" };

            try
            {
                if (!Input.Termos)
                {
                    ModelState.AddModelError(string.Empty, "Leia e Aceite os Termos de Uso antes de prosseguir");
                    _erroValid = true;
                }
                if (string.IsNullOrEmpty(Input.Email))
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo EMAIL");
                    _erroValid = true;
                }
                if (string.IsNullOrEmpty(Input.Password))
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo SENHA");
                    _erroValid = true;
                }
                if (string.IsNullOrEmpty(Input.ConfirmPassword))
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo CONFIRME SUA SENHA");
                    _erroValid = true;
                }
                if (string.IsNullOrEmpty(Input.Nome))
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo NOME");
                    _erroValid = true;
                }
                if (string.IsNullOrEmpty(Input.Sobrenome))
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo SOBRENOME");
                    _erroValid = true;
                }
                if (Convert.ToDateTime(Input.Nascimento).Year == 0001)
                {
                    ModelState.AddModelError(string.Empty, "Preencha o campo DATA DE NASCIMENTO");
                    _erroValid = true;
                }
                //if (Input.ImagemDocDigitalizado == null)
                //{
                //    ModelState.AddModelError(string.Empty, "Necessário o envio de um documento com sua foto");
                //    _erroValid = true;
                //}
                if (Input.ImagemSelfie == null)
                {
                    ModelState.AddModelError(string.Empty, "Necessário o envio de uma foto sua");
                    _erroValid = true;
                }
                //if (Input.ImagemComprovanteResidencia == null)
                //{
                //    ModelState.AddModelError(string.Empty, "Necessário o envio de um comprovante de residência");
                //    _erroValid = true;
                //}
                if (Input.Password != Input.ConfirmPassword)
                {
                    ModelState.AddModelError(string.Empty, "A nova senha e a sua confirmação não conferem. Digite novamente");
                    _erroValid = true;
                }

                if (_erroValid)
                {
                    return(Page());
                }

                var _config = _context.AppPerfil
                              .Include(x => x.AppConfiguracoes)
                              .Include(x => x.AppConfiguracoes.AppConfiguracoes_Aplicativo)
                              .Include(y => y.AppConfiguracoes.AppConfiguracoes_Azure)
                              .FirstOrDefault();

                //if (Input.ImagemDocDigitalizado != null)
                //{
                //    var _imagemLogotipo =
                //        await VerificadoresRetornos
                //        .EnviarImagemAzure(Input.ImagemDocDigitalizado, 502000, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

                //    if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                //    {
                //        Input.Sistema_URLFotoDoc = _imagemLogotipo;
                //    }
                //}

                if (Input.ImagemSelfie != null)
                {
                    var _imagemLogotipo =
                        await VerificadoresRetornos
                        .EnviarImagemAzure(Input.ImagemSelfie, 502000, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

                    if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                    {
                        Input.Sistema_URLSelfieDocVERSO = _imagemLogotipo;
                    }
                }

                //if (Input.ImagemComprovanteResidencia != null)
                //{
                //    var _imagemLogotipo =
                //        await VerificadoresRetornos
                //        .EnviarImagemAzure(Input.ImagemComprovanteResidencia, 502000, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

                //    if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                //    {
                //        Input.Sistema_URLComprovanteResidencia = _imagemLogotipo;
                //    }
                //}

                var user = new UsuarioApp
                {
                    AppConfiguracoesId = _context.AppConfiguracoes.FirstOrDefault().Id,
                    Nome                  = Input.Nome,
                    Sobrenome             = Input.Sobrenome,
                    Nascimento            = Input.Nascimento,
                    UserName              = Input.Email,
                    NormalizedUserName    = Input.Email,
                    Email                 = Input.Email,
                    NormalizedEmail       = Input.Email,
                    EmailConfirmed        = false,
                    PasswordHash          = Input.Password,
                    SecurityStamp         = string.Empty,
                    AvatarUsuario         = Input.Sistema_URLSelfieDocVERSO,
                    Sistema_FuncaoUsuario = "USUARIO",
                    Bio = "Olá mundo",
                    ContatoAutenticacao_Email            = Input.Email,
                    ContatoAutenticacao_EmailAlternativo = Input.ContatoAutenticacao_EmailAlternativo,
                    ContatoAutenticacao_Fone             = Input.Contato_FoneCelular,
                    ContatoAutenticacao_FoneAlternativo  = Input.Contato_FoneComercial,
                    Contato_Bairro        = Input.Contato_Bairro,
                    Contato_CEP           = Input.Contato_CEP,
                    Contato_Cidade        = Input.Contato_Cidade,
                    Contato_Complemento   = Input.Contato_Complemento,
                    Contato_Escritorio    = Input.Contato_Escritorio,
                    Contato_Estado        = Input.Contato_Estado,
                    Contato_FoneCelular   = Input.Contato_FoneCelular,
                    Contato_FoneComercial = Input.Contato_FoneComercial,
                    Contato_Logradouro    = Input.Contato_Logradouro,
                    Contato_LogradouroNum = Input.Contato_LogradouroNum,
                    Contato_Pais          = "BRASIL",
                    Contato_Website       = Input.Contato_Website,
                    Genero                              = Input.Genero,
                    EstadoCivil                         = Input.EstadoCivil,
                    ImagemFundoPerfil                   = "/images/fundo_padrao_perfil.png",
                    Documentacao_CNPJ                   = Input.Documentacao_CNPJ,
                    Documentacao_CPF                    = Input.Documentacao_CPF,
                    Documentacao_RG                     = Input.Documentacao_RG,
                    Documentacao_TPPessoa               = Input.Documentacao_TPPessoa,
                    Financeiro_Banco_Ag                 = string.IsNullOrEmpty(Input.Financeiro_Banco_Ag) ? "" : Input.Financeiro_Banco_Ag,
                    Financeiro_Banco_CC                 = string.IsNullOrEmpty(Input.Financeiro_Banco_CC) ? "" : Input.Financeiro_Banco_CC,
                    Financeiro_Banco_Nome               = string.IsNullOrEmpty(Input.Financeiro_Banco_Nome) ? "" : Input.Financeiro_Banco_Nome,
                    Sistema_AcessoBloqueado             = true,
                    Sistema_DataDeclaracaoCienciaTermos = DateTime.Now,
                    Sistema_DeclaracaoCienciaTermos     = Input.Termos,
                    Sistema_URLComprovanteResidencia    = Input.Sistema_URLComprovanteResidencia,
                    Sistema_URLSelfieDocFRENTE          = "",
                    MidiasSociais_Facebook              = "",
                    MidiasSociais_GooglePlus            = "",
                    MidiasSociais_Instagram             = "",
                    MidiasSociais_Linkedin              = "",
                    MidiasSociais_Pinterest             = "",
                    MidiasSociais_Twitter               = "",
                    MidiasSociais_Youtube               = "",
                    PhoneNumber                         = Input.Contato_FoneCelular,
                    PhoneNumberConfirmed                = true,
                    LockoutEnabled                      = false,
                    Trabalho_Empresa                    = "NÃO INFORMADO",
                    Trabalho_Cargo                      = "NÃO INFORMADO",
                    Trabalho_Profissao                  = "NÃO INFORMADO",
                    TwoFactorEnabled                    = false,
                    Sistema_URLFotoDoc                  = Input.Sistema_URLFotoDoc,
                    Sistema_URLSelfieDocVERSO           = Input.Sistema_URLSelfieDocVERSO,
                    Financeiro_Investidor_Perfil        = Input.Financeiro_Investidor_Perfil,
                    Sistema_DeclaracaoPessoaExposta     = Input.Sistema_DeclaracaoPessoaExposta,
                    Sistema_NaoAparecerListaProjetos    = Input.Sistema_NaoAparecerListaProjetos
                };

                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    await _userManager.AddToRoleAsync(user, "USU");

                    _logger.LogInformation("Usuário criado.");

                    //------------------------------------
                    // LOGCENTRAL
                    //------------------------------------
                    await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                    {
                        ICOMENS             = "<i class='fas fa-user-plus text-warning'></i>",
                        MENSAGEM            = $"<img src='{user.AvatarUsuario}' style='border-radius:100%;max-width:100%;height:24px;margin-right:5px;'/> <b>{user.Nome} {user.Sobrenome}</b>,<br> com o email <b>{user.Email}</b><br> <b style='color:green;'>CRIOU UMA CONTA</b> na plataforma.",
                        ACAO                = $"REGISTRO",
                        DTHR                = DateTime.Now,
                        IP                  = _ips.FirstOrDefault(),
                        STATUS              = "PENDENTE",
                        TIPO                = "ACESSO A PLATAFORMA",
                        UsuarioAppId        = user.Id,
                        VALOR               = 0,
                        UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                    }, _context);

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.Page(
                        "/Account/ConfirmEmail",
                        pageHandler: null,
                        values: new { userId = user.Id, code },
                        protocol: Request.Scheme);

                    //var _conteudohtml = "<div style='font-size:20px;line-height:30px;'>";
                    var _conteudohtml = "<div style='line-height: 16px;'>";

                    _conteudohtml += $"Bem-vindo <b>{user.Nome} {user.Sobrenome}</b>,<br>";
                    _conteudohtml += $"Recebemos sua solicitação para cadastro na HOUSE2INVEST.<br>";
                    _conteudohtml += $"Para acessar a plataforma de investimentos da HOUSE2INVEST, você deve ativar o seu cadastro. Para isso, utilize o link abaixo e confirme os dados que você informou:<br>";
                    _conteudohtml += $"USUÁRIO: <b>{user.Email}</b> com o CPF: <b>{user.Documentacao_CPF}</b><br><br>";
                    _conteudohtml += $"Clique <a href='{callbackUrl}'>aqui</a> e ative a sua conta, ou copie e cole o link abaixo no seu navegador de preferência.<br><br><br>";
                    _conteudohtml += $"Atenciosamente,<br>";
                    _conteudohtml += $"Equipe House2Invest<br>";
                    _conteudohtml += $"<br><br>";

                    _conteudohtml += $"<div style='font-size:9px;font-style:italic;line-height:12px;'>";
                    _conteudohtml += $"Este é um e-mail automático gerado pelo sistema. Em caso de dúvidas, acesse nosso Atendimento Online. Para receber com sucesso nossos e-mails, é importante adicionar o e-mail [email protected] na sua lista de endereços confiáveis.<br>";
                    _conteudohtml += $"Nós valorizamos a sua privacidade. Estamos enviando esse email porque você entrou em contato com um de nossos usuários.<br>";
                    _conteudohtml += $"AVISO LEGAL: Algumas mensagens enviadas por nós podem conter conteúdos escritos e publicadas por usuários terceiros não ligados ao site, cuja responsabilidade pelas informações é exclusiva do autor - entre em contato conosco em caso de dúvidas. Ao ler este e-mail você declara que leu e aceita nossos <a href='https://depoisdalinha.blob.core.windows.net/house2invest/docs/novosdocs_usuarios/TERMO_DE_USO_H2I.pdf'>Termos de uso e privacidade</a>.<br>";
                    _conteudohtml += $"</div>";

                    _conteudohtml += $"</div>";

                    // instanciar objeto email
                    var _configAplicacoes =
                        _context.AppConfiguracoes_Aplicativo
                        .FirstOrDefault();
                    var _objemail = new ObjetoEmailEnvio()
                    {
                        ASSUNTO                   = "[CONFIRME SEU EMAIL] House2Invest",
                        COPIA                     = _configAplicacoes.mailToAdd,
                        mailFrom                  = _configAplicacoes.mailFrom,
                        MENSAGEM                  = _conteudohtml,
                        PARA                      = user.Email,
                        smtpCredentialsEmail      = _configAplicacoes.smtpCredentialsEmail,
                        smtpCredentialsSenha      = _configAplicacoes.smtpCredentialsSenha,
                        smtpEnableSsl             = _configAplicacoes.smtpEnableSsl,
                        smtpHost                  = _configAplicacoes.smtpHost,
                        smtpPort                  = _configAplicacoes.smtpPort,
                        smtpUseDefaultCredentials = _configAplicacoes.smtpUseDefaultCredentials
                    };
                    var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);

                    //----------------------------------------------------
                    // LOGCENTRAL
                    //----------------------------------------------------
                    await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                    {
                        ICOMENS             = "<i class='fas fa-envelope text-primary'></i>",
                        MENSAGEM            = "<i style='font-size:11px;font-family:monospace;line-height:10px;text-align:justify!important;'>" + _conteudohtml + "</i>" + $"<br> <div>    <a href='javascript:ReenviarEmailLog(0);' class='btn btn-sm bg-success' title='Reenviar email' style='padding:0.25rem 0.4rem;font-size:14px;'><i class='fas fa-paper-plane'></i></a></div>",
                        ACAO                = $"ENVIOU EMAIL",
                        DTHR                = DateTime.Now,
                        IP                  = _ips.FirstOrDefault(),
                        STATUS              = "AGUARDANDO CONFIRMAÇÃO",
                        TIPO                = "NOTIFICAÇÃO",
                        UsuarioAppId        = user.Id,
                        VALOR               = 0,
                        UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                    }, _context);

                    //var _enviou =
                    //    await VerificadoresRetornos
                    //    .EnviarEmail(user.Email, callbackUrl, "[CONFIRME SEU EMAIL] House2Invest", _conteudohtml);

                    //var ip = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
                    //var _ips = new string[] { ip, "value2" };
                    //// LOGCENTRAL
                    //_context.LOGCENTRALs.Add(new LOGCENTRAL()
                    //{
                    //    ACAO = "ENVIO EMAIL - CONFIRME SEU EMAIL",
                    //    INVEST_LancamentoId = 0,
                    //    INVEST_ModeloDocId = 0,
                    //    TP = "",
                    //    URLDOC = "",
                    //    VALOR = 0,
                    //    STATUS = "",
                    //    UsuarioAppId = user.Id,
                    //    IP = _ips.FirstOrDefault()
                    //});
                    //await _context.SaveChangesAsync();

                    if (_enviou == "ok")
                    {
                        return(Redirect("/Identity/Account/RegisterAgradec?userId=" + user.Id + "&code=" + code));
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, _enviou);
                    }
                }

                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }
            catch (Exception erro)
            {
                ModelState.AddModelError(string.Empty, erro.Message);
            }

            return(Page());
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var _config = _context.AppPerfil
                          .Include(x => x.AppConfiguracoes)
                          .Include(x => x.AppConfiguracoes.AppConfiguracoes_Aplicativo)
                          .Include(y => y.AppConfiguracoes.AppConfiguracoes_Azure)
                          .FirstOrDefault();

            var _errosValidacoes = false;

            if (modelo.ArquivoComprovTransf != null)
            {
                var _imagemLogotipo =
                    await VerificadoresRetornos
                    .EnviarImagemAzure(modelo.ArquivoComprovTransf, 614200, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

                if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                {
                    modelo.URLComprovTransf = _imagemLogotipo;
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "A imagem é muito grande");
                    _errosValidacoes = true;
                }
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Selecione uma imagem do seu computador");
                _errosValidacoes = true;
            }

            //if (modelo.ArquivoPerfilInvestidor != null)
            //{
            //    var _imagemLogotipo =
            //        await VerificadoresRetornos
            //        .EnviarImagemAzure(modelo.ArquivoPerfilInvestidor, 614200, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

            //    if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
            //        modelo.URLPerfilInvest = _imagemLogotipo;
            //    else
            //    {
            //        ModelState.AddModelError(string.Empty, "A imagem é muito grande");
            //        _errosValidacoes = true;
            //    }
            //}
            //else
            //{
            //    ModelState.AddModelError(string.Empty, "Selecione uma imagem do seu computador");
            //    _errosValidacoes = true;
            //}

            //if (Convert.ToDouble(BlocoProjInvestimento.LanceMinimo) > Convert.ToDouble(BlocoProjInvestimento.Valor))
            //{
            //    ModelState.AddModelError(string.Empty, "O Lance mínimo deve ser INFERIOR ao VALOR TOTAL DO INVESTIMENTO");
            //    _errosValidacoes = true;
            //}

            //if (VerificadoresRetornos.ConverteStringParaDateTime(BlocoProjInvestimento.Contador_DataFinal) < DateTime.Now)
            //{
            //    ModelState.AddModelError(string.Empty, "A data limite do contador deve ser SUPERIOR a data de hoje");
            //    _errosValidacoes = true;
            //}

            //if (Convert.ToDouble(BlocoProjInvestimento.Valor) <= 0)
            //{
            //    ModelState.AddModelError(string.Empty, "Necessário: VALOR TOTAL DO INVESTIMENTO");
            //    _errosValidacoes = true;
            //}

            //if (Convert.ToDouble(BlocoProjInvestimento.LanceMinimo) <= 0)
            //{
            //    ModelState.AddModelError(string.Empty, "Necessário: VALOR LANCE MÍNIMO");
            //    _errosValidacoes = true;
            //}

            if (_errosValidacoes)
            {
                modelo.URLComprovTransf = @"/temas/dpslintm1/assets/images/sem-imagem-modelo-projetos.png";
                modelo.URLPerfilInvest  = @"/temas/dpslintm1/assets/images/sem-imagem-modelo-projetos.png";
                return(Page());
            }

            _context.INVEST_LancamentoImagens.Add(modelo);
            await _context.SaveChangesAsync();

            //var _enviou =
            //    await VerificadoresRetornos
            //    .EnviarEmail(_usuario.Email, "", "[INVESTIMENTO] House2Invest", string.Format($"Olá!!!{Environment.NewLine}<br/>Você fez um investimento de <b>{_valormoeda.ToString("C2")}</b> em <b>{_context.BlocoProjInvestimentos.Where(x => x.Id == Convert.ToInt32(_id)).FirstOrDefault().Titulo}</b>."));

            var _Lancamento =
                _context.INVEST_Lancamentos
                .Include(x => x.UsuarioApp)
                .Include(x => x.BlocoProjInvestimentos)
                .Where(x => x.Id == modelo.INVEST_LancamentoId)
                .FirstOrDefault();

            modelo.INVEST_Lancamento = _Lancamento;

            var ip   = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
            var _ips = new string[] { ip, "value2" };

            //// LOGCENTRAL
            await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
            {
                ICOMENS             = "<i class='fas fa-image text-success'></i>",
                MENSAGEM            = $"O usuário <b>{_Lancamento.UsuarioApp.Nome} {_Lancamento.UsuarioApp.Sobrenome}</b> <b style='color:green;'>ENVIOU</b> os comprovantes digitalizados para a reserva de <b>{_Lancamento.Valor.ToString("C2")}</b> na oferta <b>{_Lancamento.BlocoProjInvestimentos.Titulo}</b>.",
                ACAO                = $"ENVIO DE IMAGEM (TED)",
                DTHR                = DateTime.Now,
                IP                  = _ips.FirstOrDefault(),
                STATUS              = "ENVIADO",
                TIPO                = "CONFIRMAÇÕES",
                UsuarioAppId        = _Lancamento.UsuarioAppId,
                VALOR               = _Lancamento.Valor,
                UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
            }, _context);

            //_context.LOGCENTRALs.Add(new LOGCENTRAL()
            //{
            //    ACAO = "INVESTIMENTO - ENVIO DA IMAGEM (TED)",
            //    INVEST_LancamentoId = modelo.INVEST_Lancamento.Id,
            //    INVEST_ModeloDocId = modelo.INVEST_Lancamento.Id,
            //    TP = modelo.INVEST_Lancamento.TP,
            //    URLDOC = "",
            //    VALOR = modelo.INVEST_Lancamento.Valor,
            //    STATUS = modelo.INVEST_Lancamento.Status,
            //    UsuarioAppId = modelo.INVEST_Lancamento.UsuarioAppId,
            //    IP = _ips.FirstOrDefault()
            //});
            //await _context.SaveChangesAsync();


            // USU LOGADO
            var _usu = _context.Users
                       .Where(x => x.UserName == User.Identity.Name)
                       .FirstOrDefault();

            // LANCAMENTO EM QUESTÃO
            var _lanca = _context.INVEST_Lancamentos
                         .Include(x => x.BlocoProjInvestimentos)
                         .Where(x => x.Id == modelo.INVEST_LancamentoId)
                         .FirstOrDefault();

            //--------------------------------
            // APLICACAO PADRAO
            //--------------------------------
            var _configAplicacoes =
                _context.AppConfiguracoes_Aplicativo
                .FirstOrDefault();

            // instanciar objeto email
            var _objemail = new ObjetoEmailEnvio()
            {
                ASSUNTO                   = "[INVESTIMENTO] House2Invest",
                COPIA                     = _configAplicacoes.mailToAdd,
                mailFrom                  = _configAplicacoes.mailFrom,
                MENSAGEM                  = string.Format($"Olá!!!{Environment.NewLine}<br/>A documentação referente a aprovação do investimento <b>" + _lanca.BlocoProjInvestimentos.Titulo + "</b> foi ENVIADA COM SUCESSO. Estamos analisando sua documentação."),
                PARA                      = _usu.Email,
                smtpCredentialsEmail      = _configAplicacoes.smtpCredentialsEmail,
                smtpCredentialsSenha      = _configAplicacoes.smtpCredentialsSenha,
                smtpEnableSsl             = _configAplicacoes.smtpEnableSsl,
                smtpHost                  = _configAplicacoes.smtpHost,
                smtpPort                  = _configAplicacoes.smtpPort,
                smtpUseDefaultCredentials = _configAplicacoes.smtpUseDefaultCredentials
            };
            var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);


            return(RedirectToPage("./Index"));
        }
Esempio n. 4
0
        /*
         * RE 2e. Evidência de que a plataforma restitui os montantes investidos
         *      para os investidores, num prazo de até 5 dias úteis, nos casos de
         *      revogação (após suspensão) ou cancelamento da oferta.
         *
         * CONTROLE DE TRANSFERÊNCIAS EM CASO DE:
         * SITUAÇÃO:
         * (I)	SUSPENSÃO DA OFERTA:
         *  a.	H2i deve Informar por e-mail que a CVM suspendeu oferta e a h2i
         *      tem 30 dias para atender a exigência.
         *  b.	O investidor pode enviar e-mail solicitando a revogação da oferta.
         *      Se mandar, a H2i deverá restituir o valor integral em até
         *      5 dias contados do recebimento do e-mail
         *
         * (II)	SUSPENSÃO CONVALIDAR EM CANCELAMENTO
         *  a.	Se a CVM cancelar a oferta, os investidores devem ser
         *      restituídos em 5 dias úteis contados do cancelamento.
         *
         * (III)   Encerramento da Oferta – Concluído o processo de captação com êxito
         *  a.	Transferência para SPE o montante final captado no prazo
         *      de até 5 dias úteis após a data do encerramento.
         *
         *  b.	Devolução do valor investido acrescido da remuneração do capital
         *      ao final do período contratado ao final do prazo de validade do título
         *
         * (IV)	Restituição do montante final investido quando o valor
         *      alvo mínimo não atingir 2/3 (dois terços) do valor alvo máximo;
         *
         */
        public async Task <JsonResult> OnPostAsync()
        {
            /*
             *  Evidenciar a tipificação do investidor de acordo com o montante:
             *  a) novo investidor investindo menos de 10mil
             *  b) novo investidor investindo mais de 10 mil
             *  c) investidor fazendo novo aporte em oferta, com total menor de 10mil (acumulado)
             *  d) investidor fazendo novo aporte em oferta, com total maior de 10mil (acumulado)
             *  e) investidor fazendo novo aporte em oferta, com total menor de 100mil (acumulado)
             *  f) autodeclaração de valores acumulados multiplataforma
             */

            double _valormoeda = 0;

            try
            {
                if (modelo.ArquivoComprovResid == null)
                {
                    return(new JsonResult(new
                    {
                        status = "arq_comprov_resid",
                        mens = "Você precisa enviar um comprovante de residência"
                    }));
                }

                if (modelo.AceitouTermos == false)
                {
                    return(new JsonResult(new
                    {
                        status = "termos",
                        mens = "Você precisa ler e aceitar os Termos desta oferta"
                    }));
                }

                if (string.IsNullOrEmpty(modelo.usuarioObjeto.Financeiro_Banco_Nome) ||
                    string.IsNullOrEmpty(modelo.usuarioObjeto.Financeiro_Banco_Ag) ||
                    string.IsNullOrEmpty(modelo.usuarioObjeto.Financeiro_Banco_CC))
                {
                    return(new JsonResult(new
                    {
                        status = "info_usu_banco",
                        mens = "Você precisa corrigir suas informações bancárias."
                    }));
                }

                if (string.IsNullOrEmpty(modelo.usuarioObjeto.Sistema_URLSelfieDocFRENTE) ||
                    string.IsNullOrEmpty(modelo.usuarioObjeto.Sistema_URLSelfieDocVERSO))
                {
                    return(new JsonResult(new
                    {
                        status = "info_usu_selfies",
                        mens = "Envie um documento com foto (Frente/Verso) antes de solicitar uma reserva.<br> <a href='/Identity/Account/Manage'>Clique aqui para resolver isso</a>"
                    }));
                }

                if (string.IsNullOrEmpty(modelo.PerfilInvestidorInformado))
                {
                    return(new JsonResult(new
                    {
                        status = "perfil_investidor",
                        mens = "Você precisa selecionar um PERFIL DE INVESTIDOR"
                    }));
                }

                var _usuario = _context.Users
                               .Where(x => x.UserName == User.Identity.Name)
                               .FirstOrDefault();

                _valormoeda = Convert.ToDouble(modelo.ValorInvestido);

                var _bloco = _context.BlocoProjInvestimentos
                             .Where(x => x.Id == Convert.ToInt32(modelo.blocoProjInvestimento.Id))
                             .FirstOrDefault();

                //if (_valormoeda > 10000 && _usuario.Financeiro_Investidor_Perfil == "C")
                //{
                //    return Page();
                //    //return new
                //    //{
                //    //    Status = "erro",
                //    //    Mens = $"VALOR SUPERIOR A <b>R$ 10.000,00</b>.<br> Deseja alterar o seu perfil de investidor? Clique <a href='/Correio/Conversas?uid=2751483e-2c65-4629-84b5-abc20c940c1c&idinv=" + modelo.blocoProjInvestimento.Id + "' target='_blank'><b>AQUI</b></a>.",
                //    //    Dados = "",
                //    //    Total = 0
                //    //};
                //}

                //if (_valormoeda > 1000000 && _usuario.Financeiro_Investidor_Perfil == "B")
                //{
                //    return Page();
                //    //return new
                //    //{
                //    //    Status = "erro",
                //    //    Mens = $"VALOR SUPERIOR A <b>R$ 1.000.000,00</b>.<br> Deseja alterar o seu perfil de investidor? Clique <a href='/Correio/Conversas?uid=2751483e-2c65-4629-84b5-abc20c940c1c&idinv=" + modelo.blocoProjInvestimento.Id + "' target='_blank'><b>AQUI</b></a>.",
                //    //    Dados = "",
                //    //    Total = 0
                //    //};
                //}

                var _valortotalgeral = 0.0;
                try
                {
                    _valortotalgeral = _context.INVEST_Lancamentos
                                       //.Where(x => x.BlocoProjInvestimentosId == _bloco.Id && x.Status == "A")
                                       .Where(x => x.BlocoProjInvestimentosId == _bloco.Id)
                                       .Sum(x => x.Valor);
                }
                catch (Exception) { }
                var _valorbloco = Convert.ToDouble(_bloco.Valor);
                if (_valormoeda + _valortotalgeral > _valorbloco)
                {
                    return(new JsonResult(new
                    {
                        status = "valor",
                        mens = $"Infelizmente não podemos aportar o valor total da sua reserva, pois o valor informado ultrapassa o limite esperado desta oferta.<br>O valor excedido foi de: <b>{(_valormoeda + _valortotalgeral - _valorbloco).ToString("C2")}</b>"
                    }));

                    //return Page();
                    //return new
                    //{
                    //    Status = "erro",
                    //    Mens = $"O VALOR QUE VOCÊ DESEJA INVESTIR, ULTRAPASSA O VALOR TOTAL DA OFERTA. INVISTA UM VALOR MENOR.",
                    //    Dados = "",
                    //    Total = 0
                    //};
                }

                //var _totalinvestido = 0.0;
                //try
                //{
                //    _totalinvestido = _context.INVEST_Lancamentos
                //        .Where(x => x.UsuarioAppId == _usuario.Id)
                //        .Sum(x => x.Valor);
                //}
                //catch (Exception) { }

                //if (_valormoeda + _totalinvestido > _valorbloco)
                ////if (_valormoeda + _totalinvestido > (_usuario.Financeiro_Investidor_Perfil == "C" ? 10000 : _usuario.Financeiro_Investidor_Perfil == "B" ? 1000000 : 10000))
                //{
                //    //var _valorfinal = ((_usuario.Financeiro_Investidor_Perfil == "C" ? 10000 : _usuario.Financeiro_Investidor_Perfil == "B" ? 1000000 : 10000) - _totalinvestido);
                //    var _valorfinal = _valormoeda + _totalinvestido;
                //    //return Page();
                //    return new JsonResult(new
                //    {
                //        status = "valor",
                //        mens = $"VOCÊ ULTRAPASSOU O LIMITE DE INVESTIMENTO PARA O SEU PERFIL.<br> ULTRAPASSADO: <b>R$ " + (_valorfinal - _valorbloco).ToString("C2") + "</b>.<br> Deseja alterar seu perfil? Clique <a href='/Correio/Conversas?uid=2751483e-2c65-4629-84b5-abc20c940c1c&idinv=" + modelo.blocoProjInvestimento.Id + "' target='_blank'>AQUI</a>."
                //    });

                //    //return new
                //    //{
                //    //    Status = "erro",
                //    //    Mens = $"VOCÊ ULTRAPASSOU O LIMITE DE INVESTIMENTO PARA O SEU PERFIL.<br> SEU SALDO É DE: <b>R$ " + _valorfinal.ToString("C2") + "</b>.<br> Deseja alterar seu perfil? Clique <a href='/Correio/Conversas?uid=2751483e-2c65-4629-84b5-abc20c940c1c&idinv=" + modelo.blocoProjInvestimento.Id + "' target='_blank'>AQUI</a>.",
                //    //    Dados = "",
                //    //    Total = 0
                //    //};
                //}

                //_context.BlocoProjInvestimentoValores.Add(new BlocoProjInvestimentoValor()
                //{
                //    BlocoProjInvestimentoId = Convert.ToInt32(_id),
                //    UsuarioAppId = _usuario.Id,
                //    Valor = _valormoeda
                //});
                //await _context.SaveChangesAsync();

                //-------------------
                // OBJETO USUARIO
                //-------------------
                //var _pegaUsu =
                //    _context.Users
                //    .Where(x => x.UserName == User.Identity.Name)
                //    .FirstOrDefault();

                //-------------------
                // LOGS FINANCEIROS
                //-------------------
                // LANCAMENTO
                var _novoLancamento = new INVEST_Lancamento()
                {
                    BlocoProjInvestimentosId = Convert.ToInt32(modelo.blocoProjInvestimento.Id),
                    UsuarioAppId             = _usuario.Id,
                    TP     = "E",
                    Valor  = _valormoeda,
                    Status = "P",
                    PerfilInvestidorInformado = modelo.PerfilInvestidorInformado
                };
                _context.INVEST_Lancamentos.Add(_novoLancamento);
                await _context.SaveChangesAsync();

                var ip   = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
                var _ips = new string[] { ip, "value2" };

                //var _valormindoc = Convert.ToDouble(_context.BlocoProjInvestimentos.Where(x => x.Id == Convert.ToInt32(modelo.blocoProjInvestimento.Id)).FirstOrDefault().ValorMinimoDocs);
                //if (_valormoeda > _valormindoc)
                //{

                // LANCAMENTOS DOC
                var _listaItensDoc =
                    await _context.BlocoProjInvestimento_ItemDocs
                    .Include(x => x.INVEST_ModeloDoc)
                    .Where(x => x.BlocoProjInvestimentoId == _novoLancamento.BlocoProjInvestimentosId)
                    .ToListAsync();

                var _indiceCuringaModeloDocProblemaReferencia = 0;
                foreach (var item in _listaItensDoc)
                {
                    var _novoLancamentoDoc = new INVEST_LancamentoDoc()
                    {
                        INVEST_LancamentoId = _novoLancamento.Id,
                        INVEST_ModeloDocId  = item.INVEST_ModeloDocId,
                        URLDoc = "",
                        TP     = "A"
                    };
                    _context.INVEST_LancamentoDocs.Add(_novoLancamentoDoc);
                    await _context.SaveChangesAsync();

                    _indiceCuringaModeloDocProblemaReferencia = item.INVEST_ModeloDocId;
                }

                foreach (var item in _listaItensDoc)
                {
                    await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                    {
                        ICOMENS             = "<i class='fas fa-file-signature text-primary'></i>",
                        MENSAGEM            = $"ASSINOU DIGITALMENTE {item.INVEST_ModeloDoc.Titulo}",
                        ACAO                = $"ASSINATURA DIGITAL",
                        DTHR                = DateTime.Now,
                        IP                  = _ips.FirstOrDefault(),
                        STATUS              = "",
                        TIPO                = "NOTIFICAÇÃO",
                        UsuarioAppId        = _usuario.Id,
                        VALOR               = _novoLancamento.Valor,
                        UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                    }, _context);
                }

                var _textoAnexos = "";
                var fileName     = "";
                var _config      = _context.AppPerfil
                                   .Include(x => x.AppConfiguracoes)
                                   .Include(x => x.AppConfiguracoes.AppConfiguracoes_Aplicativo)
                                   .Include(y => y.AppConfiguracoes.AppConfiguracoes_Azure)
                                   .FirstOrDefault();

                //----------
                // ANEXO4-C
                //----------
                if (modelo.PerfilInvestidorInformado == "C")
                {
                    _textoAnexos += $"<div style='text-align:center;'><b>ANEXO 4-C</b></div>";
                    _textoAnexos += $"<div style='text-align:center;margin-top:0px;margin-bottom:25px;'><b>{HttpUtility.HtmlEncode("DECLARAÇÃO")}</b></div>";
                    _textoAnexos += $"<div style='text-align:justify !important;'>";
                    _textoAnexos += $"Declaro, sob as penas da lei, que:<br>";
                    _textoAnexos += $"1. o valor de meu investimento na oferta de <b style='font-size:14px;color:grey !important;margin-left:15px;margin-right:15px;font-weight:normal !important;'>[emissor]</b>, quando somado ao valor de <b style='font-size:14px;color:grey !important;margin-left:15px;margin-right:15px;font-weight:normal !important;'>[montante]</b> que {HttpUtility.HtmlEncode("já")} investi no {HttpUtility.HtmlEncode("ano-calendário")} em ofertas dispensadas de registro na {HttpUtility.HtmlEncode("Comissão de Valores Mobiliários (CVM)")} por meio de plataformas {HttpUtility.HtmlEncode("eletrônicas")} investimento participativo (crowdfunding de investimento), {HttpUtility.HtmlEncode("não")} ultrapassa R$ 10.000,00 (dez mil reais).<br><br>";
                    _textoAnexos += $"2. entendo que o limite de R$ 10.000,00 (dez mil reais) tem por objetivo proteger os investidores em {HttpUtility.HtmlEncode("razão do nível")} de risco e da falta de liquidez associados aos investimentos por meio de crowdfunding.<br><br>";
                    _textoAnexos += $"3. entendo ser minha responsabilidade observar que o valor total de meus investimentos realizados no {HttpUtility.HtmlEncode("ano-calendário")} em todas as plataformas de crowdfunding de investimento combinadas {HttpUtility.HtmlEncode("não")} ultrapassa o limite.<br>";
                    _textoAnexos += $"</div><br><br><br>";
                    _textoAnexos += $"<b>{HttpUtility.HtmlEncode("SÃO PAULO")}, {DateTime.Now.ToLongDateString().ToUpper()}</b><br><br><br><br><br><br><br>";
                    _textoAnexos += $"<hr style='display:block;width:60%;margin-top:0px;margin-bottom:0px;float:left;'><br>";
                    _textoAnexos += $"<b style='margin-top:-25px;'>{HttpUtility.HtmlEncode(_usuario.Nome)} {_usuario.Sobrenome} /// {_usuario.Documentacao_CPF}</b><br>";
                    _textoAnexos += $"<br><br><br><br>";
                    _textoAnexos += $"<div style='margin-top:25px;'>";
                    _textoAnexos += $"<b style='color:grey!important;font-size:8px!important;font-weight:normal!important;'>Registro H2I: Esse ANEXO4-C foi assinado digitalmente por {HttpUtility.HtmlEncode("você")} no dia {DateTime.Now.ToShortDateString()} {HttpUtility.HtmlEncode("às")} {DateTime.Now.ToShortTimeString()} a partir do IP: {_ips.FirstOrDefault()} referente a reserva de {_valormoeda.ToString("C2")} na oferta {HttpUtility.HtmlEncode(_bloco.Titulo)} </i>";
                    _textoAnexos += $"</div>";

                    fileName = $"{Guid.NewGuid().ToString()}-anexo4c.html";
                }
                else if (modelo.PerfilInvestidorInformado == "B")
                {
                    _textoAnexos += $"<div style='text-align:center;'><b>ANEXO 4-B</b></div>";
                    _textoAnexos += $"<div style='text-align:center;margin-top:0px;margin-bottom:25px;'><b>{HttpUtility.HtmlEncode("DECLARAÇÃO")}</b></div>";

                    _textoAnexos += $"<div style='text-align:justify !important;'>";
                    _textoAnexos += $"Declaro, sob as penas da lei, que:<br>";
                    _textoAnexos += $"1. possuo renda bruta anual ou investimentos financeiros em valor superior a R$ 100.000,00 (cem mil reais).<br><br>";
                    _textoAnexos += $"2. o valor de meu investimento na oferta de <b style='font-size:14px;color:grey !important;margin-left:15px;margin-right:15px;font-weight:normal !important;'>[ emissor ]</b>, quando somado ao valor de R$ <b style='font-size:14px;color:grey !important;margin-left:15px;margin-right:15px;font-weight:normal !important;'>[ montante ]</b> que {HttpUtility.HtmlEncode("já")} investi no {HttpUtility.HtmlEncode("ano-calendário")} em ofertas dispensadas de registro na {HttpUtility.HtmlEncode("Comissão de Valores Mobiliários (CVM)")} por meio de plataformas {HttpUtility.HtmlEncode("eletrônicas")} investimento participativo (crowdfunding de investimento), {HttpUtility.HtmlEncode("não")} ultrapassa 10% (dez por cento) do maior entre: (a) minha renda bruta anual; ou (b) o montante total de meus investimentos financeiros.<br><br>";
                    _textoAnexos += $"3. entendo que o limite de 10% (dez por cento) tem por objetivo proteger os investidores em {HttpUtility.HtmlEncode("razão do nível")} de risco e da falta de liquidez associados aos investimentos por meio de crowdfunding.<br><br>";
                    _textoAnexos += $"4. entendo ser minha responsabilidade observar que o valor total de meus investimentos realizados no {HttpUtility.HtmlEncode("ano-calendário")} em todas as plataformas de crowdfunding de investimento combinadas {HttpUtility.HtmlEncode("não")} ultrapassa o limite.";
                    _textoAnexos += $"</div><br><br><br>";
                    _textoAnexos += $"<b>{HttpUtility.HtmlEncode("SÃO PAULO")}, {DateTime.Now.ToLongDateString().ToUpper()}</b><br><br><br><br><br><br><br>";
                    _textoAnexos += $"<hr style='display:block;width:60%;margin-top:0px;margin-bottom:0px;float:left;'><br>";
                    _textoAnexos += $"<b style='margin-top:-25px;'>{HttpUtility.HtmlEncode(_usuario.Nome)} {_usuario.Sobrenome} /// {_usuario.Documentacao_CPF}</b><br>";
                    _textoAnexos += $"<br><br><br><br>";
                    _textoAnexos += $"<div style='margin-top:25px;'>";
                    _textoAnexos += $"<b style='color:grey!important;font-size:8px!important;font-weight:normal!important;'>Registro H2I: Esse ANEXO4-B foi assinado digitalmente por {HttpUtility.HtmlEncode("você")} no dia {DateTime.Now.ToShortDateString()} {HttpUtility.HtmlEncode("às")} {DateTime.Now.ToShortTimeString()} a partir do IP: {_ips.FirstOrDefault()} referente a reserva de {_valormoeda.ToString("C2")} na oferta {HttpUtility.HtmlEncode(_bloco.Titulo)} </i>";
                    _textoAnexos += $"</div>";

                    fileName = $"{Guid.NewGuid().ToString()}-anexo4b.html";
                }
                else if (modelo.PerfilInvestidorInformado == "A")
                {
                    _textoAnexos += $"<div style='text-align:center;'><b>ANEXO 4-A</b></div>";
                    _textoAnexos += $"<div style='text-align:center;margin-top:0px;margin-bottom:25px;'><b>{HttpUtility.HtmlEncode("DECLARAÇÃO")}</b></div>";
                    _textoAnexos += $"<div style='text-align:justify !important;'>";
                    _textoAnexos += $"Ao assinar este termo, afirmo minha {HttpUtility.HtmlEncode("condição")} de investidor qualificado e declaro possuir conhecimento sobre o mercado financeiro suficiente para que {HttpUtility.HtmlEncode("não")} me sejam {HttpUtility.HtmlEncode("aplicáveis")} um conjunto de {HttpUtility.HtmlEncode("proteções")} legais e regulamentares conferidas aos investidores que {HttpUtility.HtmlEncode("não")} sejam qualificados.<br><br>";
                    _textoAnexos += $"Como investidor qualificado, atesto ser capaz de entender e ponderar os riscos financeiros relacionados {HttpUtility.HtmlEncode("à aplicação")} de meus recursos em oferta {HttpUtility.HtmlEncode("pública de distribuição de valores mobiliários de emissão de sociedades empresárias")} de pequeno porte, realizada com dispensa de registro na {HttpUtility.HtmlEncode("Comissão de Valores Mobiliários (CVM)")}, por meio de plataforma {HttpUtility.HtmlEncode("eletrônica")} de investimento participativo.<br><br>";
                    _textoAnexos += $"Declaro, sob as penas da lei, que possuo investimentos financeiros em valor superior a R$ 1.000.000,00 {HttpUtility.HtmlEncode("(um milhão de reais)")}.<br><br>";
                    _textoAnexos += $"</div><br><br><br>";
                    _textoAnexos += $"<b>{HttpUtility.HtmlEncode("SÃO PAULO")}, {DateTime.Now.ToLongDateString().ToUpper()}</b><br><br><br><br><br><br><br>";
                    _textoAnexos += $"<hr style='display:block;width:60%;margin-top:0px;margin-bottom:0px;float:left;'><br>";
                    _textoAnexos += $"<b style='margin-top:-25px;'>{HttpUtility.HtmlEncode(_usuario.Nome)} {_usuario.Sobrenome} /// {_usuario.Documentacao_CPF}</b><br>";
                    _textoAnexos += $"<br><br><br><br>";
                    _textoAnexos += $"<div style='margin-top:25px;'>";
                    _textoAnexos += $"<b style='color:grey!important;font-size:8px!important;font-weight:normal!important;'>Registro H2I: Esse ANEXO4-A foi assinado digitalmente por {HttpUtility.HtmlEncode("você")} no dia {DateTime.Now.ToShortDateString()} {HttpUtility.HtmlEncode("às")} {DateTime.Now.ToShortTimeString()} a partir do IP: {_ips.FirstOrDefault()} referente a reserva de {_valormoeda.ToString("C2")} na oferta {HttpUtility.HtmlEncode(_bloco.Titulo)} </i>";
                    _textoAnexos += $"</div>";

                    fileName = $"{Guid.NewGuid().ToString()}-anexo4a.html";
                }

                string     sWebRootFolder = _hostingEnvironment.WebRootPath;
                string     fullPath       = Path.Combine(sWebRootFolder + "//Upload", fileName);
                FileStream file           = new FileStream(fullPath, FileMode.Create, FileAccess.Write);
                var        htmlDoc        = new HtmlAgilityPack.HtmlDocument();
                htmlDoc.LoadHtml(_textoAnexos);
                htmlDoc.Save(file);
                file.Close();
                SelectPdf.HtmlToPdf converter = new SelectPdf.HtmlToPdf();
                converter.Options.PdfPageSize        = SelectPdf.PdfPageSize.A4;
                converter.Options.PdfPageOrientation = SelectPdf.PdfPageOrientation.Landscape;
                //converter.Options.WebPageWidth = webPageWidth;
                //converter.Options.WebPageHeight = webPageHeight;
                //PdfDocument doc_ = converter.ConvertHtmlString(innerHtml);
                SelectPdf.PdfDocument doc_ = converter.ConvertUrl(fullPath);
                doc_.Save(fullPath.Replace("html", "pdf"));
                doc_.Close();
                System.IO.File.Delete(fullPath);

                // ENVIAR PRA CLOUD AZURE
                FileStream _arquivoPDFCriado = new FileStream(fullPath.Replace("html", "pdf"), FileMode.Open, FileAccess.Read);
                string     pegaurl           = "";
                try
                {
                    var _strcnx = "";
                    _strcnx = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey);
                    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_strcnx);
                    CloudBlobClient     blobClient     = storageAccount.CreateCloudBlobClient();
                    CloudBlobContainer  container      = blobClient.GetContainerReference(_config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);
                    CloudBlockBlob      blockBlob      = container.GetBlockBlobReference(fileName);
                    blockBlob.Properties.ContentType = "application/pdf";
                    await blockBlob.UploadFromStreamAsync(_arquivoPDFCriado);

                    pegaurl = blockBlob.Uri.AbsoluteUri;

                    var _novoLancamentoDoc = new INVEST_LancamentoDoc()
                    {
                        INVEST_LancamentoId = _novoLancamento.Id,
                        // USO UM INDICE VALIDO COLHIDO LÁ EM CIMA
                        // PARA SANAR UM PROBLEMA DE REFERENCIA DE CHAVE
                        // ESTRANGEIRA COM MODELOS DOC. AFINAL DE CONTAS
                        // GERO O PDF DO ZERO, NÃO EXISTE ASSOCIACAO
                        // AINDA, ATEH O ATO DE CRIAR E PUBLICAR O PDF.
                        INVEST_ModeloDocId = _indiceCuringaModeloDocProblemaReferencia,
                        URLDoc             = pegaurl,
                        TP = "A"
                    };
                    _context.INVEST_LancamentoDocs.Add(_novoLancamentoDoc);
                    await _context.SaveChangesAsync();

                    await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                    {
                        ICOMENS             = "<i class='fas fa-file-signature text-primary'></i>",
                        MENSAGEM            = "<i style='font-size:11px;font-family:monospace;line-height:10px;text-align:justify!important;'>" + _textoAnexos + "</i>" + $"<br> <div><a href='{pegaurl}' target='_blank'>Ver doc.</a></div>",
                        ACAO                = $"INFORMOU PERFIL ANEXO4-{modelo.PerfilInvestidorInformado}",
                        DTHR                = DateTime.Now,
                        IP                  = _ips.FirstOrDefault(),
                        STATUS              = "",
                        TIPO                = "NOTIFICAÇÃO",
                        UsuarioAppId        = _usuario.Id,
                        VALOR               = _novoLancamento.Valor,
                        UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                    }, _context);
                }
                catch (Exception err) { var erro = err; }

                //// LOGCENTRAL
                //_context.LOGCENTRALs.Add(new LOGCENTRAL()
                //{
                //    ACAO = "INVESTIU",
                //    INVEST_LancamentoId = _novoLancamento.Id,
                //    INVEST_ModeloDocId = _novoLancamento.Id,
                //    TP = _novoLancamento.TP,
                //    URLDOC = "",
                //    VALOR = _valormoeda,
                //    STATUS = _novoLancamento.Status,
                //    UsuarioAppId = _novoLancamento.UsuarioAppId,
                //    IP = _ips.FirstOrDefault()
                //});
                //await _context.SaveChangesAsync();
                //// CONTROLE TRANSF - USU
                //_context.INVEST_ControleTransfs.Add(new INVEST_ControleTransf()
                //{
                //    BlocoProjInvestimentosId = _novoLancamento.BlocoProjInvestimentosId,
                //    Status = "P",
                //    UsuarioAppId = _novoLancamento.UsuarioAppId,
                //    Valor = _novoLancamento.Valor
                //});
                //await _context.SaveChangesAsync();
                //// CONTROLE TRANSF - ADM
                //_context.INVEST_ControleTransfs.Add(new INVEST_ControleTransf()
                //{
                //    BlocoProjInvestimentosId = _novoLancamento.BlocoProjInvestimentosId,
                //    Status = "P",
                //    UsuarioAppId = "bbf7b44d-faa0-4276-b163-295b780a062c",
                //    Valor = _novoLancamento.Valor
                //});
                //await _context.SaveChangesAsync();
                //return Page();
                //if (modelo.ArquivoComprovResid != null)
                //{
                //    var _imagemLogotipo =
                //        await VerificadoresRetornos
                //        .EnviarImagemAzure(modelo.ArquivoComprovResid, 550000, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);
                //    if (_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                //        BlocoProjInvestimento.UrlImgPrinc = _imagemLogotipo;
                //    else
                //    {
                //        ModelState.AddModelError(string.Empty, "A imagem é muito grande");
                //        _errosValidacoes = true;
                //    }
                //}
                //else
                //{
                //    ModelState.AddModelError(string.Empty, "Selecione uma imagem do seu computador");
                //    _errosValidacoes = true;
                //}


                //}

                //// LOGCENTRAL
                //_context.LOGCENTRALs.Add(new LOGCENTRAL()
                //{
                //    ACAO = "ENVIO DE EMAIL - INVESTIU",
                //    INVEST_LancamentoId = _novoLancamento.Id,
                //    INVEST_ModeloDocId = _novoLancamento.Id,
                //    TP = _novoLancamento.TP,
                //    URLDOC = "",
                //    VALOR = _valormoeda,
                //    STATUS = _novoLancamento.Status,
                //    UsuarioAppId = _novoLancamento.UsuarioAppId,
                //    IP = _ips.FirstOrDefault()
                //});
                //await _context.SaveChangesAsync();

                var _token       = Guid.NewGuid().ToString();
                var _novaconfirm = new InvestimentoConfirmacao()
                {
                    BlocoProjInvestimentoId = modelo.blocoProjInvestimento.Id,
                    Confirmado          = false,
                    Token               = _token,
                    UsuarioAppId        = _usuario.Id,
                    Valor               = _valormoeda,
                    INVEST_LancamentoId = _novoLancamento.Id
                };
                _context.InvestimentoConfirmacoes.Add(_novaconfirm);
                await _context.SaveChangesAsync();

                await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                {
                    ICOMENS             = "<i class='fas fa-wallet text-warning'></i>",
                    MENSAGEM            = $"O usuário <b>{_novoLancamento.UsuarioApp.Nome} {_novoLancamento.UsuarioApp.Sobrenome}</b> fez uma reserva de <b>{_novoLancamento.Valor.ToString("C2")}</b> na oferta <b>{_novoLancamento.BlocoProjInvestimentos.Titulo}</b>.<br> Geramos o seguinte token ao investidor: <i>{_token}</i>",
                    ACAO                = $"RESERVA",
                    DTHR                = DateTime.Now,
                    IP                  = _ips.FirstOrDefault(),
                    STATUS              = VerificadoresRetornos.PROC__RetornaStatusLiteralLancamento(_novoLancamento.Status),
                    TIPO                = "INVESTIMENTOS",
                    UsuarioAppId        = _novoLancamento.UsuarioAppId,
                    VALOR               = _valormoeda,
                    UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                }, _context);


                /*
                 * E-mail confirmação de reserva de investimento e envio do Código de Validação
                 *
                 *
                 * Olá [Nome Investidor],
                 *
                 * Recebemos a sua reserva no valor de R$ [    ] (      mil reais).
                 * Para confirmá-la, insira o código de validação a seguir :
                 * [código]
                 *
                 *
                 * Atenciosamente,
                 * Equipe House2Invest
                 */

                // instanciar objeto email
                var _configAplicacoes =
                    _context.AppConfiguracoes_Aplicativo
                    .FirstOrDefault();

                string _textoEmail = $"Olá {_novoLancamento.UsuarioApp.Nome}, <br>";
                _textoEmail += $"Recebemos o seu pedido de reserva no valor de {_novoLancamento.Valor.ToString("C2")}. <br>";
                _textoEmail += $"Para confirmá-la, insira o código de validação a seguir:<br>";
                _textoEmail += $"<code>{_token}</code> <br><br>";
                _textoEmail += $"Atenciosamente, <br>";
                _textoEmail += $"<b>Equipe House2invest</b> <br>";

                var _objemail = new ObjetoEmailEnvio()
                {
                    ASSUNTO  = "[INVESTIMENTO] House2Invest",
                    COPIA    = _configAplicacoes.mailToAdd,
                    mailFrom = _configAplicacoes.mailFrom,
                    MENSAGEM = _textoEmail,
                    //MENSAGEM = string.Format($"Olá {_usuario.Nome},<br/><br/><br/>Recebemos a sua reserva no valor de <b>{_valormoeda.ToString("C2")}</b>.<br/> Para confirmá-la, insira o código de validação a seguir:<br> <b>{_token}</b>.<br/><br/><br/>Atenciosamente,<br>Equipe House2Invest"),
                    //MENSAGEM = string.Format($"Olá!!!{Environment.NewLine}<br/>Você fez um investimento de <b>{_valormoeda.ToString("C2")}</b> em <b>{_context.BlocoProjInvestimentos.Where(x => x.Id == Convert.ToInt32(modelo.blocoProjInvestimento.Id)).FirstOrDefault().Titulo}</b>. Para validá-lo, digite esse código <b>{_token}</b> no campo correspondente."),
                    PARA = _usuario.Email,
                    smtpCredentialsEmail      = _configAplicacoes.smtpCredentialsEmail,
                    smtpCredentialsSenha      = _configAplicacoes.smtpCredentialsSenha,
                    smtpEnableSsl             = _configAplicacoes.smtpEnableSsl,
                    smtpHost                  = _configAplicacoes.smtpHost,
                    smtpPort                  = _configAplicacoes.smtpPort,
                    smtpUseDefaultCredentials = _configAplicacoes.smtpUseDefaultCredentials
                };
                var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);

                await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                {
                    ICOMENS             = "<i class='fas fa-envelope text-primary'></i>",
                    MENSAGEM            = "<i style='font-size:11px;font-family:monospace;line-height:10px;text-align:justify!important;'>" + _textoEmail + "</i>" + $"<br> <div>    <a href='javascript:ReenviarEmailLog({_novoLancamento.Id});' class='btn btn-sm bg-success' title='Reenviar email' style='padding:0.25rem 0.4rem;font-size:14px;'><i class='fas fa-paper-plane'></i></a></div>",
                    ACAO                = $"ENVIOU EMAIL",
                    DTHR                = DateTime.Now,
                    IP                  = _ips.FirstOrDefault(),
                    STATUS              = VerificadoresRetornos.PROC__RetornaStatusLiteralLancamento(_novoLancamento.Status),
                    TIPO                = "NOTIFICAÇÃO",
                    UsuarioAppId        = _novoLancamento.UsuarioAppId,
                    VALOR               = _novoLancamento.Valor,
                    UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
                }, _context);

                //var _enviou =
                //    await VerificadoresRetornos
                //    .EnviarEmail(_usuario.Email, "", "[INVESTIMENTO] House2Invest", string.Format($"Olá!!!{Environment.NewLine}<br/>Você fez um investimento de <b>{_valormoeda.ToString("C2")}</b> em <b>{_context.BlocoProjInvestimentos.Where(x => x.Id == Convert.ToInt32(modelo.blocoProjInvestimento.Id)).FirstOrDefault().Titulo}</b>. Para validá-lo, digite esse código <b>{_token}</b> no campo correspondente."));

                //return new
                //{
                //    Status = "ok",
                //    Mens = $"Seu investimento foi registrado em nosso sistema. Acompanhe o andamento em sua área protegida.",
                //    Dados = "",
                //    Total = 0
                //};
                //return Page();

                //return Redirect("/");

                return(new JsonResult(new
                {
                    status = "ok",
                    mens = $"PARABÉNS"
                }));
            }
            catch (Exception err)
            {
                //return Page();
                return(new JsonResult(new
                {
                    status = "erro",
                    mens = $"Nada foi feito. Verifique o log de saída.",
                    errobruto = err.InnerException.Message
                                //    Dados = "",
                                //    Total = 0
                }));
            }
        }
Esempio n. 5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var registro = _context.Users
                           .Where(x => x.Id == modelo.Id)
                           .FirstOrDefault();

            try
            {
                var _oldAcessoBloqueado = registro.Sistema_AcessoBloqueado;
                var _newAcessoBloqueado = modelo.AcessoBloqueado;

                registro.EmailConfirmed          = modelo.EmailConfirmado;
                registro.Sistema_AcessoBloqueado = modelo.AcessoBloqueado;
                registro.LockoutEnabled          = modelo.Lockout;
                if (modelo.Lockout)
                {
                    registro.AccessFailedCount = 0;
                }

                registro.Financeiro_Investidor_Perfil = modelo.Financeiro_Investidor_Perfil;
                _context.Attach(registro).State       = EntityState.Modified;

                await _context.SaveChangesAsync();

                if (registro.Sistema_AcessoBloqueado)
                {
                    await _hubContext.Clients.All.SendAsync("ForceLogOff", $"{modelo.Id}");

                    //await _hubContextCMS.Clients.All.SendAsync("ForceLogOffCMS", $"{modelo.Id}");
                }

                if (_oldAcessoBloqueado && !_newAcessoBloqueado)
                {
                    // instanciar objeto email
                    var _configAplicacoes =
                        _context.AppConfiguracoes_Aplicativo
                        .FirstOrDefault();
                    var _objemail = new ObjetoEmailEnvio()
                    {
                        ASSUNTO                   = "[Documentação APROVADA] House2Invest",
                        COPIA                     = _configAplicacoes.mailToAdd,
                        mailFrom                  = _configAplicacoes.mailFrom,
                        MENSAGEM                  = string.Format($"Olá <b>{registro.Nome}</b>, td. em paz?{Environment.NewLine}Obaaa... Sua documentação está ok conosco!!!{Environment.NewLine}Nossa equipe de suporte entrará em contato com você. Fique de olho na sua caixa de entrada. ;)"),
                        PARA                      = registro.Email,
                        smtpCredentialsEmail      = _configAplicacoes.smtpCredentialsEmail,
                        smtpCredentialsSenha      = _configAplicacoes.smtpCredentialsSenha,
                        smtpEnableSsl             = _configAplicacoes.smtpEnableSsl,
                        smtpHost                  = _configAplicacoes.smtpHost,
                        smtpPort                  = _configAplicacoes.smtpPort,
                        smtpUseDefaultCredentials = _configAplicacoes.smtpUseDefaultCredentials
                    };
                    var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);

                    //var _enviou =
                    //    await VerificadoresRetornos
                    //    .EnviarEmail(registro.Email,
                    //    "",
                    //    "[Documentação APROVADA] House2Invest", string.Format($"Olá <b>{registro.Nome}</b>, td. em paz?{Environment.NewLine}Obaaa... Sua documentação está ok conosco!!!{Environment.NewLine}Nossa equipe de suporte entrará em contato com você. Fique de olho na sua caixa de entrada. ;)"));

                    var ip   = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
                    var _ips = new string[] { ip, "value2" };

                    //// LOGCENTRAL
                    //_context.LOGCENTRALs.Add(new LOGCENTRAL()
                    //{
                    //    ACAO = "ENVIO EMAIL - DOCUMENTAÇÃO APROVADA",
                    //    INVEST_LancamentoId = 0,
                    //    INVEST_ModeloDocId = 0,
                    //    TP = "",
                    //    URLDOC = "",
                    //    VALOR = 0,
                    //    STATUS = "",
                    //    UsuarioAppId = registro.Id,
                    //    IP = _ips.FirstOrDefault()
                    //});
                    //await _context.SaveChangesAsync();
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            // USUÁRIO LOGADO
            var _usu = _context.Users
                       .Where(x => x.UserName == User.Identity.Name)
                       .FirstOrDefault();

            var _config = _context.AppPerfil
                          .Include(x => x.AppConfiguracoes)
                          .Include(x => x.AppConfiguracoes.AppConfiguracoes_Aplicativo)
                          .Include(y => y.AppConfiguracoes.AppConfiguracoes_Azure)
                          .FirstOrDefault();

            var _atualizaTransf =
                _context.Tranferencias
                .Include(x => x.BlocoProjInvestimentos)
                .Where(x => x.Id == modelo.Id)
                .FirstOrDefault();

            var _errosValidacoes = false;

            if (modelo.ArquivoComprovTransf != null)
            {
                var _imagemLogotipo =
                    await VerificadoresRetornos
                    .EnviarImagemAzure(modelo.ArquivoComprovTransf, 614200, 0, 0, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountName, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_AccountKey, _config.AppConfiguracoes.AppConfiguracoes_Azure._azureblob_ContainerRaiz);

                if (!_imagemLogotipo.ToLower().Trim().Contains("blob.core.windows.net"))
                {
                    ModelState.AddModelError(string.Empty, "A imagem é muito grande");
                    _errosValidacoes = true;
                }
                else
                {
                    _atualizaTransf.URLComprovante = _imagemLogotipo;
                }
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Selecione uma imagem");
                _errosValidacoes = true;
            }

            if (_errosValidacoes)
            {
                return(Page());
            }

            _context.Attach(_atualizaTransf).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            var ip   = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
            var _ips = new string[] { ip, "value2" };

            // PEGO O USUARIO DA TRANSFERENCIA, CASO EXISTA
            var _usuTransf = new UsuarioApp();

            if (!string.IsNullOrEmpty(_atualizaTransf.IdUsu))
            {
                _usuTransf = _context.Users
                             .Where(x => x.Id == _atualizaTransf.IdUsu)
                             .FirstOrDefault();
            }

            //// LOGCENTRAL
            await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
            {
                ICOMENS             = "<i class='fas fa-image text-success'></i>",
                MENSAGEM            = $"A transferência de <b>{_atualizaTransf.Valor.ToString("C2")}</b> para o investidor <b>{_usuTransf.Nome} {_usuTransf.Sobrenome}</b> foi <b style='color:green;'>EFETUADA COM SUCESSO</b>. O comprovante digitalizado da transação é <a href='{_atualizaTransf.URLComprovante}' target='_blank'>esse aqui</a>.",
                ACAO                = $"ENVIO DE COMPROVANTE (TRANSFERÊNCIA)",
                DTHR                = DateTime.Now,
                IP                  = _ips.FirstOrDefault(),
                STATUS              = "TRANSFERIDO",
                TIPO                = "CONFIRMAÇÕES",
                UsuarioAppId        = !string.IsNullOrEmpty(_atualizaTransf.IdUsu) ? _atualizaTransf.IdUsu : "b1aadecb-4357-457d-bfea-27e153505497",
                VALOR               = _atualizaTransf.Valor,
                UsuarioAppCriadorId = "b1aadecb-4357-457d-bfea-27e153505497"
            }, _context);

            if (!string.IsNullOrEmpty(_atualizaTransf.IdUsu))
            {
                //--------------------------------
                // APLICACAO PADRAO
                //--------------------------------
                var _appPadrao =
                    _context.AppConfiguracoes_Aplicativo
                    .FirstOrDefault();

                string _textoEmail = $"Prezado {_usuTransf.Nome} <br>";
                _textoEmail += $"A transferência no valor de <b>{_atualizaTransf.Valor.ToString("C2")}</b> foi <b style='color:green;'>EFETUADA COM SUCESSO</b>. <br>";
                _textoEmail += $"Abaixo está o link com o comprovante: <br>";
                _textoEmail += $"<a href='{_atualizaTransf.URLComprovante}' target='_blank'>Comprovante</a> <br><br>";
                _textoEmail += $"Atenciosamente, <br>";
                _textoEmail += $"<b>Equipe House2invest</b> <br>";
                // instanciar objeto email
                var _objemail = new ObjetoEmailEnvio()
                {
                    ASSUNTO                   = "[STATUS INVESTIMENTO] House2Invest",
                    COPIA                     = _appPadrao.mailToAdd,
                    mailFrom                  = _appPadrao.mailFrom,
                    MENSAGEM                  = _textoEmail,
                    PARA                      = _usuTransf.Email,
                    smtpCredentialsEmail      = _appPadrao.smtpCredentialsEmail,
                    smtpCredentialsSenha      = _appPadrao.smtpCredentialsSenha,
                    smtpEnableSsl             = _appPadrao.smtpEnableSsl,
                    smtpHost                  = _appPadrao.smtpHost,
                    smtpPort                  = _appPadrao.smtpPort,
                    smtpUseDefaultCredentials = _appPadrao.smtpUseDefaultCredentials
                };
                var _enviou = await VerificadoresRetornos.EnviarEmail(_objemail);

                await VerificadoresRetornos.PROC__GravaLOG(new LOGCENTRAL()
                {
                    ICOMENS             = "<i class='fas fa-envelope text-primary'></i>",
                    MENSAGEM            = "<i style='font-size:11px;font-family:monospace;line-height:10px;text-align:justify!important;'>" + _textoEmail + "</i>" + $"<br> <div>    <a href='javascript:ReenviarEmailLog({_atualizaTransf.Id});' class='btn btn-sm bg-success' title='Reenviar email' style='padding:0.25rem 0.4rem;font-size:14px;'><i class='fas fa-paper-plane'></i></a></div>",
                    ACAO                = $"ENVIOU EMAIL",
                    DTHR                = DateTime.Now,
                    IP                  = _ips.FirstOrDefault(),
                    STATUS              = "ENVIADO",
                    TIPO                = "NOTIFICAÇÃO",
                    UsuarioAppId        = !string.IsNullOrEmpty(_atualizaTransf.IdUsu) ? _atualizaTransf.IdUsu : "b1aadecb-4357-457d-bfea-27e153505497",
                    VALOR               = _atualizaTransf.Valor,
                    UsuarioAppCriadorId = _usu.Id
                }, _context);
            }

            //_context.LOGCENTRALs.Add(new LOGCENTRAL()
            //{
            //    ACAO = "TRANSFERÊNCIA INVESTIMENTO",
            //    INVEST_LancamentoId = 0,
            //    INVEST_ModeloDocId = 0,
            //    TP = "TRANSF",
            //    URLDOC = "",
            //    VALOR = _atualizaTransf.Valor,
            //    STATUS = "SUSPENSO",
            //    UsuarioAppId = _atualizaTransf.IdUsu,
            //    IP = _ips.FirstOrDefault()
            //});
            //await _context.SaveChangesAsync();


            return(RedirectToPage("./Index"));
        }