Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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;
            }
        }