public bool Post([FromBody] dynamic value) { try { DateTime dtInicial = Convert.ToDateTime(value.data); Int32 mes = dtInicial.Month; Int32 ano = dtInicial.Year; Int32 parcelas = (int)value.parcelas; for (int i = 0; i < parcelas; i++) { new Mensalidade().Criar((int)value.id_aluno, ano, mes, ((decimal)value.valor) / 100); mes = mes + 1; if (mes > 12) { mes = 1; ano = ano + 1; } // parcelas = parcelas - 1; } return(true); } catch (Exception e) { ErroHandler.Log("Plano_AdicionarController", e, "POST", ""); throw e; } }
private void SalvaDados(List <TesouroDiretoItem> lstDataProcessada) { try { lstDataProcessada.ForEach(x => { tf_tesouro tesouro = new tf_tesouro() { loggedTime = AtualImport, precoUnitario = (decimal)x.precoUnitario, rendimento = (decimal)x.rendimento, titulo = x.titulo, valorMinimo = (decimal)x.valorMinimo, vencimento = x.vencimento, tipoOperacao = x.tipoOperacao, }; db.tf_tesouro.Add(tesouro); db.SaveChanges(); }); } catch (Exception e) { ErroHandler.Log("HunterTesouro", e, "SalvaDados", ""); throw e; } }
private void SalvaDados(List <PoupancaItem> lstDataProcessada) { try { lstDataProcessada.ForEach(x => { if (this.ultimoAporte < x.aporte) { tf_poupanca poupanca = new tf_poupanca() { aporte = x.aporte, rendimento = (decimal)x.rendimento }; db.tf_poupanca.Add(poupanca); db.SaveChanges(); } }); } catch (Exception e) { ErroHandler.Log("HunterPoupanca", e, "SalvaDados", ""); throw e; } }
public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext c) { try { //u2xMainEntities1 db = new u2xMainEntities1(); //tf_usuario oUsuario = (tf_usuario)db.tf_usuario.Where( // usuario => usuario.login == c.UserName && usuario.senha == c.Password).FirstOrDefault(); //if (oUsuario != null) //{ //Claim claim = new Claim(ClaimTypes.Name, c.UserName); var identity = new ClaimsIdentity(); identity.AddClaim(new Claim(ClaimTypes.Name, "userNameTeste")); c.Validated(identity); //} return(Task.FromResult <object>(null)); } catch (Exception e) { ErroHandler.Log("ApplicationOAuthProvider", e, "GrantResourceOwnerCredentials", ""); } return(null); }
public void SearchAsync() { try { if (ValidaImportacao()) { WebClient client = new WebClient(); client.Encoding = System.Text.Encoding.UTF8; client.DownloadStringCompleted += (sender, args) => { if (!args.Cancelled && args.Error == null) { // Investir String sBody = CortaTabela(args.Result); List <String> lstData = ProcessaTabela(sBody); List <PoupancaItem> lstDataProcessada = ProcessaDados(lstData); SalvaDados(lstDataProcessada); } }; client.DownloadStringAsync(new Uri(url)); } } catch (Exception e) { ErroHandler.Log("HunterPoupanca", e, "SearchAsync", ""); throw e; } }
public bool RecuperaSenha(string email, string senha) { String body = "<html><head><style>html{line-height:1.5;font-family:\"Roboto\",sans-serif;font-weight:normal;color:rgba(0, 0, 0, 0.87)}</style></head><body style=\"margin: 0px\"><div style=\"height: 50px; background: black\"><center> <img style=\"height: 40px; margin - top:5px\" src=\"http://app.basicflux.com/img/logo_header.png\"/></center </div><div style=\"height:50px; margin-left:20%; width:60%;\"><h1 style=\"color:purple\">Nova Senha</h1><p> Você solicitiou uma nova senha no TheFlux! Sua nova senha é:</p><div style=\"height:50px; background:purple; color:white\"><center style=\"vertical-align: middle;line-height: 50px;\">{0}</center></div><p> Você pode trocar sua senha a qualquer momento, selecionando o menu \"Usuário\", então clicando na chave ao lado do seu nome.</p><p> Atenciosamente,</p><p> Equipe BasicFlux</p></div></body></html>"; try { MailMessage message = new MailMessage(); message.From = new MailAddress("*****@*****.**"); message.To.Add(new MailAddress(email)); message.Subject = "THEFLUX - Troca de Senha"; body = body.Replace("{0}", senha); message.Body = body; message.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Send(message); return(true); } catch (Exception e) { ErroHandler.Log("Mailer", e, "RecuperaSenha", ""); return(false); } }
public bool Comprovante(string email, string conta, String valor, String data) { String body = "<html><head><style>html{line-height:1.5;font-family:\"Roboto\",sans-serif;font-weight:normal;color:rgba(0, 0, 0, 0.87)}</style></head><body style=\"margin: 0px\"><div style=\"height: 50px; background: black\"><center> <img style=\"height: 40px; margin - top:5px\" src=\"http://app.basicflux.com/img/logo_header.png\" /></center</div><div style=\"height:50px; margin-left:20%; width:60%;\"><h1 style=\"color:purple\">Conta Paga</h1><p> Você pagou a conta ({0}) registrada para o dia {{2}} no TheFlux! O valor pago foi de:</p><div style=\"height:50px; background:purple; color:white\"><center style=\"vertical-align: middle;line-height: 50px;\">{{1}}</center></div><p> Não se esqueça de marcar a conta como paga.</p><p> Atenciosamente,</p><p> Equipe BasicFlux</p></div></body></html>"; try { MailMessage message = new MailMessage(); message.From = new MailAddress("*****@*****.**"); message.To.Add(new MailAddress(email)); message.Subject = "THEFLUX - Conta a Vencer"; body = body.Replace("{0}", conta); body = body.Replace("{1}", valor); body = body.Replace("{2}", data); message.Body = body; message.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Send(message); return(true); } catch (Exception e) { ErroHandler.Log("Mailer", e, "ContaAPagar", ""); return(false); } }
public List <String> ProcessaTabela(String body) { try { string[] values = body.Split(new string[] { "<tr>", "</tr>", "<td>", "</td>" }, StringSplitOptions.RemoveEmptyEntries); List <String> lstString = new List <string>(values); List <String> lstReturnString = new List <string>(); lstString.ForEach((String field) => { Int32 startIndex = field.LastIndexOf(">"); if (startIndex != -1) { startIndex = startIndex + 1; String filedValue = field.Substring(startIndex); if (!String.IsNullOrEmpty(filedValue.Trim())) { lstReturnString.Add(filedValue.Replace(" ", "")); } } }); return(lstReturnString); } catch (Exception e) { ErroHandler.Log("HunterPoupanca", e, "ProcessaTabela", ""); throw e; } }
public String CortaTabelaInvestir(String body) { try { Int32 startIndex = -1; if (startIndex == -1) { startIndex = body.IndexOf("<tr class=\"tituloprefixado\"><td bgcolor=\"FFFF9C\" class=\"tittuloTabelaTesouroDireto prefixadoTesouroDireto preipca mercadoreferencia\" ><b>Indexados ao IPCA</b></td> <td class=\"tittuloTabelaTesouroDireto prefixadoTesouroDireto preipca mercadoreferencia\" colspan=\"6\"> </tr>"); } if (startIndex == -1) { startIndex = body.IndexOf("<tr class=\"tituloprefixado\"><td bgcolor=\"FFFF9C\" class=\"tittuloTabelaTesouroDireto prefixadoTesouroDireto preipca mercadosuspenso\"><b>Indexados ao IPCA</b></td> <td class=\"tittuloTabelaTesouroDireto prefixadoTesouroDireto preipca mercadosuspenso\" colspan=\"3\"> </td></tr>"); } body = body.Substring(startIndex); Int32 endIndex = body.IndexOf("</tbody></table>"); body = body.Substring(0, endIndex); return(body); } catch (Exception e) { ErroHandler.Log("HunterTesouro", e, "CortaTabelaInvestir", ""); throw e; } }
public string Post([FromBody] Mensalidade value) { try { Mensalidade oMensalidade = new Mensalidade(); oMensalidade = oMensalidade.ToMensalidade(oMensalidade.ObtemById(value.id)[0]); Aluno oAluno = new Aluno(); oAluno = oAluno.ToAluno(oAluno.ObtemUnico(Convert.ToInt32(oMensalidade.id_aluno))); Instituicao oInstituicao = new Instituicao(); oInstituicao = oInstituicao.GetByUser(Convert.ToInt32(oAluno.id_usuario)); PagSeguroPagamento oPagSeguroPagamento = new PagSeguro().Checkout(oMensalidade, oAluno, oInstituicao); oPagSeguroPagamento.idMensalidade = oMensalidade.id; oPagSeguroPagamento.Criar(oPagSeguroPagamento.code, oPagSeguroPagamento.date, Convert.ToInt32(oPagSeguroPagamento.idMensalidade)); return(oPagSeguroPagamento.code); } catch (Exception e) { ErroHandler.Log("PagSeguro_CheckoutController", e, "POST", ""); throw e; } }
public List <tf_investimento_RF> Post([FromBody] tf_investimento_RF value) { try { return(new RendaFixa().Obtem(value.id_instituicao)); } catch (Exception e) { ErroHandler.Log("InvestimentoRF_AdicionarController", e, "POST", ""); throw e; } }
public List <tf_investimento_RF_aporte> Post([FromBody] tf_investimento_RF value) { try { return(new RendaFixa().ObtemAporte((int)value.id)); } catch (Exception e) { ErroHandler.Log("Aporte_ObtemController", e, "POST", ""); throw e; } }
// Get public List <Movimentacao> Post([FromBody] Usuario value) { try { return(new Movimentacao().GetByInstituition(value.id_instituicao)); } catch (Exception e) { ErroHandler.Log("MovimentacaoInstitucional_Obtem", e, "POST", ""); throw e; } }
// POST api/<controller> public List <Usuario> Get(int id) { try { return(new Usuario().GetAll(id)); } catch (Exception e) { ErroHandler.Log("Usuario", e, "Get", ""); throw e; } }
// Get public void Get(int id) { try { new Movimentacao().Delete(id); } catch (Exception e) { ErroHandler.Log("RemoveMovimentacaoPessoal", e, "POST", ""); throw e; } }
public Boolean Post([FromBody] Usuario value) { try { return(new Movimentacao().Delete(value.id)); } catch (Exception e) { ErroHandler.Log("Movimentacao_Deletar", e, "POST", ""); throw e; } }
public List <tf_investimento_RF_variacao> Post([FromBody] tf_investimento_RF_variacao value) { try { return(new RendaFixa().ObtemRegistro((int)value.id)); } catch (Exception e) { ErroHandler.Log("Variacao_ObtemController", e, "POST", ""); throw e; } }
public bool Post([FromBody] TipoPagamento value) { try { return(new TipoPagamento().Alterar(value)); } catch (Exception e) { ErroHandler.Log("TipoPagamento_Alterar", e, "POST", ""); throw e; } }
public void Post([FromBody] tf_investimento_RF value) { try { new RendaFixa().Exclui(value.id); } catch (Exception e) { ErroHandler.Log("InvestimentoRF_DeletaController", e, "POST", ""); throw e; } }
public List <TipoPagamento> Post([FromBody] TipoPagamento value) { try { return(new TipoPagamento().Get((int)value.id_instituicao)); } catch (Exception e) { ErroHandler.Log("TipoPagamento_Obtem", e, "POST", ""); throw e; } }
// POST api/<controller> public void Post([FromBody] Usuario value) { try { new Usuario().Update(value.id, value.senha, value.isAdmin, value.id_instituicao); } catch (Exception e) { ErroHandler.Log("UsuarioAtualiza", e, "POST", ""); throw e; } }
public Boolean Post([FromBody] PagSeguroPagamento code) { try { return(new PagSeguro().CheckoutSuccess(code.code, code.codeResponse)); } catch (Exception e) { ErroHandler.Log("PagSeguro_CheckoutSuccessController", e, "POST", ""); throw e; } }
public List <TipoMovimentacao> get(Int32 id) { try { return(new TipoMovimentacao().Get(id)); } catch (Exception e) { ErroHandler.Log("RemoveMovimentacaoPessoal", e, "get", ""); throw e; } }
public bool Post([FromBody] tf_mensalidade value) { try { new Mensalidade().Remove((int)value.id); return(true); } catch (Exception e) { ErroHandler.Log("Mensalidade_RemoveController", e, "POST", ""); throw e; } }
public bool Post([FromBody] tf_mensalidade value) { try { new Mensalidade().Criar((int)value.id_aluno, (int)value.ano, (int)value.mes, (decimal)value.valor); return(true); } catch (Exception e) { ErroHandler.Log("Mensalidade_AdicionarController", e, "POST", ""); throw e; } }
// POST api/<controller> public bool Post([FromBody] Usuario value) { try { new Usuario().Add(value.login, value.senha, value.isAdmin, value.id_instituicao); return(true); } catch (Exception e) { ErroHandler.Log("Usuario", e, "POST", ""); throw e; } }
public Aluno Post([FromBody] tf_aluno value) { try { Aluno oAluno = new Aluno(); return(oAluno.ToAluno(oAluno.Editar(value))); } catch (Exception e) { ErroHandler.Log("Aluno_EditarController", e, "POST", ""); throw e; } }
// GET api/<controller>/5 public Instituicao Get(int id) { try { Instituicao _Instituicao = new Instituicao().GetByUser(id); return(_Instituicao); } catch (Exception e) { ErroHandler.Log("InstituicaoController", e, "GET", ""); throw e; } }
public Usuario Login([FromBody] Usuario value) { try { Usuario oUsuario = new Usuario(); return(oUsuario.Get(value.login, value.senha)); } catch (Exception e) { ErroHandler.Log("LoginController", e, "POST", ""); throw e; } }
public Boolean post([FromBody] TipoMovimentacao value) { try { new TipoMovimentacao().Add(value.descricao, value.id_instituicao); return(true); } catch (Exception e) { ErroHandler.Log("RemoveMovimentacaoPessoal", e, "POST", ""); throw e; } }