public DialogoCrearFactura(Contribuyente c)
        {
            InitializeComponent();

            facturaElectronica = new FacturaElectronica()
            {
                Detalles = new List<Detalle>(),
                Receptor = new Receptor()
                {
                    Ubicacion = new Ubicacion()
                }
            };
            

            mainPanel.DataContext = facturaElectronica;

            if (codigoANombreActEco == null)
            {
                LeerActividadesEconomicas();
            }

            foreach(ActividadEconomica a in c.ActividadesEconomicas){
                var cbi = new ComboBoxItem();
                if (codigoANombreActEco.ContainsKey(a.Value))
                {
                    cbi.Content = codigoANombreActEco[a.Value];
                }
                else
                {
                    cbi.Content = a.Value;
                }
                cbi.Tag = a.Value;
                actEcoComboBox.Items.Add(cbi);
            }
        }
 private void crearFactura(FacturaElectronica fe)
 {
     try
     {
         api.CrearFactura(fe);
     }
     catch (ApiException ae)
     {
         MessageBox.Show(ae.Message, "Errores");
     }
 }
Ejemplo n.º 3
0
        public void CrearFactura(FacturaElectronica fe)
        {
            var r = new RestRequest(Method.POST);

            r.Resource = "documentos";
            var sw = new StringWriter();
            var s  = new XmlSerializer(typeof(FacturaElectronica));

            s.Serialize(sw, fe);

            r.AddParameter("application/xml", sw.ToString(), ParameterType.RequestBody);
            var resp = client.Execute(r);

            if (resp.ErrorException != null || !resp.StatusCode.Equals(HttpStatusCode.Created))
            {
                throw new ApiException(resp);
            }

            DescargarDocumento(GetCreatedId(resp));
        }
Ejemplo n.º 4
0
        public DialogoCrearFactura(Contribuyente c)
        {
            InitializeComponent();

            facturaElectronica = new FacturaElectronica()
            {
                Detalles = new List <Detalle>(),
                Receptor = new Receptor()
                {
                    Ubicacion = new Ubicacion()
                }
            };


            mainPanel.DataContext = facturaElectronica;

            if (codigoANombreActEco == null)
            {
                LeerActividadesEconomicas();
            }

            foreach (ActividadEconomica a in c.ActividadesEconomicas)
            {
                var cbi = new ComboBoxItem();
                if (codigoANombreActEco.ContainsKey(a.Value))
                {
                    cbi.Content = codigoANombreActEco[a.Value];
                }
                else
                {
                    cbi.Content = a.Value;
                }
                cbi.Tag = a.Value;
                actEcoComboBox.Items.Add(cbi);
            }
        }
Ejemplo n.º 5
0
        public void CrearFactura(FacturaElectronica fe)
        {
            var r = new RestRequest(Method.POST);
            r.Resource = "documentos";
            var sw = new StringWriter();
            var s = new XmlSerializer(typeof(FacturaElectronica));
            s.Serialize(sw, fe);

            r.AddParameter("application/xml", sw.ToString(), ParameterType.RequestBody);
            var resp = client.Execute(r);
            if (resp.ErrorException != null || !resp.StatusCode.Equals(HttpStatusCode.Created))
            {
                throw new ApiException(resp);
            }

            DescargarDocumento(GetCreatedId(resp));
        }
        private void crearFactura(FacturaElectronica fe)
        {
            try
            {
                api.CrearFactura(fe);

            }
            catch (ApiException ae)
            {
                MessageBox.Show(ae.Message, "Errores");
            }
        }