窗口应用程序...管理页面 [英] Window application ...admin page

查看:63
本文介绍了窗口应用程序...管理页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我正在使用C#在Windows应用程序中创建软件...创建管理页面有很多问题...如何创建子管理以及如何为子管理赋予有限的权力..创建Adin页面有很多问题.. .it任何人都可以提供...管理页面实施的项目..

请帮助我

hi all...

i am creating a software in window application using c#...there are many problem to create admin page...how to create sub admin and how to give limited power to sub admin..there are many problem to create adin page...it any one can provide ...admin page implemented project..

please help me

推荐答案

提示:
您可以创建一个类来定义用户的权限.
示例:
Hints:
You can create a class to define the privileges of a user.
Example:
public class User
{
    public Privilege UserType { get; set; }
    public string UserName { get; set; }

    public enum Privilege
    {
        Admin,
        Supervisor,
        User
    }
}


之后,您可以在应用程序中的任何位置初始化用户.然后,您可以根据用户的权限隐藏或显示允许用户查看的项目.
示例:


After that, you can initialize the user any where in your application. Then you can hide or show the items that are allowed to be viewed by the user based on his/her privilege.
Example:

public Form2()
{
    InitializeComponent();
    User user = new User();
    user.UserType = User.Privilege.Admin;

    button_Admin.Visible = false;
    button_Supervisor.Visible = false;
    button_User.Visible = false;

    switch (user.UserType)
    {
        case User.Privilege.Admin:
            button_Admin.Visible = true;
            button_Supervisor.Visible = true;
            button_User.Visible = true;
            break;
        case User.Privilege.Supervisor:
            button_Supervisor.Visible = true;
            button_User.Visible = true;
            break;
        case User.Privilege.User:
            button_User.Visible = true;
            break;
        default:
            break;
    }
}


这篇关于窗口应用程序...管理页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