Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType     = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;
            string catalogo = context.Request["catalogo"].ToString();
            string response = string.Empty;

            try
            {
                switch (catalogo)
                {
                case "cliente":
                    response = cliente(context);
                    break;

                case "cliente_mercancia":
                    response = clienteMercancia(context);
                    break;

                case "cliente_vendor":
                    response = clienteVendor(context);
                    break;

                case "cliente_documento":
                    response = clienteDocumento(context);
                    break;

                case "documento":
                    response = CatalogCtrl.DocumentoLstToJson();
                    break;

                case "transporte":
                    response = JsonConvert.SerializeObject(CatalogCtrl.TransporteGetByTipo(Convert.ToInt32(context.Request["id_transporte_tipo"])));
                    break;

                case "transporte_tipo":
                    response = JsonConvert.SerializeObject(CatalogCtrl.TransporteTipoGet());
                    break;

                case "vigilante":
                    response = JsonConvert.SerializeObject(CatalogCtrl.vigilanteGetByBodega(Convert.ToInt32(context.Request["key"])));
                    break;

                default:
                    break;
                }
                context.Response.Write(response);
            }
            catch (Exception e)
            {
                context.Response.Write(e.Message);
            }
        }