Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private string entrada(HttpContext context)
        {
            string          response   = string.Empty;
            string          referencia = string.Empty;
            string          option     = context.Request["opt"].ToString();
            Entrada_aud_uni oEntAudUni;
            Entrada_aud_mer oEntAudMer;
            string          path         = string.Empty;
            string          TemplatePath = string.Empty;

            //string referencia = context.Request["referencia"].ToString();
            try
            {
                switch (option)
                {
                case "precargaGetByRef":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    referencia = jsonData.ToString();
                    response   = JsonConvert.SerializeObject(EntradaCtrl.EntradaPreCargaGetByRef(referencia));
                    break;

                case "AudUniAdd":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    oEntAudUni = JsonConvert.DeserializeObject <Entrada_aud_uni>(jsonData);
                    if (oEntAudUni.PLstEntAudUniFiles == null)
                    {
                        oEntAudUni.PLstEntAudUniFiles = new List <Entrada_aud_uni_files>();
                    }
                    path         = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/entradas_aud/"), oEntAudUni.Referencia + @"\");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt");
                    EntradaCtrl.EntradaAudUniAdd(oEntAudUni, path);
                    dsForm = new dsFormatos();
                    DocFormatos.getCasc028(Path.Combine(path, oEntAudUni.prefixImg + "casc028.pdf"), TemplatePath, EntradaCtrl.EntradaPreCargaGetAllById(oEntAudUni), dsForm);
                    response = JsonConvert.SerializeObject(oEntAudUni);
                    break;

                case "AudMerAdd":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    oEntAudMer = JsonConvert.DeserializeObject <Entrada_aud_mer>(jsonData);
                    if (oEntAudMer.PLstEntAudMerFiles == null)
                    {
                        oEntAudMer.PLstEntAudMerFiles = new List <Entrada_aud_mer_files>();
                    }
                    path         = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/entradas_aud/"), oEntAudMer.Referencia + @"\");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt");
                    EntradaCtrl.EntradaAudMerAdd(oEntAudMer, path);
                    dsForm = new dsFormatos();
                    DocFormatos.getCasc028(Path.Combine(path, oEntAudMer.prefixImg + "casc028.pdf"), TemplatePath, EntradaCtrl.EntradaPreCargaGetAllById(oEntAudMer), dsForm);
                    response = JsonConvert.SerializeObject(oEntAudMer);
                    break;

                default:
                    throw new Exception("La opción " + option + " no existe");
                }
            }
            catch
            {
                throw;
            }
            return(response);
        }