public static string[] GetConteudoExportacao(this IRelatorio relatorio, RelatorioFormato?formato = null, int?larguraRelatorio = null) { _relatorio = relatorio; _formato = formato ?? relatorio.Formato ?? RelatorioFormato.Txt; _delimitador = _formato.GetDelimitador(); var conteudos = new List <string>(); InserirLinhaTracejada(conteudos); foreach (var parte in relatorio.Partes) { var conteudosParte = parte.GetConteudoExportacao(); foreach (var conteudo in conteudosParte) { conteudos.Add(conteudo); InserirLinhaEmBranco(conteudos); InserirLinhaTracejada(conteudos); } } return(conteudos.ToArray()); }
public CaixaEletronicoProcessor(IDepositar depositar, ISacar sacar, IRelatorio relatorio) { _Cedulas = Notas.ObterNotas(); _deposito = depositar; _saque = sacar; _relatorio = relatorio; }
static void Main(string[] args) { List <Proposta> propostas = new List <Proposta> { new Novo(12M), new Portabilidade(3, 325.72M) }; foreach (Proposta proposta in propostas) { Console.WriteLine($"Meu tipo de operacao é: {proposta.QualOTipoOperacao()}"); Console.WriteLine($"Meu valor corrigido é: {((IProposta)proposta).CorrigirValor()}"); } IProposta propostaNovo = (IProposta)propostas[0]; Console.WriteLine($"Valor Total = {propostaNovo.ObterValorCorrigido()}"); propostaNovo.AtualizarValorParcela(6M); Console.WriteLine($"Após atualizar o valor da parcela para 6 o novo total é = {propostaNovo.CorrigirValor()}"); IRelatorio relatorio = (IRelatorio)propostas[1]; Resumo resumo = relatorio.GerarResumo(); Console.WriteLine(string.Format("Operação de {0} é viável? {1}", resumo.TipoOperacao, resumo.Viavel)); Console.ReadLine(); }
private void MontaLinha(IRelatorio relatorio) { if (relatorio is DLO) { this.MontaLinhaDLO(relatorio as DLO); } else { var linhasHtml = relatorio.Html.Skip(1).Select(tr => tr .Elements("td") .Select(td => td.InnerText.Trim()) .ToArray()); int numeroDeLinhas = linhasHtml.Count(); Linhas = new LinhaDadosBCB[numeroDeLinhas]; for (int i = 0; i < numeroDeLinhas; i++) { string[] linhaArray = linhasHtml.ElementAt(i); //se for rodapé if (linhaArray.Length == 1) { Linhas[i] = new LinhaDadosBCB(linhaArray[0]); continue; } Linhas[i] = new LinhaDadosBCB(linhaArray[0], linhaArray[1], linhaArray[2]); } } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.Run(relatorio.Imprimir); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.Run(async(context) => { await relatorio.Imprimir(context); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } IListaDePacientes details = serviceProvider.GetService <IListaDePacientes>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.Run(async(context) => { await relatorio.Imprimir(context); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.Run(async(context) => { await context.Response.WriteAsync("Livraria do Ygor\r\n"); await relatorio.Imprimir(context); }); }
//This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)// IServiceProvider serviceProvider ->> esse parametro é responsavel em obter as intancias das classes catalogo e relatorio { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>();// serviceProvider.GetService pede a instacia da classe catalogo no lugar do operador NEW IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.Run(async(context) => { relatorio.Imprimir(context); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await relatorio.Imprimir(context); }); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) // local onde vai utilizar os serviços adicionados acima { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await relatorio.Imprimir(context); }); }); }
public IEnumerable <HtmlNodeCollection> RetornaNodeRelatorio(IRelatorio relatorio) { if (string.IsNullOrEmpty(paginaRenderizada)) { paginaRenderizada = RetornaPaginaRenderizada(relatorio.Url); } HtmlDocument html = new HtmlDocument(); html.LoadHtml(paginaRenderizada); List <HtmlNodeCollection> noTabelas = new List <HtmlNodeCollection>(); for (int i = 1; i < relatorio.NumeroTabelas + 1; i++) { string path = string.Format(relatorio.XPath, relatorio is DLO ? i - 1 : i); yield return(html.DocumentNode.SelectNodes(path)); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await relatorio.Imprimir(context); await context.Response.WriteAsync("Ohaiyo sekai good morning world!"); }); }); }
// Utilização dos serviços adicionados (Definindo o fluxo de chamadas) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); // Utilizando injeção de dependencia // GetService devolve uma instancia da classe relacionada a interface selecionada ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await relatorio.Imprimir(context); }); }); }
/// <summary> /// Abre um relatório e exibe no design /// </summary> /// <param name="relatorio">relatório que deverá ser carregado e exibido para visualização</param> /// <param name="filters">Filtros que deverão ser usados no relatório</param> /// <exception cref="ReportObjectInvalid">Lançada quando o objeto do relatório que deverá ser exibido é inválido</exception> public static void OpenViewer(IRelatorio relatorio, IEnumerable<FilterItem> filters) { if(relatorio.IsNullOrEmpty()) throw new ReportObjectInvalid(); DialogFilterResult dfr = DialogFilter.Show(relatorio, filters); if(dfr.DialogResult == System.Windows.Forms.DialogResult.Cancel) return; if(filters != null) { foreach(FilterItem item in filters) { dfr.FilterItems.Add(item); } } Reader.RdlReader reader = new Reader.RdlReader(); reader.OpenReport(dfr); reader.Show(); }
public frmDialogSave(List <SqlColumn> colunas, IRelatorio relatorio) : this(colunas) { if (relatorio != null) { foreach (IFiltro item in relatorio.Filtros) { grdFiltros.Rows.Add(new object[] { item, item.Apelido, Convert.ToString(item.NomeReal), Convert.ToString(item.Tipo), Convert.ToBoolean(item.Obrigatorio), item.Valor, Convert.ToString(item.Comparacao), Convert.ToString(item.Classificacao), item.Valor, item.Valor2 }); } } }
//ServiceProvider é um agente da injeção de dependências para prover os serviços da aplicação public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); ICatalogo catalogo = serviceProvider.GetService <ICatalogo>(); //Pelo fato do Catalogo também ser um serviço gerenciado pela injeção de dependências ele não precisa ser passado como parâmetro obrigatório //no construtor da classe Relatorio IRelatorio relatorio = serviceProvider.GetService <IRelatorio>(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await relatorio.Imprimir(context); }); }); }
/// <summary> /// Abre um relatório e exibe no design /// </summary> /// <param name="relatorio">relatório que deverá ser carregado e exibido para visualização</param> /// <exception cref="ReportObjectInvalid">Lançada quando o objeto do relatório que deverá ser exibido é inválido</exception> public static void OpenViewer(IRelatorio relatorio) { OpenViewer(relatorio, null); }
public static SaveDialogResult Show(string title, OpenPOS.GUID group, List <SqlColumn> colunas, IRelatorio relatorio) { frmDialogSave save = new frmDialogSave(colunas, relatorio); RdlDesigner _rdlDesigner = save.Parent as RdlDesigner; save.txtTitle.Text = title; save.sfGroup.SetValue(group.ToString()); save.ShowDialog(); SaveDialogResult result = save.Result; save.Close(); save.Dispose(); return(result); }
public static bool VerificaMudanca(IRelatorio relatorio, ref string textoTabelas) { return(MontaTextoESalvaArquivo(relatorio, ref textoTabelas)); }
private static string MontaTabelasESalvaArquivos(IRelatorio relatorio, StringBuilder textoTabelas, BinaryFormatter binario) { int i = 0; int somaMudadas = 0; Crawler crawler = new Crawler(); foreach (HtmlNodeCollection noTabela in crawler.RetornaNodeRelatorio(relatorio)) { int mudadas = 0; StringBuilder textoTabela = new StringBuilder(string.Format(ConstStringHtml.tituloTabela, relatorio.NomeTabelas[i])); //Não mova esse i++ de lugar!! i++; if (noTabela == null) { return(string.Empty); } relatorio.Html = noTabela; string nomeArquivo = string.Format(ConstStringHtml.nomeBinTabelas, relatorio.Nome, i); DadosBCB dadosBCB = new DadosBCB(relatorio); if (!File.Exists(nomeArquivo)) { Stream tmp = File.Create(nomeArquivo); tmp.Close(); } using (Stream stream = File.OpenRead(nomeArquivo)) { DadosBCB dadoRecuperadosBCB = null; if (!(stream.Length == 0)) { dadoRecuperadosBCB = (DadosBCB)binario.Deserialize(stream); } textoTabela.Append(ConstStringHtml.abreTabela + ConstStringHtml.abreTR); textoTabela.Append(Formatador.PrintaCabecalho(relatorio.Cabecalho) + "</tr>"); textoTabela.Append(Formatador.RetornaTextoTabela(ref mudadas, dadosBCB, dadoRecuperadosBCB) + "</table>"); } using (Stream stream = File.OpenWrite(nomeArquivo)) { binario.Serialize(stream, dadosBCB); } somaMudadas += mudadas; if (mudadas == 0) { textoTabela.Clear(); if (i == relatorio.NumeroTabelas && somaMudadas == 0) { textoTabela.Append(string.Format(ConstStringHtml.nenuhmaAlteracao, relatorio.Nome)); } } textoTabelas.Append(textoTabela); } return(textoTabelas.ToString()); }
public static RelatorioFormato GetFormato(this IRelatorio relatorio, RelatorioFormato?formato = null) { return(formato ?? relatorio.Formato ?? RelatorioFormato.Txt); }
public static bool MontaTextoESalvaArquivo(IRelatorio relatorio, ref string textoTabelas) { int i = 0; int somaMudadas = 0; BinaryFormatter binario = new BinaryFormatter(); textoTabelas += string.Format(ConstStringHtml.tituloEUrl, relatorio.Nome, relatorio.Url); foreach (HtmlNodeCollection noTabela in Crawler.RetornaNodeHTML(relatorio)) { int mudadas = 0; string textoTabela = string.Format(ConstStringHtml.tituloTabela, relatorio.NomeTabelas[i]); //Não mova esse i++ de lugar!! i++; if (noTabela == null) { textoTabela += Formatador.PrintaLinha(new LinhaDadosBCB("Erro na leitura do nó", "Verifique o serviço", "Tabela " + i.ToString())); somaMudadas++; continue; } relatorio.Html = noTabela; string nomeArquivo = string.Format(ConstStringHtml.nomeBin, relatorio.Nome, i); DadosBCB dadosBCB = new DadosBCB(relatorio); if (!File.Exists(nomeArquivo)) { Stream tmp = File.Create(nomeArquivo); tmp.Close(); } using (Stream stream = File.OpenRead(nomeArquivo)) { DadosBCB dadoRecuperadosBCB = null; if (!(stream.Length == 0)) { dadoRecuperadosBCB = (DadosBCB)binario.Deserialize(stream); } textoTabela += ConstStringHtml.abreTabela + ConstStringHtml.abreTR; textoTabela += Formatador.PrintaCabecalho(relatorio.Cabecalho); textoTabela += "</tr>"; textoTabela += MontaTextoTabela(ref mudadas, dadosBCB, dadoRecuperadosBCB); textoTabela += "</table>"; } using (Stream stream = File.OpenWrite(nomeArquivo)) { binario.Serialize(stream, dadosBCB); } somaMudadas += mudadas; if (mudadas == 0) { textoTabela = string.Empty; if (i == relatorio.NumeroTabelas && somaMudadas == 0) { textoTabela = string.Format(ConstStringHtml.nenuhmaAlteracao, relatorio.Nome); } } textoTabelas += textoTabela; } return(!(somaMudadas == 0)); }
public DadosBCB(IRelatorio relatorio) { MontaLinha(relatorio); DataVerificacao = DateTime.Now; }
public static string GetNomeArquivo(this IRelatorio relatorio, string nomeArquivo = null) { return(nomeArquivo ?? relatorio.NomeArquivo); }
public static string GetNomeImpressora(this IRelatorio relatorio, string nomeImpressora = null) { return(nomeImpressora ?? relatorio.NomeImpressora); }
public Servico() { ComunicacaoSerial = new ComunicacaoSerial(); Configuracoes = new Configuracoes(); Relatorio = new Relatorio(); }
public static void GerarRelatorio(IRelatorio relatorio) { relatorio.GerarRelatorio(); }