Example #1
0
        public void comprimirFacturaAdjuntos(string factura, string xml)
        {
            try
            {
                string ex1 = "c:\\transer\\ws\\facturacion\\" + factura + "\\" + factura + ".zip";
                string ex2 = "c:\\transer\\ws\\facturacion\\" + factura + "\\anexos\\*.*";

                /*using (StreamWriter writer = new StreamWriter("c:\\transer\\ws\\facturacion\\" + factura + "\\anexos\\" + factura + ".xml"))
                 * {
                 *  writer.WriteLine(_vgp.informaciondian.INDI_XMLENV_CB);
                 * }*/
                _log.cfg(_vgp._Directorio + "\\" + _vgp._InformacionDian.INDI_NUMDOC_V2 + "\\anexos\\", _vgp._InformacionDian.INDI_NUMDOC_V2 + ".xml", _vgp._InformacionDian.INDI_XMLENV_CB);
                string      ejecucion = string.Empty;
                CallExecute cmprmr    = new CallExecute(_vgp);
                ejecucion = cmprmr.generarZIP(ex1, ex2);
            }
            catch (Exception ex)
            {
                string _mensajeError = @"Exception : " + ex.Source + "\nData source: " + ex.Message + "\nInnerException: " + ex.InnerException +
                                       "Procedimiento : caFEtysVS02_logicaProceso_public async void inicio() " +
                                       "instruccion : _vgp.logreportedian.LODI_OFICINA_NB = int.Parse(drFacturas[1].ToString());" + "\r\nTiempo de proceso : ";
                _log.wr(_vgp._Directorio, "Exception.txt", _mensajeError);
                _correo.envioCorreoDesarrollador(ex.Message, _mensajeError, _vgp);
            }
        }
Example #2
0
        private void comprimirAdjuntosTxt(string factura)
        {
            string      ex1       = "c:\\transer\\ws\\facturacion\\" + factura + "\\anexos\\anexos.zip";
            string      ex2       = "c:\\transer\\ws\\facturacion\\" + factura + "\\anexos\\*.*";
            string      ejecucion = string.Empty;
            CallExecute cmprmr    = new CallExecute(_vgp);

            ejecucion = cmprmr.generarZIP(ex1, ex2);
            try
            {
                string[] filePaths = Directory.GetFiles("c:\\transer\\ws\\facturacion\\" + factura + "\\anexos\\");
                foreach (string filePath in filePaths)
                {
                    if (filePath.Contains(".pdf"))
                    {
                        File.Delete(filePath);
                    }
                    if (filePath.Contains(".PDF"))
                    {
                        File.Delete(filePath);
                    }
                }
            }
            catch (Win32Exception ex)
            {
                string _mensajeError = @"Win32Exception : " + ex.Source + "\nData source: " + ex.Message + "\nInnerException: " + ex.InnerException +
                                       "Procedimiento : caFEtysVS02_logicaProceso_public async void inicio() " +
                                       "instruccion : _vgp.logreportedian.LODI_OFICINA_NB = int.Parse(drFacturas[1].ToString());";
                _log.wr(_vgp._Directorio, "Win32Exception.txt", _mensajeError);
                _correo.envioCorreoDesarrollador(ex.Message, _mensajeError, _vgp);
            }
            catch (IOException ex)
            {
                string _mensajeError = @"IOException : " + ex.Source + "\nData source: " + ex.Message + "\nInnerException: " + ex.InnerException +
                                       "Procedimiento : caFEtysVS02_logicaProceso_public async void inicio() " +
                                       "instruccion : _vgp.logreportedian.LODI_OFICINA_NB = int.Parse(drFacturas[1].ToString());";
                _log.wr(_vgp._Directorio, "IOException.txt", _mensajeError);
                _correo.envioCorreoDesarrollador(ex.Message, _mensajeError, _vgp);
            }
            catch (Exception ex)
            {
                string _mensajeError = @"Exception : " + ex.Source + "\nData source: " + ex.Message + "\nInnerException: " + ex.InnerException +
                                       "Procedimiento : caFEtysVS02_logicaProceso_public async void inicio() " +
                                       "instruccion : _vgp.logreportedian.LODI_OFICINA_NB = int.Parse(drFacturas[1].ToString());";
                _log.wr(_vgp._Directorio, "Exception.txt", _mensajeError);
                _correo.envioCorreoDesarrollador(ex.Message, _mensajeError, _vgp);
            }
            sizeAnexo = new System.IO.FileInfo(ex1).Length;
            //if (sizeAnexo > 2000000)
            //{
            //    //enviocorreo(factura);
            //    using (StreamWriter writer = new StreamWriter(@"C:\Transer\ws\facturacion\" + factura + @"\Capacidad.txt", true))
            //    {
            //        writer.WriteLine(" ");
            //        writer.WriteLine("El tamaño del archivo sobrepasa la capacidad maxima permitida. Los anexos se enviaran al correo del cliente registro en nuestro sistema.");
            //        writer.WriteLine("*");
            //        writer.WriteLine(" ");
            //    }
            //    using (StreamWriter writer = new StreamWriter(@"C:\Transer\ws\facturacion\" + factura + @"\" + factura + ".txt", true))
            //    {
            //        writer.WriteLine(" ");
            //        writer.WriteLine(" Señor(es),  ");
            //        writer.WriteLine(" " + getCliente(factura));
            //        writer.WriteLine("  ");
            //        writer.WriteLine(" Les informamos que TRANSPORTES Y SERVICIOS TRANSER S.A les ha emitido el siguiente documento. ");
            //        writer.WriteLine("  ");
            //        writer.WriteLine(" Número de documento: " + factura);
            //        writer.WriteLine(" Tipo de documento: " + _vgp.icpdbInfodian.tipoDocumentoDescriptivo);
            //        writer.WriteLine(" Fecha de emisión: " + DateTime.Now.ToLongDateString());
            //        writer.WriteLine(" Los anexos que soportan el documento sobrepasan el tamaño máximo permitido por nuestro PST, por tal razón los enviaremos vía correo electrónico con el Asunto " + factura + "-Anexos al mismo correo en que reciben la notificación de la factura electrónica. ");
            //        writer.WriteLine("  ");
            //        writer.WriteLine(" Si tiene alguna inquietud al respecto no dude en contactar a nuestros representantes comerciales. ");
            //        writer.WriteLine("  ");
            //        writer.WriteLine("  ");
            //        writer.WriteLine(" Atentamente,  ");
            //        writer.WriteLine("  ");
            //        writer.WriteLine(" TRANSPORTES Y SERVICIOS TRANSER S.A ");
            //    }
            //}
            if (sizeAnexo > 5000000)
            {
                using (StreamWriter writer = new StreamWriter(@"C:\Transer\ws\facturacion\" + factura + @"\Capacidad.txt", true))
                {
                    writer.WriteLine(" ");
                    writer.WriteLine("El tamaño del archivo sobrepasa la capacidad de correo maxima permitida. Los anexos no se pueden enviar por este medio.");
                    writer.WriteLine("*");
                    writer.WriteLine(" ");
                }
            }
        }