private Extrato arrangeTableExtrato(HtmlDocument tableDoc) { List <Movimentacao> lsMovimentacao = new List <Movimentacao>(); Extrato extrato = new Extrato(); HtmlDocument table = tableDoc; //Remover a primeira linha table.DocumentNode.SelectSingleNode("//tr").Remove(); foreach (HtmlNode node in table.DocumentNode.SelectNodes("//table")) { for (int i = 0; i < node.SelectNodes("tr").Count(); i = i + 2) { Movimentacao movimentacao = new Movimentacao(); movimentacao.dt_movimentacao = node.SelectNodes("tr")[i].SelectNodes("td")[0].InnerText; movimentacao.nr_doc = node.SelectNodes("tr")[i].SelectNodes("td")[1].InnerText; movimentacao.historico = node.SelectNodes("tr")[i].SelectNodes("td")[2].InnerText; movimentacao.valor = node.SelectNodes("tr")[i].SelectNodes("td")[3].InnerText; movimentacao.saldo = node.SelectNodes("tr")[i + 1].SelectNodes("td")[1].InnerText; lsMovimentacao.Add(movimentacao); } } extrato.lsMovimentacao = lsMovimentacao; return(extrato); }
public Extrato CapturaExtrato5Dias() { string url = Constantes.edSIIBC + "extrato.processa" + Constantes.ajax + Constantes.noCacheExtrato; string tableClass = "movimentacao"; Task <HttpResponseMessage> get = clienteWeb.GetAsync(url); get.Wait(); Task <string> contents = get.Result.Content.ReadAsStringAsync(); contents.Wait(); HtmlDocument tableDoc = getTabela(contents, tableClass); Extrato extrato = arrangeTableExtrato(tableDoc); return(extrato); }
public Extrato getExtratoPorPeriodo(DateTime hdnDataInicio, DateTime hdnDataFinal, int sltOutroMes, int txtDataInicio, int txtDataFinal) { string config = "{'request':{},'session':{},'todos':{}}"; string token = "token"; string extratoEmArquivo = "false"; string hdnFormatoArquivo = ""; string rdoTipoExtrato = "O"; string hdnMoneyExtrato = "2"; string rdoFormatoExtrato = ""; string siperResourceCorrente = "044600001000000021266"; FormUrlEncodedContent formContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("config", config), new KeyValuePair <string, string>("token", token), new KeyValuePair <string, string>("extratoEmArquivo", extratoEmArquivo), new KeyValuePair <string, string>("hdnFormatoArquivo", hdnFormatoArquivo), new KeyValuePair <string, string>("hdnDataInicio", hdnDataInicio.ToShortDateString()), new KeyValuePair <string, string>("hdnDataFinal", hdnDataFinal.ToShortDateString()), new KeyValuePair <string, string>("hdnMoneyExtrato", hdnMoneyExtrato), new KeyValuePair <string, string>("rdoTipoExtrato", rdoTipoExtrato), new KeyValuePair <string, string>("sltOutroMes", sltOutroMes.ToString()), new KeyValuePair <string, string>("txtDataInicio", txtDataInicio.ToString()), new KeyValuePair <string, string>("txtDataFinal", txtDataFinal.ToString()), new KeyValuePair <string, string>("rdoFormatoExtrato", rdoFormatoExtrato), new KeyValuePair <string, string>("siperResourceCorrente", siperResourceCorrente) }); Task <HttpResponseMessage> post = clienteWeb.PostAsync(Constantes.edSIIBC + "data_extrato.processa" + Constantes.ajaxFalse + Constantes.noCacheDataExtrato, formContent); post.Wait(); Task <string> contents = post.Result.Content.ReadAsStringAsync(); contents.Wait(); string tableClass = "movimentacao"; HtmlDocument tableDoc = getTabela(contents, tableClass); Extrato extrato = arrangeTableExtrato(tableDoc); return(extrato); }
public CapturaExtrato(ConectaIBC ibc, DateTime hdnDataInicio, DateTime hdnDataFinal, string rdoTipoExtrato, int sltOutroMes, int txtDataInicio, int txtDataFinal) { this.extrato = ibc.getExtratoPorPeriodo(hdnDataInicio, hdnDataFinal, sltOutroMes, txtDataInicio, txtDataFinal); }
public CapturaExtrato(ConectaIBC ibc) { this.extrato = ibc.CapturaExtrato5Dias(); }