コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["GVT_IDRED"] == null)
         {
             try
             {
                 Response.Redirect("~/SesionCaducadaModal.aspx", true);
             }
             catch (System.Threading.ThreadAbortException) { return; }
         }
         if (Request.QueryString.Get("sf") != null)
         {
             this.strTablaHTML = NuevoBonoTransporte.obtenerBonos(
                 Utilidades.decodpar(Request.QueryString.Get("su").ToString()),
                 Utilidades.decodpar(Request.QueryString.Get("sf").ToString()));
         }
     }
     catch (Exception ex)
     {
         sErrores += Errores.mostrarError("Error al obtener los bonos de transporte.", ex);
     }
 }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            Master.bFuncionesLocales = true;

            Master.FuncionesJavaScript.Add("Javascript/fechas.js");
            Master.FuncionesJavaScript.Add("Javascript/boxover.js");
            Master.FicherosCSS.Add("Capa_Presentacion/BonoTransporte/css/BonoTransporte.css");

            Master.Botonera.ItemClick += new ToolBarEventHandler(this.Botonera_Click);

            if (Request.QueryString["se"] != null)
            {
                sEstado = Utilidades.decodpar(Request.QueryString["se"].ToString());
            }
            if (Request.QueryString["so"] != null)
            {
                sOrigen = Utilidades.decodpar(Request.QueryString["so"].ToString());
            }
            if (Request.QueryString.Get("ni") != null)
            {
                nID = int.Parse(Utilidades.decodpar(Request.QueryString.Get("ni").ToString()));
            }

            lblBeneficiario.InnerText = (Session["GVT_SEXO"].ToString() == "V") ? "Beneficiario" : "Beneficiaria";
            cboEmpresa.Style.Add("display", "none");

            switch (sOrigen)
            {
            case "":
                switch (sEstado)
                {
                case "A":        // Aprobada
                case "C":        // Contabilizada
                case "L":        // Aceptada
                case "N":        // Notificada
                case "S":        // Pagada
                case "X":        // Anulada
                    Master.nBotonera    = 8;
                    bLectura            = true;
                    Master.TituloPagina = "Detalle de bono de transporte";
                    imgAM.Style.Add("display", "none");
                    imgSM.Style.Add("display", "none");
                    break;

                case "B":        // No aprobada
                case "O":        // No aceptada
                //case "P":// Aparcada
                case "R":        // Recuperada
                    Master.nBotonera    = 6;
                    Master.TituloPagina = "Detalle de bono de transporte";
                    break;

                case "T":        // Tramitada
                    Master.nBotonera    = 5;
                    bLectura            = true;
                    Master.TituloPagina = "Detalle de bono de transporte";
                    imgAM.Style.Add("display", "none");
                    imgSM.Style.Add("display", "none");
                    break;

                default:
                    Master.nBotonera    = 11;
                    Master.TituloPagina = "Nuevo bono de transporte";
                    break;
                }
                break;

            case "APROBAR":
                bLectura         = true;
                Master.nBotonera = 13;
                imgAM.Style.Add("display", "none");
                imgSM.Style.Add("display", "none");
                break;

            case "ACEPTAR":
                bLectura         = true;
                Master.nBotonera = 15;
                imgAM.Style.Add("display", "none");
                imgSM.Style.Add("display", "none");
                //paddingLeft = "3px";
                DIALIMITECONTABILIZACIONGV oDL = DIALIMITECONTABILIZACIONGV.Obtener();
                sDiaLimiteContAnoAnterior = oDL.t670_dialimitecontanoanterior.ToString();
                sDiaLimiteContMesAnterior = oDL.t670_dialimitecontmesanterior.ToString();
                break;

            case "CONSULTA":
                bLectura         = true;
                Master.nBotonera = 8;
                break;
            }

            if (sEstado == "T" || sEstado == "N" || sEstado == "A")
            {
                imgManoVisador.Style.Add("visibility", "visible");
                if (sEstado == "T")
                {
                    imgManoVisador.ToolTip = "Muestra quien o quienes han de aprobar la solicitud.";
                }
                else
                {
                    imgManoVisador.ToolTip = "Muestra quien o quienes han de aceptar la solicitud.";
                }
            }

            if (!Page.IsPostBack)
            {
                try
                {
                    //obtenerMonedas();

                    if (nID == 0 || Request.QueryString.Get("ni") == null)
                    {
                        string   sDatosIniciales = NuevoBonoTransporte.obtenerDatosIniciales(Session["GVT_USUARIOSUPER"].ToString(), Fechas.FechaAAnnomes(DateTime.Today).ToString());
                        string[] aDatosIniciales = null;
                        if (sDatosIniciales != "")
                        {
                            aDatosIniciales = Regex.Split(sDatosIniciales, "#sFin#");
                            if (aDatosIniciales.Length == 1)
                            {
                                string[] aElem = Regex.Split(aDatosIniciales[0], "#sCad#");
                                hdnIdBono.Text      = aElem[0];
                                txtBono.Text        = aElem[1];
                                txtImporte.Text     = decimal.Parse(aElem[2]).ToString("N");
                                hdnImporte.Text     = aElem[2];
                                lblMoneda.InnerText = aElem[5];
                                lblMoneda.Attributes.Add("title", "cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../images/info.gif' style='vertical-align:middle' /> Moneda] body=[" + aElem[6] + "] hideselects=[off]");
                                hdnMoneda.Text            = aElem[5];
                                hdnIdProyectoSubNodo.Text = aElem[3];
                                hdnInteresado.Text        = aElem[4];
                                txtProyecto.Text          = aElem[7] + " - " + aElem[8];
                            }
                        }
                    }
                    else
                    { //if (Request.QueryString.Get("ni") != null)
                        txtReferencia.Text = nID.ToString();
                    }
                    if (bLectura)
                    {
                        ModoLectura.Poner(this.Controls);
                    }
                    ObtenerDatosCabeceraBono(nID);
                }
                catch (Exception ex)
                {
                    Master.sErrores = Errores.mostrarError("Error al cargar los datos ", ex);
                }
            }
        }
        //1º Se indican (por este orden) la función a la que se va a devolver el resultado
        //   y la función que va a acceder al servidor
        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);
    }
