Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        public static Producto retrieveProducto(String idProducto)
        {
            if (idProducto != null) {
                AppClient appClient = new AppClient();
                ConsultaProductoRQ cprq = new ConsultaProductoRQ();

                cprq.Id=idProducto;

                MensajeRQ mensajeRQ = new MensajeRQ("Raul", Mensaje.ID_MENSAJE_CONSULTAPRODUCTO);
                mensajeRQ.Cuerpo=cprq;
                MensajeRS mensajeRS = appClient.sendRequest(mensajeRQ);
                ConsultaProductoRS cprs = (ConsultaProductoRS) mensajeRS.Cuerpo;
                if (cprs.Resultado.Equals("1")) {
                    Console.Out.WriteLine("" + cprs.Producto);
                    return cprs.Producto;
                }
            }
            return null;
        }