Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["lgn_id"] == null)
        {
            Session.Clear();
            string myScript = ConfigurationManager.AppSettings["URL_LOGIN"];
            String lsScript = "parent.document.location.href = '" + myScript + "/default.aspx?acc=SES';";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", lsScript, true);
        }
        else
        {
            CargaCombos();
            if (!IsPostBack)
            {
                string json = new System.IO.StreamReader(Request.InputStream).ReadToEnd();

                Dictionary <string, string> dataJSON = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

                if (dataJSON != null)
                {
                    GrupoDetalleBean obj = GrupoDetalleController.Get(new GrupoDetalleBean {
                        IdGrupoDetalle = int.Parse(dataJSON["codigo"].ToString())
                    });
                    myModalLabel.InnerText = "Editar " + Model.bean.IdiomaCultura.getMensaje(Model.bean.IdiomaCultura.WEB_GENERAL);

                    hdIdGrupoDetalle.Value  = obj.IdGrupoDetalle.ToString();
                    MtxtCodigo.Value        = obj.Codigo;
                    MtxtNombre.Value        = obj.Nombre;
                    MddlGrupo.SelectedValue = obj.IdGrupo.ToString();

                    MtxtCodigo.Disabled = true;
                    MddlGrupo.Enabled   = false;
                }
                else
                {
                    myModalLabel.InnerText = "Crear " + Model.bean.IdiomaCultura.getMensaje(Model.bean.IdiomaCultura.WEB_GENERAL);
                }
            }
        }
    }