1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Threading.Tasks;
9: using System.Windows.Forms;
10: using System.Xml.Serialization;
11: using System.Xml;
12: using System.Data.SQLite;
13: using LECTOR_CFDI.Clases;
14:
15: namespace LECTOR_CFDI
16: {
17: public partial class Form1 : Form
18: {
19: string strUUID;
20: string strSelloSat;
21: string strNoCertificadoSat;
22: string strSelloCFD;
23: string strFechaTimbrado;
24: string strVersion;
25:
26: public Form1()
27: {
28: InitializeComponent();
29: }
30:
31: private void button1_Click(object sender, EventArgs e)
32: {
33: XmlSerializer serielizer = new XmlSerializer(typeof(Comprobante));
34: XmlTextReader reader = new XmlTextReader(@"C:xml.xml");
35: Comprobante factura = (Comprobante)serielizer.Deserialize(reader);
36:
37: classConexion bd = new classConexion();
38:
39:
40: classComplemento complemento = new classComplemento();
41: complemento.strUUID = (factura.Complemento.Any[0].Attributes[3].Value);
42: complemento.strVersion = (factura.Complemento.Any[0].Attributes[2].Value);
43: complemento.strFechaTimbrado = (factura.Complemento.Any[0].Attributes[4].Value);
44: complemento.strSelloSat = (factura.Complemento.Any[0].Attributes[7].Value);
45: complemento.strSelloCFD = (factura.Complemento.Any[0].Attributes[5].Value);
46: complemento.strNoCertificadoSat = (factura.Complemento.Any[0].Attributes[6].Value);
47: complemento.insertar();
48:
49: //INSERTANDO LOS CONCEPTOS
50: foreach (ComprobanteConcepto comp in factura.Conceptos)
51: {
52: classConceptos clsConceptos = new classConceptos();
53: clsConceptos.strUUID = complemento.strUUID;
54: clsConceptos.strImporte = comp.importe.ToString () ;
55: clsConceptos.strDescripcion = comp.descripcion.ToString();
56: clsConceptos.strValorUnitario = comp.valorUnitario.ToString();
57: clsConceptos.strCantidad = comp.cantidad.ToString();
58: clsConceptos.insertar();
59:
60: }
61:
62: }
63:
64: }
65: }