Exemple #1
0
    public void RaiseCallbackEvent(string eventArg)
    {
        string sResultado = "";

        //1º Si hubiera argumentos, se recogen y tratan.
        //string MisArg = eventArg;
        string[] aArgs = Regex.Split(eventArg, "@#@");
        sResultado = aArgs[0] + @"@#@"; if (Session["IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;

        //2º Aquí realizaríamos el acceso a BD, etc,...
        try
        {
            switch (aArgs[0])
            {
            case ("grabar"):
                IdiomaFic.Grabar((aArgs[1] == "") ? null : (int?)int.Parse(aArgs[1]),
                                 int.Parse(aArgs[2]),
                                 (aArgs[3] == "") ? null : (int?)int.Parse(aArgs[3]),
                                 (aArgs[4] == "") ? null : (int?)int.Parse(aArgs[4]),
                                 (aArgs[5] == "") ? null : (int?)int.Parse(aArgs[5]),
                                 int.Parse(hdnIdFicepi.Value));
                sResultado += "OK";
                break;

            case ("eliminartitulo"):
                sResultado += TituloIdiomaFic.Delete(aArgs[1]).ToString();
                break;

            case ("CargarTitulos"):
                sResultado += CargarTitulos(int.Parse(aArgs[1]), int.Parse(aArgs[2]));
                break;
            }
        }
        catch (Exception ex)
        {
            switch (aArgs[0])
            {
            case ("grabar"):
                sResultado += "Error@#@" + Errores.mostrarError("Error al grabar", ex);
                break;

            case ("eliminartitulo"):
                sResultado += "Error@#@" + Errores.mostrarError("Error al eliminar", ex);
                break;
            }
        }

        //3º Damos contenido a la variable que se envía de vuelta al cliente.
        _callbackResultado = sResultado;
    }
Exemple #2
0
 public string CargarTitulos(int idFicepi, int idIdioma)
 {
     try
     {
         return("OK@#@" + TituloIdiomaFic.Catalogo(idFicepi, idIdioma));
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al obtener los títulos", ex));
     }
 }
    public void CargarDatos(TituloIdiomaFic o)
    {
        if (o != null)
        {
            hdnEstadoInicial.Value = o.t839_idestado.ToString();
            hdnndoc.Value          = o.T021_NDOC;

            this.hdnNombreDocInicial.Value = o.T021_NDOC;
            this.hdnContentServer.Value    = o.t2_iddocumento.ToString();

            if (o.t839_idestado == char.Parse("S") ||
                o.t839_idestado == char.Parse("T"))        //Pendiente de cumplimentar.
            {
                //imgEstado.Attributes.Add("title", tf.t597_motivort.ToString());
                //imgEstado.Attributes.Add("onmouseover", "showTTE(\"" + Utilidades.escape(o.T835_MOTIVORT.ToString()) + "\",\"Motivo\",null,300)");
                //imgEstado.Attributes.Add("onmouseout", "hideTTE()");
                imgInfoEstado.Style.Add("visibility", "visible");
                imgInfoEstado.Attributes.Add("onmouseover", "showTTE(\"" + Utilidades.escape(o.T835_MOTIVORT.ToString()) + "\",\"Motivo\",null,300)");
                imgInfoEstado.Attributes.Add("onmouseout", "hideTTE()");
            }
            if (o.t839_idestado != char.Parse("V"))
            {
                imgEstado.Attributes.Add("onmouseover", "showTTE(\"" + Utilidades.escape(Curvit.ToolTipEstados(o.t839_idestado.ToString())) + "\",\"Información\",null,300)");
                imgEstado.Attributes.Add("onmouseout", "hideTTE()");
            }
            //if (o.T021_DOC != null)
            if (o.t2_iddocumento != null)
            {
                txtNombreDocumento.Text = o.T021_NDOC;
                imgUploadDoc.Style.Add("display", "inline-block");
                imgDownloadDoc.Style.Add("display", "inline-block");
                imgBorrarDoc.Style.Add("display", "inline-block");
                imgDownloadDoc.Attributes.Add("onclick", "verDOC()");
            }

            txtTitulo.Value       = o.T021_TITULO;
            txtFecha.Text         = (o.T021_FECHA != null) ? ((DateTime)o.T021_FECHA).ToShortDateString() : "";
            txtObservaciones.Text = o.T021_OBSERVA;
            query.Value           = o.T021_CENTRO;

            //txtMotivoRT.Text = o.T835_MOTIVORT;
            if (o.T020_DESCRIPCION != null)
            {
                txtIdioma.InnerText = o.T020_DESCRIPCION;
            }
        }
    }
    public string Grabar(int idTituloIdioma, int idFicepi, int idIdioma, string sDenTitulo, string sFecha, string sObs, string sCentro,
                         string sDenDoc, string sCambioDoc, string sUsuTick, string sEstado, string sMotivo, string sEstadoIni,
                         string sIdContentServer, string sEsMiCV)
    {
        string sRes = "OK@#@";

        try
        {
            long?idDocAtenea = null;
            if (sUsuTick.Trim() != "")//Recupero el idDocumento de la tabla Temporal
            {
                SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sUsuTick);
                idDocAtenea = oDoc.t2_iddocumento;
            }
            else
            {
                if (sIdContentServer != "")
                {
                    idDocAtenea = long.Parse(sIdContentServer);
                }
            }
            TituloIdiomaFic.Grabar((idTituloIdioma == -1) ? null : (int?)idTituloIdioma,
                                   sDenTitulo,
                                   (sFecha == "") ? null : (DateTime?)DateTime.Parse(sFecha),  //Fecha Obtencion
                                   sObs, sCentro, idFicepi, idIdioma, sDenDoc,
                                   bool.Parse(sCambioDoc),
                                   char.Parse(sEstado), sMotivo,
                                   (int)Session["IDFICEPI_ENTRADA"], //IDFICEPIU
                                   char.Parse(sEstadoIni), idDocAtenea, sEsMiCV);
            if (sUsuTick.Trim() != "")
            {   //Marco el documento como asignado para que el trigger no lo borre de Atenea
                if (idDocAtenea != null)
                {
                    SUPER.DAL.DocuAux.Asignar(null, (long)idDocAtenea);
                }
                //Borro el documento de la tabla temporal
                SUPER.DAL.DocuAux.BorrarDocumento(null, "T", sUsuTick);
            }
        }
        catch (Exception ex)
        {
            sRes = "Error@#@" + ex.Message;
        }
        return(sRes);
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Control de sesión
        if (Session["IDRED"] == null)
        {
            try
            {
                Response.Redirect("~/SesionCaducadaModal.aspx", true);
            }
            catch (System.Threading.ThreadAbortException) { return; }
        }
        #endregion
        string   sTipo  = Request.QueryString["sTipo"].ToString();
        string[] sIDDOC = null;
        int      nIDDOC = 0;
        switch (sTipo)
        {
        case "TIF":
        case "TAD":
        case "TAE":
            sIDDOC = Regex.Split(Request.QueryString["nIDDOC"].ToString(), "datos");
            break;

        case "CVTCUR":
        case "CVTCUR_IMP":
        case "CVTEXAMEN":
        case "CVTCERT":
        case "CVTEXAMEN2":
            sIDDOC = Regex.Split(Request.QueryString["nIDDOC"].ToString(), "datos");
            break;

        default:
            try { nIDDOC = int.Parse(Request.QueryString["nIDDOC"].ToString()); }
            catch (Exception e1)
            {
                string sError = "Descargar.aspx->Page_Load. Tipo=" + sTipo + " Id documento=" + Request.QueryString["nIDDOC"].ToString();
                sError += " Ficepi=" + Session["IDFICEPI_PC_ACTUAL"].ToString() + " Error=" + e1.Message;
                throw (new Exception(sError));
            }
            break;
        }
        #region Pruebas
        //string sPath = "", sNomFich="";

        ////sPath = @"../../Upload/634527150288235168.txt";
        ////sPath = Server.MapPath(@"/Upload/634527150288235168.txt");
        ////sPath = @"d:\inetpub\wwwroot\SUPER\Upload\634527150288235168.txt";
        //if (Request.QueryString["sPath"] != null)
        //{
        //    sNomFich = Utilidades.decodpar(Request.QueryString["sPath"].ToString());
        //    //sNomFich = "pepe.xml";
        //    //sPath = Server.MapPath(@"/SUPER/Upload/") + @"\" + sNomFich;
        //    if (System.Configuration.ConfigurationManager.ConnectionStrings["ENTORNO"].ToString() == "D")
        //        sPath = Server.MapPath(@"/SUPER/Upload/") + sNomFich;
        //    else
        //        sPath = Server.MapPath(@"/Upload/") + sNomFich;
        //        //sPath = @"d:\inetpub\wwwroot\SUPER\Upload\634527150288235168.txt";
        //        //sPath = Server.MapPath(@"/Upload/634527150288235168.txt");

        //}
        ////sPath = Server.MapPath(@"/Upload/634527150288235168.xml");
        ////sNomFich = "634527150288235168.txt";
        #endregion
        string sNombreArchivo = "";
        byte[] ArchivoBinario = null;
        long?  t2_iddocumento = null;
        Response.ClearContent();
        Response.ClearHeaders();
        Response.Buffer = true;
        if (Request.QueryString["descargaToken"] != null)
        {
            Response.AppendCookie(new HttpCookie("fileDownloadToken", Request.QueryString["descargaToken"].ToString())); //downloadTokenValue will have been provided in the form submit via the hidden input field
        }
        Response.ContentType = "application/octet-stream";
        try
        {
            #region Leer archivo en función de la tabla solicitada
            switch (sTipo)
            {
            case "AS_T":                                           //Asunto de Bitácora de TAREA
                DOCASU_T oDocAS_T = DOCASU_T.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAS_T.t602_nombrearchivo;
                t2_iddocumento = oDocAS_T.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAS_T.t602_archivo;
                break;

            case "AC_T":                                           //Acción de Bitácora de TAREA
                DOCACC_T oDocAC_T = DOCACC_T.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAC_T.t603_nombrearchivo;
                t2_iddocumento = oDocAC_T.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAC_T.t603_archivo;
                break;

            case "AS_PT":                                             //Asunto de Bitácora de PT
                DOCASU_PT oDocAS_PT = DOCASU_PT.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAS_PT.t411_nombrearchivo;
                t2_iddocumento = oDocAS_PT.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAS_PT.t411_archivo;
                break;

            case "AC_PT":                                             //Acción de Bitácora de PT
                DOCACC_PT oDocAC_PT = DOCACC_PT.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAC_PT.t412_nombrearchivo;
                t2_iddocumento = oDocAC_PT.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAC_PT.t412_archivo;
                break;

            case "AS":                                       //Asunto de Bitácora
            case "AS_PE":                                    //Asunto de Bitácora
                DOCASU oDocAS = DOCASU.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAS.t386_nombrearchivo;
                t2_iddocumento = oDocAS.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAS.t386_archivo;
                break;

            case "AC":                                       //Acción de Bitácora
            case "AC_PE":                                    //Acción de Bitácora
                DOCACC oDocAC = DOCACC.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocAC.t387_nombrearchivo;
                t2_iddocumento = oDocAC.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocAC.t387_archivo;
                break;

            case "IAP_T":
            case "T":
                DOCUT oDocT = DOCUT.Select(null, nIDDOC);    //, true);
                sNombreArchivo = oDocT.t363_nombrearchivo;
                t2_iddocumento = oDocT.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocT.t363_archivo;
                break;

            case "A":                                     //Actividad
                DOCUA oDocA = DOCUA.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocA.t365_nombrearchivo;
                t2_iddocumento = oDocA.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocA.t365_archivo;
                break;

            case "F":                                     //Fase
                DOCUF oDocF = DOCUF.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocF.t364_nombrearchivo;
                t2_iddocumento = oDocF.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocF.t364_archivo;
                break;

            case "PT":                                       //Proyecto Técnico
                DOCUPT oDocPT = DOCUPT.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocPT.t362_nombrearchivo;
                t2_iddocumento = oDocPT.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocPT.t362_archivo;
                break;

            case "PE":                                       //Proyecto Económico
            case "PSN":                                      //Proyecto Económico
                DOCUPE oDocPE = DOCUPE.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocPE.t368_nombrearchivo;
                t2_iddocumento = oDocPE.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocPE.t368_archivo;
                break;

            case "PEF":                                                           //Espacio de acuerdo de Proyecto Económico
                DOC_ACUERDO_PROY oDocPEF = DOC_ACUERDO_PROY.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocPEF.t640_nombrearchivo;
                t2_iddocumento = oDocPEF.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocPEF.t640_archivo;
                break;

            case "HT":                                    //Hito lineal
            case "HM":                                    //Hito discontinuo
                DOCUH oDocH = DOCUH.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocH.t366_nombrearchivo;
                t2_iddocumento = oDocH.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocH.t366_archivo;
                break;

            case "HF":                                       //Hito de fecha
                DOCUHE oDocHE = DOCUHE.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocHE.t367_nombrearchivo;
                t2_iddocumento = oDocHE.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocHE.t367_archivo;
                break;

            case "OF":     //ORDEN DE FACTURACIÓN
                DOCUOF oDocOF = DOCUOF.Select(null, nIDDOC, true);
                sNombreArchivo = oDocOF.t624_nombrearchivo;
                t2_iddocumento = oDocOF.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocOF.t624_archivo;
                break;

            case "PL_OF":                                                       //PLANTILLA ORDEN DE FACTURACIÓN
                PLANTILLADOCUOF oDocPOF = PLANTILLADOCUOF.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocPOF.t631_nombrearchivo;
                t2_iddocumento = oDocPOF.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocPOF.t631_archivo;
                break;

            case "EC":                                       //ESPACIO DE COMUNICACION
                DOCUEC oDocEC = DOCUEC.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocEC.t658_nombrearchivo;
                t2_iddocumento = oDocEC.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocEC.t658_archivo;
                break;

            case "DI":                                                                                 //DIALOGO DE ALERTA
                SUPER.Capa_Datos.DOCDIALOGO oDocDI = SUPER.Capa_Datos.DOCDIALOGO.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocDI.t837_nombrearchivo;
                t2_iddocumento = oDocDI.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocDI.t837_archivo;
                break;

            case "SC":                                                                       //SOLICITUD DE CERTIFICADO
                SUPER.BLL.DOCSOLICITUD oDocSC = SUPER.BLL.DOCSOLICITUD.Select(null, nIDDOC); //, true);
                sNombreArchivo = oDocSC.t697_nombrearchivo;
                t2_iddocumento = oDocSC.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oDocSC.t697_archivo;
                break;

            case "CVTEXAMEN":     //CURVIT EXAMEN
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    Examen oDocCVTE = Examen.SelectDoc(null, int.Parse(sIDDOC[0].ToString()), int.Parse(sIDDOC[1].ToString()));
                    sNombreArchivo = oDocCVTE.T591_NDOC;
                    //ArchivoBinario = oDocCVTE.T591_DOC;
                    t2_iddocumento = oDocCVTE.t2_iddocumento;
                    //if (t2_iddocumento == null) ArchivoBinario = oDocCVTE.T591_DOC;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "CVTEXAMEN2":     //DESDE VARIABLE DE SESIÓN. NO ESTÁ AÚN GRABADO...
                sNombreArchivo = sIDDOC[1];
                ArchivoBinario = (byte[])Session[Utilidades.decodpar(sIDDOC[0])];
                break;

            case "CVTCERT":     //CURVIT CERTIFICADO
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    Certificado oDocCVTC = Certificado.SelectDoc(null, int.Parse(sIDDOC[0].ToString()), int.Parse(sIDDOC[1].ToString()));
                    sNombreArchivo = oDocCVTC.T593_NDOC;
                    //ArchivoBinario = oDocCVTC.T593_DOC;
                    t2_iddocumento = oDocCVTC.t2_iddocumento;
                    //if (t2_iddocumento == null) ArchivoBinario = oDocCVTC.T593_DOC;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "TIF":     //CURVIT TITULO IDIOMA FICEPI
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    TituloIdiomaFic o = TituloIdiomaFic.SelectDoc(null, int.Parse(sIDDOC[0].ToString()));
                    sNombreArchivo = o.T021_NDOC;
                    t2_iddocumento = o.t2_iddocumento;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "CVTCUR":     //CURVIT CURSO RECIBIDOS
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    Curso oCurso = Curso.SelectDoc(null, int.Parse(sIDDOC[0].ToString()), int.Parse(sIDDOC[1].ToString()));
                    sNombreArchivo = oCurso.T575_NDOC;
                    //ArchivoBinario = oCurso.T575_DOC;
                    t2_iddocumento = oCurso.t2_iddocumento;
                    //if (t2_iddocumento == null) ArchivoBinario = oCurso.T575_DOC;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "CVTCUR_IMP":     //CURVIT CURSO IMPARTIDOS
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    Curso oCursoImp = Curso.SelectDoc2(null, int.Parse(sIDDOC[0].ToString()), int.Parse(sIDDOC[1].ToString()));
                    sNombreArchivo = oCursoImp.T580_NDOC;
                    //ArchivoBinario = oCursoImp.T580_DOC;
                    t2_iddocumento = oCursoImp.t2_iddocumento;
                    //if (t2_iddocumento == null) ArchivoBinario = oCursoImp.T580_DOC;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "CVTDOCTIT":     //CURVIT TITULACION DOCUMENTO TITULO
                Titulacion oTitulo = Titulacion.SelectDoc(null, nIDDOC, "Tit");
                sNombreArchivo = oTitulo.NDOC;
                //ArchivoBinario = oTitulo.DOC;
                t2_iddocumento = oTitulo.t2_iddocumento;
                //if (t2_iddocumento == null) ArchivoBinario = oTitulo.DOC;
                break;

            case "CVTDOCEX":     //CURVIT TITULACION DOCUMENTO EXPEDIENTE
                Titulacion oTitulo1 = Titulacion.SelectDoc(null, nIDDOC, "Ex");
                sNombreArchivo = oTitulo1.NDOC;
                //ArchivoBinario = oTitulo1.DOC;
                t2_iddocumento = oTitulo1.t2_iddocumentoExpte;
                //if (t2_iddocumento == null) ArchivoBinario = oTitulo1.DOC;
                break;

            case "TAD":     //CURVIT TITULO FICEPI
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    TituloFicepi o = TituloFicepi.Select(int.Parse(sIDDOC[0].ToString()));
                    sNombreArchivo = o.T012_NDOCTITULO;
                    t2_iddocumento = o.t2_iddocumento;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;

            case "TAE":     //CURVIT Expediente TITULO FICEPI
                if (Utilidades.isNumeric(sIDDOC[0].ToString()))
                {
                    TituloFicepi o = TituloFicepi.Select(int.Parse(sIDDOC[0].ToString()));
                    sNombreArchivo = o.T012_NDOCEXPDTE;
                    t2_iddocumento = o.t2_iddocumentoExpte;
                }
                else
                {
                    SUPER.DAL.DocuAux oDoc = SUPER.DAL.DocuAux.GetDocumento(null, sIDDOC[0].ToString());
                    sNombreArchivo = oDoc.t686_nombre;
                    t2_iddocumento = oDoc.t2_iddocumento;
                }
                break;
            }
            #endregion

            if (t2_iddocumento != null)
            {
                ArchivoBinario = IB.Conserva.ConservaHelper.ObtenerDocumento((long)t2_iddocumento).content;
            }

            Response.AddHeader("Content-Disposition", "attachment; filename=\"" + sNombreArchivo + "\"");
            if (HttpContext.Current.Request.Browser.Browser.ToString() == "Chrome")
            {
                Response.AddHeader("Content-Length", "999999999999");
            }
            Response.BinaryWrite(ArchivoBinario);

            if (Response.IsClientConnected)
            {
                Response.Flush();
            }
        }
        catch (ConservaException cex)
        {
            this.hdnError.Value = Utilidades.MsgErrorConserva("R", cex);
        }
        //catch (System.Web.HttpException hexc)
        //{
        //}
        catch (Exception ex)
        {
            this.hdnError.Value = "No se ha podido obtener el archivo.<br /><br />Error: " + ex.Message;
            if (ex.InnerException != null)
            {
                this.hdnError.Value += "<br />Detalle error: " + ex.InnerException.Message;
            }
        }
        //Response.Flush();
        finally
        {
            if (this.hdnError.Value == "")
            {
                Response.Close();
                //Response.End();
            }
        }
    }
    public void RaiseCallbackEvent(string eventArg)
    {
        string sResultado = "";

        //1º Si hubiera argumentos, se recogen y tratan.
        //string MisArg = eventArg;
        string[] aArgs = Regex.Split(eventArg, @"@#@");
        sResultado = aArgs[0] + @"@#@"; if (Session["IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;

        try
        {
            //2º Aquí realizaríamos el acceso a BD, etc,...
            switch (aArgs[0])
            {
            case ("cargarFormacionAcad"):
                sResultado += "OK@#@" + TituloFicepi.MiCvTitulacion(int.Parse(hdnIdficepi.Value)) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarCursos"):
                sResultado += "OK@#@" + Curso.MiCVFormacionRecibida(int.Parse(hdnIdficepi.Value)) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarCursosImpartidos"):
                sResultado += "OK@#@" + Curso.MiCVFormacionImpartida(int.Parse(hdnIdficepi.Value)) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarCertExam"):
            case ("reCargarCertExam"):
                sResultado += "OK@#@" + Certificado.MiCVFormacionCertExam(int.Parse(hdnIdficepi.Value), (hdnEsEncargado.Value == "1") ? true : false) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarExam"):
            case ("reCargarExam"):
                //sResultado += "OK@#@" + Certificado.MiCVFormacionExam(int.Parse(hdnIdficepi.Value), (hdnEsEncargado.Value == "1") ? true : false) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                sResultado += "OK@#@" + Examen.MiCVFormacionExam(int.Parse(hdnIdficepi.Value)) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarIdiomas"):
                sResultado += "OK@#@" + Idioma.MiCvIdiomas(int.Parse(hdnIdficepi.Value)) + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarTitulos"):
                sResultado += "OK@#@" + TituloIdiomaFic.MiCVCatalogo(int.Parse(hdnIdficepi.Value), int.Parse(aArgs[2])) + "@#@" + aArgs[1] + "@#@" + Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarExpIb"):
                sResultado += "OK@#@" + SUPER.BLL.EXPPROF.MiCVExpProfEnIbermatica(int.Parse(hdnIdficepi.Value)) + "@#@" +
                              Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("cargarExpNoIb"):
                sResultado += "OK@#@" + SUPER.BLL.EXPPROF.MiCVExpProfFueraIbermatica(int.Parse(hdnIdficepi.Value)) + "@#@" +
                              Curriculum.MiCVPendientes(int.Parse(hdnIdficepi.Value)).ToString();
                break;

            case ("grabar"):
                Curriculum.Grabar(null, aArgs[1], int.Parse(hdnIdficepi.Value), (aArgs[3] == "") ? null : (bool?)bool.Parse(aArgs[3].ToString()), (aArgs[2] == "") ? null : (int?)int.Parse(aArgs[2]), aArgs[4].ToString());
                sResultado += "OK@#@";
                break;

            case ("borrarForAcad"):
                sResultado += TituloFicepi.Borrar(aArgs[1], int.Parse(hdnIdficepi.Value), int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarForRec"):
                sResultado += Curso.BorrarAsistente(int.Parse(aArgs[1]), aArgs[2], int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarForImp"):
                sResultado += Curso.BorrarMonitor(aArgs[1], int.Parse(hdnIdficepi.Value), int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarCertif"):
                //if (SUPER.BLL.Certificado.TieneExamenesValidados(int.Parse(aArgs[1]), aArgs[2]))
                //    sResultado +="KO@#@S";
                //else
                sResultado += Certificado.BorrarAsistente(aArgs[1], int.Parse(aArgs[2]), aArgs[3], int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarIdioma"):
                sResultado += IdiomaFic.Borrar(int.Parse(aArgs[1]), aArgs[2], int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarExamen"):
                sResultado += SUPER.BLL.Examen.BorrarAsistentes(int.Parse(aArgs[1]), aArgs[2], int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("borrarExpIber"):
            case ("borrarExpNoIber"):
                sResultado += SUPER.BLL.EXPPROF.Borrar(aArgs[2], int.Parse(aArgs[1]), int.Parse(Session["IDFICEPI_ENTRADA"].ToString()));
                break;

            case ("FinCV"):
                sResultado += Curriculum.FinalizacionCv(int.Parse(aArgs[1]), Utilidades.unescape(aArgs[2]), aArgs[3]);
                break;

            case ("setCompletadoProf"):
                sResultado += Curriculum.setCompletadoProf(int.Parse(aArgs[1]));
                break;

            case ("setRevisadoActualizadoCV"):
                sResultado += Curriculum.setRevisadoActualizadoCV(int.Parse(aArgs[1]));
                break;

            case ("cargarSinopsis"):
                sResultado += "OK@#@" + Curriculum.getSinopsis(int.Parse(hdnIdficepi.Value));
                break;

            case ("grabarS"):    //grabar sinopsis
                Curriculum.GrabarSinopsis(int.Parse(hdnIdficepi.Value), aArgs[1]);
                sResultado += "OK";
                break;
            }
        }
        catch (Exception ex)
        {
            sResultado += "Error@#@" + Errores.mostrarError("Error al cargar datos", ex);
        }
        //3º Damos contenido a la variable que se envía de vuelta al cliente.
        _callbackResultado = sResultado;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false);
        string cbLlamada   = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}";

        //2º Se "registra" la función que va a acceder al servidor.
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true);
        try
        {
            //ficepi=" + ficepi + "&idioma=" + idioma + "&usuticks" + sIDDocuAux + "&idtitulo" + idtitulo;
            if (!Page.IsCallback)
            {
                if (Session["IDRED"] == null)
                {
                    try
                    {
                        Response.Redirect("~/SesionCaducadaModal.aspx", true);
                    }
                    catch (System.Threading.ThreadAbortException) { return; }
                }

                Utilidades.SetEventosFecha(this.txtFecha);

                if (!Page.IsPostBack)
                {
                    this.hdnIdFicepi.Value = Utilidades.decodpar(Request.QueryString["iF"]);
                    this.hdnUserAct.Value  = Session["IDFICEPI_CVT_ACTUAL"].ToString();

                    sIDDocuAux = "SUPER-" + this.hdnUserAct.Value + "-" + DateTime.Now.Ticks.ToString();

                    //Compruebo si estoy en mi propio curriculum
                    if (this.hdnIdFicepi.Value == this.hdnUserAct.Value)
                    {
                        this.hdnEsMiCV.Value = "S";
                    }

                    if (Request.QueryString["eA"] != null)
                    {
                        hdnEsEncargado.Value = Utilidades.decodpar(Request.QueryString["eA"]);
                    }
                    if (Request.QueryString["iT"] != "")
                    {
                        hdnIdTitulo.Value = Utilidades.decodpar(Request.QueryString["iT"]);
                    }
                    if (Request.QueryString["pantalla"] != "")
                    {
                        hdnPantalla.Value = Utilidades.decodpar(Request.QueryString["pantalla"]);
                    }
                    if (Request.QueryString["iI"] != "")
                    {
                        hdnIdCodIdioma.Value = Utilidades.decodpar(Request.QueryString["iI"]);
                    }
                    if (Request.QueryString["dI"] != "" && Request.QueryString["dI"] != null)
                    {
                        txtIdioma.InnerText = Utilidades.decodpar(Request.QueryString["dI"]);
                    }

                    if (hdnIdTitulo.Value != "" && hdnIdTitulo.Value != "-1")
                    {//Titulo ya existente
                        CargarDatos(TituloIdiomaFic.Detalle(int.Parse(hdnIdTitulo.Value)));
                        //deshabilitarUsuario();
                    }
                    switch (hdnEstadoInicial.Value)
                    {
                    case "S":     //Pte. cumplimentar (origen ECV)
                    case "T":     //Pte. cumplimentar (origen Validador)
                        imgEstado.ImageUrl = "~/Images/imgEstadoCVTPenCumplimentar.png";
                        break;

                    case "O":     //Pte. validar (origen ECV)
                    case "P":     //Pte. validar (origen Validador)
                        //imgEstado.ImageUrl = "~/Images/imgEstadoCVTPenValidar.png";
                        imgEstado.ImageUrl = "~/Images/imgSeparador.gif";
                        break;

                    case "Y":     //Pseudovalidado (origen ECV)
                    case "X":     //Pseudovalidado (origen Validador)
                        imgEstado.ImageUrl = "~/Images/imgEstadoCVTPseudovalidado.png";
                        break;

                    case "B":     //Borrador
                        imgEstado.ImageUrl = "~/Images/imgEstadoCVTBorrador.png";
                        //imgHistorial.Style.Add("visibility", "hidden");
                        break;

                    case "R":     //No Interesante
                        //imgEstado.ImageUrl = "~/Images/imgEstadoCVTNoInteresante.png";
                        imgEstado.ImageUrl = "~/Images/imgSeparador.gif";
                        break;

                    case "V":     //Validado
                        //imgEstado.ImageUrl = "~/Images/imgEstadoCVTValidado.png";
                        imgEstado.ImageUrl = "~/Images/imgSeparador.gif";
                        break;
                    }
                    if (hdnEsEncargado.Value == "1")
                    {
                        omitirObligParaAdmin();
                    }

                    bool bEsValidador = false;
                    if (Request.QueryString["v"] != null)
                    {
                        if (Request.QueryString["v"] == "1")
                        {
                            bEsValidador = true;
                        }
                        else
                        {
                            bEsValidador = false;
                        }
                    }

                    bool      bEstaDeBaja = SUPER.BLL.Profesional.EstaDeBaja(int.Parse(hdnIdFicepi.Value));
                    ArrayList aBotones    =
                        Curriculum.getBotonesAMostrar(hdnEstadoInicial.Value,
                                                      (this.hdnEsMiCV.Value == "S") ? true : false,
                                                      bEsValidador, false);

                    for (int i = 0; i < aBotones.Count; i++)
                    {
                        switch ((int)aBotones[i])
                        {
                        //case (int)CVT.Accion.Aparcar: btnAparcar.Style.Add("display", "inline-block"); break;
                        case (int)CVT.Accion.Enviar: btnEnviar.Style.Add("display", "inline-block"); break;

                        case (int)CVT.Accion.Cumplimentar: if (!bEstaDeBaja)
                            {
                                btnCumplimentar.Style.Add("display", "inline-block");
                            }
                            break;

                        case (int)CVT.Accion.Validar: btnValidar.Style.Add("display", "inline-block"); break;

                        case (int)CVT.Accion.Pseudovalidar: if (!bEstaDeBaja)
                            {
                                btnPseudovalidar.Style.Add("display", "inline-block");
                            }
                            break;

                        case (int)CVT.Accion.Rechazar: btnRechazar.Style.Add("display", "inline-block"); break;
                        }
                    }
                }
                if (User.IsInRole("DIS") || ConfigurationManager.AppSettings["MOSTRAR_SOLODIS"] == "0")
                {
                    sTareasPendientes = Curriculum.MiCVTareasPendientes(7, int.Parse(hdnIdFicepi.Value), (hdnIdTitulo.Value == "-1") ? 0 : int.Parse(this.hdnIdTitulo.Value), null);
                }
                //Compruebo si en el historial la última acción fué enviar a cumplimentar, en cuyo caso cargo el mensaje
                //que el validador le quiere hacer llegar al profesional
                this.hdnMsgCumplimentar.Value = SUPER.BLL.Historial.GetMsgPdteValidar("TITIDIOMAFICCRONO", int.Parse(hdnIdFicepi.Value),
                                                                                      (this.hdnIdTitulo.Value == "") ? -1 : int.Parse(this.hdnIdTitulo.Value));
            }
        }
        catch (Exception ex)
        {
            hdnErrores.Value = Errores.mostrarError("Error al cargar la pagina", ex);
        }
    }