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; } // // si llega aquí está autorizado permiso = CntLainsaSci.GetPermiso(Usuario.GrupoUsuario, "dispositivogrid", 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; // Si esto no va antes de ResumenRevisionID tendrás problemas. if (Request.QueryString["Caller"] != null) { caller = Request.QueryString["Caller"]; caller = caller.Replace("'", ""); } // Is it a new record or not? if (Request.QueryString["ResumenRevisionId"] != null) { resumenRevision = CntLainsaSci.GetResumenRevision(int.Parse(Request.QueryString["ResumenRevisionId"]), ctx); LoadData(resumenRevision); if (CntLainsaSci.HayRevisionesHechas(resumenRevision, ctx)) { rdtFechaUltima.Enabled = false; } newRecord = false; } // control de skin if (Session["Skin"] != null) { RadSkinManager1.Skin = Session["Skin"].ToString(); } }
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)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]]; } switch (imgb.ID) { case "Select": break; case "Edit": break; case "Delete": try { ResumenRevision ResumenRevision = CntLainsaSci.GetResumenRevision(id, ctx); CntLainsaSci.CTXEliminar(ResumenRevision, ctx); CntLainsaSci.CTXGuardar(ctx); RefreshGrid(true); } catch (Exception ex) { ControlDeError(ex); } break; } } }