public static int IniciarProcesoZip( bool firma, bool cufe, bool zip, string pathXML, int typeDoc, string flag_masivo) { if (flag_masivo != Constants.FLAG_OK) { EditXML.editFile(new FileInfo(pathXML), typeDoc); } string pathXMLNew = CommonMethods.newXML(pathXML, typeDoc); FileInfo file = new FileInfo(pathXMLNew); if (cufe) { if (CUFE.AddingCUFEXML(file, typeDoc) != Constants.PROCESS_CORE_COD_OK) { return(Constants.PROCESS_CORE_COD_ERROR_CUFE); } } if (firma) { if (SignXML.signJAVA(file.FullName, file.FullName, typeDoc) != 0) { return(Constants.PROCESS_CORE_COD_ERROR_FIRMA); } } if (zip) { if (ZipXML.CreateZIP(ZipXML.createZipName(file), file.FullName, file.DirectoryName) != 0) { return(Constants.PROCESS_CORE_COD_ERROR_ZIP); } } return(Constants.PROCESS_CORE_COD_OK); }
public static int ProcesoEnvioZIP( bool firma, bool cufe, bool zip, string pathZIP, int typeDoc) { try { int fError = 0; string eError = ""; ZipXML.unZip(pathZIP); string directory = ConfigurationManager.AppSettings[Constants.SAVE_EXTRACT_DOCUMENTS_DIRECTORY]; FileInfo[] archivos = new DirectoryInfo(directory).GetFiles(Constants.FILTER_FILE_XML); foreach (FileInfo archivo in archivos) { EditXML.editFile(archivo, typeDoc); fError = IniciarProcesoZip(firma, cufe, zip, archivo.FullName, typeDoc, Constants.FLAG_OK); if (fError != Constants.PROCESS_CORE_COD_OK) { return(fError); } eError = EnviarZIP(archivo.FullName, typeDoc); archivo.Delete(); if (eError == Constants.PROCESS_SEND_STRING_ERROR) { return(Constants.PROCESS_SEND_COD_ERROR); } } return(Constants.PROCESS_CORE_COD_OK); } catch (Exception e) { return(Constants.PROCESS_CORE_COD_ERROR); } }
public static void setParameters(Connection c, string pathXML, int typeDoc) { FileInfo file = new FileInfo(pathXML); c.PathZip = ZipXML.createZipName(file); XmlDocument doc = new XmlDocument(); doc.Load(file.FullName); XmlNamespaceManager xmlnsMgr = CommonMethods.getNamespacesManager(doc); switch (typeDoc) { case Constants.INVOICE_STRING_FIRMA_ID: c.Nit = doc.SelectSingleNode(Constants.XPATH_NIT_INVOICE, xmlnsMgr).InnerText; c.DateTime = doc.SelectSingleNode(Constants.XPATH_DATE_INVOICE, xmlnsMgr).InnerText + "_" + doc.SelectSingleNode(Constants.XPATH_HOUR_INVOICE, xmlnsMgr).InnerText; c.NumberInvoice = doc.SelectSingleNode(Constants.XPATH_NUMBER_INVOICE, xmlnsMgr).InnerText; break; case Constants.DEBITNOTE_STRING_FIRMA_ID: c.Nit = doc.SelectSingleNode(Constants.XPATH_NIT_DEBITNOTE, xmlnsMgr).InnerText; c.DateTime = doc.SelectSingleNode(Constants.XPATH_DATE_DEBITNOTE, xmlnsMgr).InnerText + "_" + doc.SelectSingleNode(Constants.XPATH_HOUR_DEBITNOTE, xmlnsMgr).InnerText; c.NumberInvoice = doc.SelectSingleNode(Constants.XPATH_NUMBER_DEBITNOTE, xmlnsMgr).InnerText; break; case Constants.CREDITNOTE_STRING_FIRMA_ID: c.Nit = doc.SelectSingleNode(Constants.XPATH_NIT_CREDITNOTE, xmlnsMgr).InnerText; c.DateTime = doc.SelectSingleNode(Constants.XPATH_DATE_CREDITNOTE, xmlnsMgr).InnerText + "_" + doc.SelectSingleNode(Constants.XPATH_HOUR_CREDITNOTE, xmlnsMgr).InnerText; c.NumberInvoice = doc.SelectSingleNode(Constants.XPATH_NUMBER_CREDITNOTE, xmlnsMgr).InnerText; break; default: break; } }