Example #1
0
 static void Main(string[] args)
 {
     try
     {
         ClientesManagement.ProcesarFacturas();
         ProveedoresManagement.ProcesarFacturas();
         NominaManagement.ProcesarFacturas();
     }
     catch (Exception ex)
     {
         LogErrores.Write("Ocurrio un error al ejecutar la consola SATeC Integrador de Facturas", ex);
     }
 }
Example #2
0
        public static void GenerarFormatos(int tipo, bool dinamometros, bool microbancas, bool opacimetros, bool tacometros)
        {
            try
            {
                var verificentros = VerificentrosManagement.GetAll();

                if (verificentros.Count > 0)
                {
                    Reporting.GenerarFormatos(verificentros, tipo, dinamometros, microbancas, opacimetros, tacometros);
                    MessageBox.Show("La creación de los formatos se realizo exitosamente.", "Verificentros App");
                }
                else
                {
                    MessageBox.Show("No se encontraron registros para procesar. Intente mas tarde.", "Verificentros App");
                }
            }
            catch (Exception ex)
            {
                LogErrores.Write("Error en GenerarFormatos() de FormatosVerificentros.", ex);
                throw ex;
            }
        }
Example #3
0
        public static void GenerarFormatoAlta(string numeroCentro)
        {
            try
            {
                var verificentros = new List <VerificentrosDTO>();
                verificentros.Add(VerificentrosManagement.GetByNumero(numeroCentro));

                if (verificentros.Count > 0)
                {
                    Reporting.GenerarFormatos(verificentros, 1, true, true, true, true);
                    MessageBox.Show("La creación de los formatos se realizo exitosamente.", "Verificentros App");
                }
                else
                {
                    MessageBox.Show("No se encontraron registros para procesar. Intente mas tarde.", "Verificentros App");
                }
            }
            catch (Exception ex)
            {
                LogErrores.Write("Error en GenerarFormatoAlta() de FormatosVerificentros.", ex);
                throw ex;
            }
        }
        private static void GenerateReport(string nameRTP, ReportDataSource dataSource, string pathReports, string pathPrints, string numeroCentro, string siglas, int linea, int tipo, bool dinamometros, bool microbancas, bool opacimetros, bool tacometros)
        {
            Warning[]    warnings;
            string[]     streamids;
            ReportViewer ReportViewer1 = new ReportViewer();

            try
            {
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                ReportViewer1.Reset();
                ReportViewer1.LocalReport.Dispose();
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.ReportPath = pathReports + nameRTP;

                ReportViewer1.LocalReport.DataSources.Add(dataSource);
                ReportViewer1.LocalReport.Refresh();

                string mimeType = string.Empty;
                string encoding = string.Empty;
                string ext      = string.Empty;
                string format   = string.Empty;

                string fileName = string.Empty;
                string prefix   = string.Empty;

                switch (nameRTP)
                {
                case "dinamometro.rdlc":
                    prefix = "Dinamometro_";
                    break;

                case "microbancas.rdlc":
                    prefix = "Microbanca_";
                    break;

                case "opacimetros.rdlc":
                    prefix = "Opacimetros_";
                    break;

                case "tacometros.rdlc":
                    prefix = "Tacometro_";
                    break;
                }

                // Word, PDF, Excel and Image.
                if (tipo == 1)
                {
                    byte[] bytes = ReportViewer1.LocalReport.Render("Word", null, out mimeType, out encoding, out ext, out streamids, out warnings);

                    fileName = fileName = pathPrints + prefix + siglas + numeroCentro + "_" + linea + "_" + Guid.NewGuid().ToString() + ".doc";

                    using (FileStream fs = File.Create(fileName))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                        fs.Flush();
                        fs.Close();
                    }

                    bytes = null;
                }
                else
                {
                    byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out ext, out streamids, out warnings);

                    fileName = fileName = pathPrints + prefix + siglas + numeroCentro + "_" + linea + "_" + Guid.NewGuid().ToString() + ".pdf";

                    using (FileStream fs = File.Create(fileName))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                        fs.Flush();
                        fs.Close();
                    }

                    bytes = null;
                }
            }
            catch (Exception ex)
            {
                LogErrores.Write("Error en GenerateReport() de Reporting.", ex);
                throw ex;
            }
            finally
            {
                warnings  = null;
                streamids = null;
                ReportViewer1.Dispose();
                GC.Collect();
            }
        }