コード例 #3
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["GVT_IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;

        //2º Aquí realizaríamos el acceso a BD, etc,...
        switch (aArgs[0])
        {
        case ("tramitar"):
            try
            {
                sResultado += "OK@#@" + NuevoBonoTransporte.TramitarBono(aArgs[1], aArgs[2], aArgs[3], aArgs[4], aArgs[5], aArgs[6],
                                                                         aArgs[7], aArgs[8], aArgs[9], aArgs[10], aArgs[11], aArgs[12]);
            }
            catch (Exception ex)
            {
                //sResultado += "Error@#@" + Errores.mostrarError("Error al tramitar el bono de transporte.", ex);
                string[] aMsg = Regex.Split(ex.Message, "##EC##");

                if (aMsg[0] == "ErrorControlado")
                {
                    sResultado += "Error@#@" + aMsg[1];
                }
                else
                {
                    sResultado += "Error@#@" + Errores.mostrarError("Error al tramitar el bono de transporte.", ex);
                }
            }
            break;

        case ("bono"):
            try
            {
                sResultado += "OK@#@" + NuevoBonoTransporte.obtenerDatosIniciales(aArgs[3], aArgs[1]) + "@#@" + NuevoBonoTransporte.obtenerCabeceraGVBono(aArgs[2], aArgs[3], aArgs[1].Substring(aArgs[1].Length - 2, 2));
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener los datos de los bonos.", ex);
            }
            break;

        case ("getOtrosDatos"):
            try
            {
                sResultado += "OK@#@" + NuevoBonoTransporte.ObtenerHistorial(aArgs[2]) + "///" + NuevoBonoTransporte.obtenerCabeceraGVBono(aArgs[2], aArgs[3], aArgs[1]);
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener el historial.", ex);
            }
            break;

        case ("aprobar"):
            try
            {
                CABECERAGV.Aprobar(aArgs[1]);
                sResultado += "OK@#@";
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al aprobar la solicitud.", ex);
            }
            break;

        case ("noaprobar"):
            try
            {
                sResultado += "OK@#@" + CABECERAGV.NoAprobar(int.Parse(aArgs[1]), aArgs[2]).ToString();
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al no aprobar la solicitud estándar.", ex);
            }
            break;

        case ("aceptar"):
            try
            {
                CABECERAGV.Aceptar(aArgs[1]);
                sResultado += "OK@#@";
            }
            catch (Exception ex)
            {
                //sResultado += "Error@#@" + Errores.mostrarError("Error al aceptar la solicitud.", ex);
                string[] aMsg = Regex.Split(ex.Message, "##EC##");

                if (aMsg[0] == "ErrorControlado")
                {
                    sResultado += "Error@#@" + aMsg[1];
                }
                else
                {
                    sResultado += "Error@#@" + Errores.mostrarError("Error al aceptar la solicitud.", ex);
                }
            }
            break;

        case ("noaceptar"):
            try
            {
                sResultado += "OK@#@" + CABECERAGV.NoAceptar(int.Parse(aArgs[1]), aArgs[2]).ToString();
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al no aceptar la solicitud estándar.", ex);
            }
            break;

        case ("anular"):
            try
            {
                sResultado += "OK@#@" + CABECERAGV.Anular(int.Parse(aArgs[1]), aArgs[2]).ToString();
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al anular la solicitud estándar.", ex);
            }
            break;

        case ("getHistoria"):
            try
            {
                sResultado += "OK@#@" + CABECERAGV.ObtenerHistorial(int.Parse(aArgs[1]));
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener el historial.", ex);
            }
            break;

        case ("getDatosBeneficiario"):
            try
            {
                sResultado += "OK@#@" + ObtenerDatosBeneficiario(int.Parse(aArgs[1]));
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener los datos del beneficiario.", ex);
            }
            break;

        case ("getCCMotivo"):
            try
            {
                sResultado += "OK@#@" + CABECERAGV.ObtenerCentroCosteMotivo(aArgs[1], aArgs[2], aArgs[3]);
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener los datos del beneficiario.", ex);
            }
            break;
        }

        //3º Damos contenido a la variable que se envía de vuelta al cliente.
        _callbackResultado = sResultado;
    }