Click here to Skip to main content
15,917,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: Debugging the Dll build in Debug mode Pin
Nyanoba10-Oct-11 22:38
Nyanoba10-Oct-11 22:38 
GeneralRe: Debugging the Dll build in Debug mode Pin
Daniel.Grondal12-Oct-11 2:22
Daniel.Grondal12-Oct-11 2:22 
QuestionWindows NameSpace Extension Pin
ycorre10-Oct-11 16:18
ycorre10-Oct-11 16:18 
AnswerRe: Windows NameSpace Extension Pin
Richard MacCutchan10-Oct-11 22:17
mveRichard MacCutchan10-Oct-11 22:17 
QuestionRole-Based Dynamic UI Pin
Matt U.10-Oct-11 15:28
Matt U.10-Oct-11 15:28 
AnswerRe: Role-Based Dynamic UI Pin
David Skelly10-Oct-11 22:14
David Skelly10-Oct-11 22:14 
GeneralRe: Role-Based Dynamic UI Pin
Matt U.11-Oct-11 1:56
Matt U.11-Oct-11 1:56 
GeneralRe: Role-Based Dynamic UI Pin
Wayne Gaylard11-Oct-11 2:16
professionalWayne Gaylard11-Oct-11 2:16 
Create another class called Permissions or something similar. In that class you would have boolean properties which correspond to each permission you would like. Then in your role class you would have a property permissions, which would return a permissions class with appropriate permissions set. Then each user would be assigned a role, which would have the permissions set. Then in you application you couls have a currentuser property, who would have their role with permissions, and so you could just enable buttons/menuitems according to the permissions. Here is a simple example:-

C#
public partial class Form1 : Form
    {
        User currentUser;

        public Form1()
        {
            InitializeComponent();
            btnAddNewDoc.Enabled = currentUser.CurrentUserRole.Permissions.CanAddNewDoc;
        }
    }


    class User
    {
        public int UserID { get; set; }
        public string UserName { get; set; }
        public UserRole CurrentUserRole { get; set; }
    }

    class UserRole
    {
        public string RoleName { get; set; }
        public RolePermissions Permissions { get; set; }
    }

    class RolePermissions
    {
        public bool CanAddNewDoc { get; set; }
        public bool CanDeleteDoc { get; set; }
    }

When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

GeneralRe: Role-Based Dynamic UI Pin
Matt U.11-Oct-11 3:06
Matt U.11-Oct-11 3:06 
GeneralRe: Role-Based Dynamic UI Pin
Wayne Gaylard11-Oct-11 3:16
professionalWayne Gaylard11-Oct-11 3:16 
GeneralRe: Role-Based Dynamic UI Pin
BobJanova11-Oct-11 3:15
BobJanova11-Oct-11 3:15 
GeneralRe: Role-Based Dynamic UI Pin
Wayne Gaylard11-Oct-11 3:23
professionalWayne Gaylard11-Oct-11 3:23 
GeneralRe: Role-Based Dynamic UI Pin
BillWoodruff11-Oct-11 7:09
professionalBillWoodruff11-Oct-11 7:09 
QuestionHow 'cheap' is recursive use of variables ? Pin
BillWoodruff10-Oct-11 15:22
professionalBillWoodruff10-Oct-11 15:22 
AnswerRe: How 'cheap' is recursive use of variables ? Pin
Luc Pattyn10-Oct-11 15:57
sitebuilderLuc Pattyn10-Oct-11 15:57 
GeneralRe: How 'cheap' is recursive use of variables ? Pin
BillWoodruff10-Oct-11 20:19
professionalBillWoodruff10-Oct-11 20:19 
AnswerRe: How 'cheap' is recursive use of variables ? Pin
PIEBALDconsult10-Oct-11 16:00
mvePIEBALDconsult10-Oct-11 16:00 
GeneralRe: How 'cheap' is recursive use of variables ? Pin
BillWoodruff10-Oct-11 20:15
professionalBillWoodruff10-Oct-11 20:15 
GeneralRe: How 'cheap' is recursive use of variables ? Pin
PIEBALDconsult11-Oct-11 2:33
mvePIEBALDconsult11-Oct-11 2:33 
AnswerRe: How 'cheap' is recursive use of variables ? Pin
BobJanova11-Oct-11 1:39
BobJanova11-Oct-11 1:39 
GeneralRe: How 'cheap' is recursive use of variables ? Pin
harold aptroot11-Oct-11 2:54
harold aptroot11-Oct-11 2:54 
GeneralRe: How 'cheap' is recursive use of variables ? Pin
BillWoodruff11-Oct-11 7:28
professionalBillWoodruff11-Oct-11 7:28 
QuestionTcpClient - Detecting closed connections Pin
Grimes10-Oct-11 11:32
Grimes10-Oct-11 11:32 
AnswerRe: TcpClient - Detecting closed connections Pin
BobJanova10-Oct-11 23:24
BobJanova10-Oct-11 23:24 
GeneralRe: TcpClient - Detecting closed connections Pin
Grimes10-Oct-11 23:53
Grimes10-Oct-11 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.