private string aduana(HttpContext context) { option = context.Request["opt"].ToString(); Aduana o = new Aduana(); switch (option) { case "sltById": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogSelById(o); response = JsonConvert.SerializeObject(o); break; case "add": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Aduana>(jsonData); o.Id = CatalogoCtrl.catalogAdd(o); response = JsonConvert.SerializeObject(o); break; case "udt": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Aduana>(jsonData); CatalogoCtrl.catalogUdt(o); response = JsonConvert.SerializeObject(o); break; case "lst": response = JsonConvert.SerializeObject(CatalogoCtrl.catalogGetLst(o).Cast <Aduana>().ToList()); break; case "dlt": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogEnabled(o); response = JsonConvert.SerializeObject(o); break; default: break; } return(response); }
private string vendor(HttpContext context) { option = context.Request["opt"].ToString(); Vendor o = new Vendor(); switch (option) { case "sltById": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogSelById(o); response = JsonConvert.SerializeObject(o); break; case "add": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Vendor>(jsonData); o.Id = CatalogoCtrl.catalogAdd(o); response = JsonConvert.SerializeObject(o); break; case "udt": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Vendor>(jsonData); CatalogoCtrl.catalogUdt(o); response = JsonConvert.SerializeObject(o); break; case "lstAll": response = JsonConvert.SerializeObject(CatalogoCtrl.catalogGetAllLst(o).Cast <Vendor>().ToList()); break; case "enb": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogEnabled(o); o.IsActive = true; response = JsonConvert.SerializeObject(o); break; case "dsb": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogDisabled(o); o.IsActive = false; response = JsonConvert.SerializeObject(o); break; default: break; } return(response); }
private string cortina(HttpContext context) { option = context.Request["opt"].ToString(); Cortina o = new Cortina(); switch (option) { case "sltById": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogSelById(o); response = JsonConvert.SerializeObject(o); break; case "add": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Cortina>(jsonData); o.Id = CatalogoCtrl.catalogAdd(o); response = JsonConvert.SerializeObject(o); break; case "udt": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); o = JsonConvert.DeserializeObject <Cortina>(jsonData); CatalogoCtrl.catalogUdt(o); response = JsonConvert.SerializeObject(o); break; case "lstAll": List <Cortina> lst = CatalogoCtrl.catalogGetAllLst(o).Cast <Cortina>().ToList(); if (context.Request["key"] != null) { key = context.Request["key"].ToString(); lst = lst.FindAll(p => p.Id_bodega == Convert.ToInt32(key)); } response = JsonConvert.SerializeObject(lst); break; case "enb": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogEnabled(o); o.IsActive = true; response = JsonConvert.SerializeObject(o); break; case "dsb": if (context.Request["key"] != null) { int.TryParse(context.Request["key"], out id); } o.Id = id; CatalogoCtrl.catalogDisabled(o); o.IsActive = false; response = JsonConvert.SerializeObject(o); break; default: break; } return(response); }