Пример #1
0
        public XmlDocument GenerarDocumento()
        {
            Helper.DatosMySql fudDat = new Helper.DatosMySql();
            Helper.Genericas  funGen = new Helper.Genericas();
            int n_row = 0;

            string[,] arrAtributoNodo = new string[1, 2] {
                { "n_iddoc", "System.INT64" }
            };

            string[,] arrParametros = new string[1, 3] {
                { "n_iddoc", "System.INT64", "1" }
            };

            dtDocOrig   = fudDat.StoreDTLLenar("sun_docelectronicos_consulta1", arrParametros, MyConeccion);
            dtDocumento = funGen.DataTableFiltrar(dtDocOrig, "n_id <= 74");
            dtDocItem   = funGen.DataTableFiltrar(dtDocOrig, "n_id >= 75");
            dtAtributos = fudDat.StoreDTLLenar("sun_docelectronicosatri_consulta1", arrParametros, MyConeccion);

            XmlElement objNodoPadre;

            Helper.XML_funciones FunXml = new Helper.XML_funciones();
            string[,] arrAtributo = new string[10, 2] {
                { "xmlns", "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" },
                { "xmlns:cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" },
                { "xmlns:cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" },
                { "xmlns:ccts", "urn:un:unece:uncefact:documentation:2" },
                { "xmlns:ds", "http://www.w3.org/2000/09/xmldsig#" },
                { "xmlns:ext", "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" },
                { "xmlns:qdt", "urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" },
                { "xmlns:sac", "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" },
                { "xmlns:udt", "urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" },
                { "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" }
            };


            FunXml.DocAtributos = arrAtributo;         // CARGAMOS LOS ATRIBUTOS DEL DOCUMENTO
            FunXml.DocXml       = DocXml;              // PASAMOS LA VARIABLE XML
            DocXml       = FunXml.CrearXML("Invoice"); // CREAMOS EL DOCUMENTO XML INDICANDO EL NOMBRE DE LA RAIZ
            objNodoPadre = FunXml.NodoPadre;
            CargarFE();
            AgregarNodo(1, dtDocumento, dtAtributos, objNodoPadre, "");

            //AGREGAMOS LOS ITEMS DE LA FACTURA ELECTRONICA
            for (n_row = 0; n_row <= dtDetalleFE.Rows.Count - 1; n_row++)
            {
                AgregarItems(1, dtDocItem, dtAtributos, objNodoPadre, "", n_row);
            }
            string c_tipcom  = "01";
            string c_nomarch = C_CONTRI_RUC + "-" + c_tipcom + "-" + C_CONTRI_NUMSERDOC + "-" + C_CONTRI_NUMCORDOC + ".xml";

            FunXml.GrabarArchivo(DocXml, C_RUTAARCHIVO, c_nomarch);
            return(DocXml);
        }
Пример #2
0
        MySqlConnection Conectar()
        {
            MySqlConnection mysConectar = new MySqlConnection();

            Helper.DatosMySql hlpFuncion = new Helper.DatosMySql();

            mysConectar = hlpFuncion.ObtenerConexion("localhost", "data01", "root", "12345678");

            if (mysConectar.State == ConnectionState.Open)
            {
                //MessageBox.Show(" Se conecto con exito", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                //MessageBox.Show("No se pudo abrir la BD ", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                //mysConectar = Nothing;
            }
            return(mysConectar);
        }