protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            try
            {
                if (Session["IDRED"] == null)
                {
                    try
                    {
                        Response.Redirect("~/SesionCaducadaModal.aspx", true);
                    }
                    catch (System.Threading.ThreadAbortException) { return; }
                }
                // Leer Empresa

                if (Request.QueryString["unidad"] != "")
                {
                    txtCodigo.Text = Utilidades.decodpar(Request.QueryString["unidad"].ToString());
                    short idUnidad = short.Parse(txtCodigo.Text);
                    if (idUnidad <= 0)
                    {
                        txtDenominacion.ReadOnly = true;
                    }
                    IB.SUPER.ADM.SIC.Models.UnidadPreventa oElem   = new IB.SUPER.ADM.SIC.Models.UnidadPreventa();
                    IB.SUPER.ADM.SIC.BLL.UnidadPreventa    oUnidad = new IB.SUPER.ADM.SIC.BLL.UnidadPreventa();

                    oElem = oUnidad.Select(idUnidad);
                    //PreventaUnidad oUnidad = PreventaUnidad.Select(null, short.Parse(txtCodigo.Text));
                    if (oElem.ta199_denominacion == "")
                    {
                        throw (new Exception("Unidad de preventa no existente."));
                    }
                    txtDenominacion.Text = oElem.ta199_denominacion;

                    if (oElem.ta199_estadoactiva)
                    {
                        chkActiva.Checked = true;
                    }
                    else
                    {
                        chkActiva.Checked = false;
                    }

                    oUnidad.Dispose();
                }
            }
            catch (Exception ex)
            {
                sErrores += SUPER.Capa_Negocio.Errores.mostrarError("Error al obtener los datos de la unidad de preventa", 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);
        }
    }
Beispiel #2
0
    private void CargarUnidad(short idUnidad)
    {
        IB.SUPER.ADM.SIC.Models.UnidadPreventa oUnidad = new IB.SUPER.ADM.SIC.Models.UnidadPreventa();
        IB.SUPER.ADM.SIC.BLL.UnidadPreventa    oElem   = new IB.SUPER.ADM.SIC.BLL.UnidadPreventa();
        oUnidad = oElem.Select(idUnidad);
        //PreventaUnidad oUnidad = PreventaUnidad.Select(tr, idUnidad);
        txtUnidad.Text   = oUnidad.ta199_denominacion;
        hdnIdUnidad.Text = oUnidad.ta199_idunidadpreventa.ToString();

        oElem.Dispose();
    }