예제 #1
0
 protected void UnloadData(Usuario usuario)
 {
     usuario.Nombre = txtNombre.Text;
     // Grupo de usuario asociado
     usuario.GrupoUsuario = CntLainsaSci.GetGrupoUsuario(int.Parse(rdcGrupo.SelectedValue), ctx);
     usuario.Login        = txtLogin.Text;
     if (rdcInstalacion.SelectedValue != "")
     {
         // La instalación marca la empresa
         instalacion = CntLainsaSci.GetInstalacion(int.Parse(rdcInstalacion.SelectedValue), ctx);
         if (instalacion != null)
         {
             usuario.Instalacion = instalacion;
             usuario.Empresa     = instalacion.Empresa;
         }
     }
     else
     {
         if (rdcEmpresa.SelectedValue != "")
         {
             empresa             = CntLainsaSci.GetEmpresa(int.Parse(rdcEmpresa.SelectedValue), ctx);
             usuario.Empresa     = empresa;
             usuario.Instalacion = null;
         }
     }
     if (txtPassword.Text != "")
     {
         usuario.Password = CntAutenticacion.GetHashCode(txtPassword.Text);
     }
 }
예제 #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);
     }
 }
예제 #3
0
 protected void RefreshTreeList(bool rebind)
 {
     if (rdcGrupoUsuario.SelectedValue != "")
     {
         GrupoUsuario gpu = CntLainsaSci.GetGrupoUsuario(int.Parse(rdcGrupoUsuario.SelectedValue), ctx);
         CntLainsaSci.VerifyPermissions(gpu, ctx);
         RadTreeList1.DataSource = CntLainsaSci.GetPermissionsViews(gpu);
     }
     else
     {
         RadTreeList1.DataSource = new List <PermissionView>();
     }
     if (rebind)
     {
         RadTreeList1.Rebind();
     }
 }
예제 #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;
     }
     //
     // si llega aquí está autorizado
     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;
     // Is it a new record or not?
     if (Request.QueryString["GrupoUsuarioId"] != null)
     {
         UsuarioGroup = CntLainsaSci.GetGrupoUsuario(int.Parse(Request.QueryString["GrupoUsuarioId"]), ctx);
         LoadData(UsuarioGroup);
         newRecord = false;
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
예제 #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"))
        {
            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
                {
                    GrupoUsuario gpu = CntLainsaSci.GetGrupoUsuario(id, ctx);
                    CntLainsaSci.DeleteGrupoUsuario(gpu, ctx);
                    RefreshGrid(true);
                }
                catch (Exception ex)
                {
                    ControlDeError(ex);
                }
                break;
            }
        }
    }