예제 #1
0
 public static String registrarFactura(String idFactura, String identificacionCliente, DateTime fecha, float totalFactura, List<DetalleFacturaAppRQ> detalles)
 {
     if (identificacionCliente != null && fecha != null && detalles != null && idFactura != null)
     {
         IngresoFacturaRQ ingresoFacturaRQ = new IngresoFacturaRQ();
         AppClient appClient = new AppClient();
         ingresoFacturaRQ.Detalles=detalles;
         ingresoFacturaRQ.IdFactura=idFactura;
         ingresoFacturaRQ.Identificacion=identificacionCliente;
         ingresoFacturaRQ.NumeroDetalles=detalles.Count.ToString();
         ingresoFacturaRQ.Fecha = fecha.ToString("yyyyMMdd");
         ingresoFacturaRQ.Total = totalFactura.ToString();
         MensajeRQ mensajeRQ = new MensajeRQ("Raul", Mensaje.ID_MENSAJE_INGRESOFACTURA);
         mensajeRQ.Cuerpo=ingresoFacturaRQ;
         MensajeRS mensajeRS = appClient.sendRequest(mensajeRQ);
         if (mensajeRS != null)
         {
             IngresoFacturaRS ingresoFacturaRS = (IngresoFacturaRS)mensajeRS.Cuerpo;
             return ingresoFacturaRS.Resultado;
         }
         return BAD_RESPONSE;
     }
     else
     {
         return NULL_PARAMETERS;
     }
 }
예제 #2
0
        public override bool build(string input)
        {
            Boolean result = true;
            if (validate(input))
            {
                this.cabecera = new Cabecera();
                // Prueba repositorio GIT
                if (this.cabecera.build(input.Substring(0, Cabecera.HEADER_LENGTH)))
                {
                    // se obtiene el resto del mensaje que seria el cuerpo
                    String cuerpo = input.Substring(Cabecera.HEADER_LENGTH);
                    if (this.cabecera.TipoMensaje.Equals(Mensaje.TIPO_MENSAJE_REQUEST))
                    {
                        if (this.cabecera.IdMensaje.Equals(ID_MENSAJE_AUTENTICACIONCLIENTE))
                        {
                            AutenticacionEmpresaRQ autenticacionClienteRQ = new AutenticacionEmpresaRQ();
                            autenticacionClienteRQ.build(cuerpo);
                            this.cuerpo = autenticacionClienteRQ;
                        }
                        else if (this.cabecera.IdMensaje.Equals(ID_MENSAJE_INGRESOCLIENTE))
                        {
                            IngresoClienteRQ ingresoClienteRQ = new IngresoClienteRQ();
                            ingresoClienteRQ.build(cuerpo);
                            this.cuerpo = ingresoClienteRQ;
                        }
                        else if (this.cabecera.IdMensaje.Equals(ID_MENSAJE_CONSULTACLIENTE))
                        {
                            ConsultaClienteRQ consultaClienteRQ = new ConsultaClienteRQ();
                            consultaClienteRQ.build(cuerpo);
                            this.cuerpo = consultaClienteRQ;
                        }
                        else if (this.cabecera.IdMensaje.Equals(ID_MENSAJE_CONSULTAPRODUCTO))
                        {

                            ConsultaProductoRQ consultaProductoRQ = new ConsultaProductoRQ();
                            consultaProductoRQ.build(cuerpo);
                            this.cuerpo = consultaProductoRQ;
                        }
                        else if (this.cabecera.IdMensaje.Equals(ID_MENSAJE_INGRESOFACTURA))
                        {

                            IngresoFacturaRQ ingresoFacturaRQ = new IngresoFacturaRQ();
                            ingresoFacturaRQ.build(cuerpo);
                            this.cuerpo = ingresoFacturaRQ;
                        }

                        else {
                            result = false;
                        }

                    }
                    else
                    {
                        result = false;
                    }

                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return result;
        }