private string salida(HttpContext context) { string response = string.Empty; string referencia = string.Empty; string option = context.Request["opt"].ToString(); Salida_aud_uni oSalAudUni; string path = string.Empty; string TemplatePath = string.Empty; try { switch (option) { case "getOrdenCargaByFolio": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); referencia = jsonData.ToString(); response = JsonConvert.SerializeObject(SalidaCtrl.OrdenCargaGetByFolio(referencia)); break; case "AudUniAdd": jsonData = new StreamReader(context.Request.InputStream).ReadToEnd(); oSalAudUni = JsonConvert.DeserializeObject <Salida_aud_uni>(jsonData); if (oSalAudUni.PLstSalAudUniFiles == null) { oSalAudUni.PLstSalAudUniFiles = new List <Salida_aud_uni_files>(); } path = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/salidas_aud/"), oSalAudUni.Referencia + @"\"); TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt"); SalidaCtrl.SalidaAudUniAdd(oSalAudUni, path); dsForm = new dsFormatos(); DocFormatos.getCasc028(Path.Combine(path, oSalAudUni.prefixImg + "casc028.pdf"), TemplatePath, SalidaCtrl.SalidaAudUniGetAll(oSalAudUni), dsForm); response = JsonConvert.SerializeObject(oSalAudUni); break; default: throw new Exception("La opción " + option + " no existe"); } } catch { throw; } return(response); }