protected void btnAccept_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         if (!DataOk())
         {
             return;
         }
         if (newRecord)
         {
             categoria = new GrupoMensajes();
         }
         UnloadData(categoria);
         if (newRecord)
         {
             ctx.Add(categoria);
         }
         ctx.SaveChanges();
         if (newRecord)
         {
             RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'new');", caller));
         }
         else
         {
             RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'edit');", caller));
         }
     }
     catch (Exception ex)
     {
         ControlDeError(ex);
     }
 }
示例#2
0
 string caller = ""; // who's calling the grid form
 #endregion
 #region Init, load, unload events
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     uex = CntLainsaSci.GetUsuarioExtranet((int)Session["UsuarioExtranetId"], ctx);
     if (uex == null)
     {
         Response.Redirect("Default.aspx");
     }
     //
     CntWinWeb.TranslateRadGridFilters(RadGrid1);
     if (Request.QueryString["Mode"] != null)
     {
         mode = Request.QueryString["Mode"];
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["GrupoMensajesId"] != null)
     {
         grupoMensajes = CntLainsaSci.GetGrupoMensajes(int.Parse(Request.QueryString["GrupoMensajesId"]), ctx);
         if (grupoMensajes != null)
         {
             //RadGrid1.Columns.FindByDataField("GrupoMensajes.Nombre").Visible = false;
         }
     }
 }
示例#3
0
 protected void CargaGrupoMensajes(GrupoMensajes gm)
 {
     if (gm == null)
     {
         return;
     }
     rdcGrupoMensajes.Items.Clear();
     rdcGrupoMensajes.Items.Add(new RadComboBoxItem(gm.Nombre, gm.GrupoMensajesId.ToString()));
     rdcGrupoMensajes.SelectedValue = gm.GrupoMensajesId.ToString();
     rdcGrupoMensajes.Enabled       = false;
 }
示例#4
0
 string caller = ""; // who's calling the grid form
 #endregion
 #region Init, load, unload events
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     Usuario = CntWinWeb.IsSomeoneLogged(this, ctx);
     if (Usuario == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         Session["UsuarioId"] = Usuario.UsuarioId;
     }
     //
     permiso = CntLainsaSci.GetPermiso(Usuario.GrupoUsuario, "Subcategoriagrid", ctx);
     if (permiso == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "NoPermissionsAssigned"));
         RadNotification1.Show();
         RadAjaxManager1.ResponseScripts.Add("closeWindow();");
     }
     CntWinWeb.TranslateRadGridFilters(RadGrid1);
     if (Request.QueryString["Mode"] != null)
     {
         mode = Request.QueryString["Mode"];
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["GrupoMensajesId"] != null)
     {
         grupoMensajes = CntLainsaSci.GetGrupoMensajes(int.Parse(Request.QueryString["GrupoMensajesId"]), ctx);
         if (grupoMensajes != null)
         {
             RadGrid1.Columns.FindByDataField("GrupoMensajes.Nombre").Visible = false;
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     usuario = CntWinWeb.IsSomeoneLogged(this, ctx);
     if (usuario == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         Session["UsuarioId"] = usuario.UsuarioId;
     }
     //
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "categoriagrid", ctx);
     if (permiso == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "NoPermissionsAssigned"));
         RadNotification1.Show();
         RadAjaxManager1.ResponseScripts.Add("closeWindow();");
     }
     btnAccept.Visible = permiso.Modificar;
     // load the combo
     // Is it a new record or not?
     if (Request.QueryString["GrupoMensajesId"] != null)
     {
         categoria = CntLainsaSci.GetGrupoMensajes(int.Parse(Request.QueryString["GrupoMensajesId"]), ctx);
         LoadData(categoria);
         newRecord = false;
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
示例#6
0
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        // we only process commands with a datasource (our image buttons)
        if (e.CommandSource == null)
        {
            return;
        }
        string typeOfControl = e.CommandSource.GetType().ToString();

        if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton"))
        {
            int         id   = 0;
            ImageButton imgb = (ImageButton)e.CommandSource;
            if (imgb.ID != "New" && imgb.ID != "Exit")
            {
                id = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]].ToString());
            }
            switch (imgb.ID)
            {
            case "Select":
                break;

            case "Edit":
                break;

            case "Delete":
                try
                {
                    GrupoMensajes p = CntLainsaSci.GetGrupoMensajes(id, ctx);
                    CntLainsaSci.CTXEliminar(p, ctx);
                    CntLainsaSci.CTXGuardar(ctx);
                    RefreshGrid(true);
                }
                catch (Exception ex)
                {
                    ControlDeError(ex);
                }
                break;
            }
        }
    }
 protected void UnloadData(GrupoMensajes GrupoMensajes)
 {
     GrupoMensajes.Nombre = txtNombre.Text;
 }
 protected void LoadData(GrupoMensajes GrupoMensajes)
 {
     txtNombre.Text = GrupoMensajes.Nombre;
 }