예제 #1
0
        private void btBuscaFact_Click(object sender, EventArgs e)
        {
            BindModelBuyer();
            BindModelBusqueda();

            Wsd.GetFacturasRecibidasPagos(_PetPagoFactRecEnviadas);

            // Muestro el xml de respuesta recibido de la AEAT en el web browser

            FormXmlViewer frmXmlViewer = new FormXmlViewer
            {
                Path = Settings.Current.InboxPath +
                       _PetPagoFactRecEnviadas.GetReceivedFileName()
            };

            //frmXmlViewer.ShowDialog();

            // Obtengo la respuesta de facturas recibidas del archivo de
            // respuesta de la AEAT.
            RespuestaConsultaPagos respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaPagos;

            if (respuesta == null)
            {
                DialogResult resultMsg;
                string       _msgError = "Se ha recibido una respuesta inesperada. Pulse 'Aceptar', si quiere revisarla";
                resultMsg = MessageBox.Show(_msgError, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

                if (resultMsg == DialogResult.OK)
                {
                    frmXmlViewer.ShowDialog();
                }

                return;
            }

            // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura.
            grdInvoices.Rows.Clear();

            if (respuesta.ResultadoConsulta == "ConDatos")
            {
                foreach (var invoice in respuesta.RegistroRespuestaConsultaPagos)
                {
                    System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok;

                    decimal TotalTmp = Convert.ToDecimal(invoice.Pago.Importe, DefaultNumberFormatInfo);

                    grdInvoices.Rows.Add(invoice.Pago.Fecha, TotalTmp.ToString("#,##0.00"), invoice.Pago.Medio, invoice.Pago.Cuenta_O_Medio,
                                         invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion);
                }
            }
        }
예제 #2
0
        private void LanzarConsulta()
        {
            Wsd.GetFacturasRecibidasPagos(_PetPagoFactRecEnviadas);

            // Muestro el xml de respuesta recibido de la AEAT en el web browser

            FormXmlViewer frmXmlViewer = new FormXmlViewer
            {
                Path = Settings.Current.InboxPath +
                       _PetPagoFactRecEnviadas.GetReceivedFileName()
            };

            //frmXmlViewer.ShowDialog();

            // Obtengo la respuesta de facturas recibidas del archivo de
            // respuesta de la AEAT.
            RespuestaConsultaPagos respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaPagos;

            if (respuesta == null)
            {
                SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError;
                if (msgError != null)
                {
                    MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura.
            grdInvoices.Rows.Clear();

            if (respuesta.ResultadoConsulta == "ConDatos")
            {
                foreach (var invoice in respuesta.RegistroRespuestaConsultaPagos)
                {
                    System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok;

                    decimal TotalTmp = Convert.ToDecimal(invoice.Pago.Importe, DefaultNumberFormatInfo);

                    grdInvoices.Rows.Add(invoice.Pago.Fecha, TotalTmp.ToString("#,##0.00"), invoice.Pago.Medio, invoice.Pago.Cuenta_O_Medio,
                                         invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion);
                }
            }
        }