Exemplo n.º 1
0
 protected void ChekPermissions(GrupoUsuario gu, RadMenuItemCollection col)
 {
     foreach (RadMenuItem i in col)
     {
         Proceso proceso = CntLainsaSci.GetProceso(i.Value, ctx);
         if (proceso != null)
         {
             Permiso permiso = CntLainsaSci.GetPermiso(gu, proceso, ctx);
             if (permiso != null)
             {
                 if (!permiso.Ver)
                 {
                     i.Visible = false;
                 }
             }
             else
             {
                 i.Visible = false;  // If no permission not show
             }
         }
         else
         {
             i.Visible = false;  // If doesn't exits not show
         }
         // recursive call if there are submenus or items in it
         if (i.Items.Count > 0)
         {
             ChekPermissions(gu, i.Items);
         }
     }
 }
Exemplo n.º 2
0
 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;
     }
     // Is it a new record or not?
     if (Request.QueryString["PermisoId"] != null)
     {
         permiso = CntLainsaSci.GetPermiso(int.Parse(Request.QueryString["PermisoId"]), ctx);
         LoadData(permiso);
         newRecord = false;
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["GrupoUsuarioId"] != null)
     {
         grupoUsuario = CntLainsaSci.GetGrupoUsuario(int.Parse(Request.QueryString["GrupoUsuarioId"]), ctx);
     }
     if (Request.QueryString["Nombre"] != null)
     {
         proceso = CntLainsaSci.GetProceso(Request.QueryString["Nombre"].ToString(), ctx);
     }
 }
Exemplo n.º 3
0
 protected void UnloadData(Proceso Proceso)
 {
     Proceso.Nombre      = txtNombre.Text;
     proceso.Descripcion = txtDescripcion.Text;
     // ProcesoPadre de Proceso asociado
     if (rdcProcesoPadre.SelectedValue != "")
     {
         Proceso.ProcesoPadre = CntLainsaSci.GetProceso(rdcProcesoPadre.SelectedValue.ToString(), ctx);
     }
 }
Exemplo n.º 4
0
 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, "grupousuariogrid", 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
     LoadProcesoPadreCombo();
     // Is it a new record or not?
     if (Request.QueryString["Nombre"] != null)
     {
         proceso = CntLainsaSci.GetProceso(Request.QueryString["Nombre"].ToString(), ctx);
         LoadData(proceso);
         newRecord = false;
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
Exemplo n.º 5
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"))
        {
            string      id   = "";
            ImageButton imgb = (ImageButton)e.CommandSource;
            if (imgb.ID != "New" && imgb.ID != "Exit")
            {
                id = 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
                {
                    Proceso p = CntLainsaSci.GetProceso(id, ctx);
                    CntLainsaSci.CTXEliminar(p, ctx);
                    CntLainsaSci.CTXGuardar(ctx);
                    RefreshGrid(true);
                }
                catch (Exception ex)
                {
                    ControlDeError(ex);
                }
                break;
            }
        }
    }