Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi I have Created a Windows Application and I want to provide a Customization of the some Option in my project for Administrator and the admin set to the other User part which is show or not for user so pls help me for some ideas which i can apply on my appln.

thanks in Advance.
Posted
Comments
senguptaamlan 8-Dec-10 2:24am    
try to use your own methodology...if you face any technical hurdle then this forum will be helpful...

You have to simply use a password-based login system and a public static bool IsAdmin global variable. Then set Visible = IsAdmin for any UI element you want!
Or, if you want: Visible = IsAdmin && OtherConditions;
 
Share this answer
 
v2
Comments
NBajaj 8-Dec-10 6:36am    
thats u tell is well
But If I have more than two or three or more condition for show or enable disable than what can i ?
fjdiewornncalwe 25-Dec-10 18:50pm    
Although I always disagree with "global" variables as opposed to static application scoped configuration classes, your answer is theoretically correct and does not deserve the 1 vote, so I'll counter it.
To save on code and make it easier for yourself, you could have a method for the administrator.

For example:
C#
public void IsAdministrator()
{
    SpecialBackground.Visible = true;
    AdministrationPanel.Visible = true;
    Extra1Panel.Visible = true;
    Extra2Panel.Visible = true;
    Extra3Panel.Visible = true;
}

And another like this:
C#
public void IsNotAdministrator()
{
    SpecialBackground.Visible = false;
    AdministrationPanel.Visible = false;
    Extra1Panel.Visible = false;
    Extra2Panel.Visible = false;
    Extra3Panel.Visible = false;
}

Then all you would need to do to 'give' admin rights is this.
Probably on a button click after putting in details of some sort:
C#
IsAdministrator()

Then to log out, and remove the admin rights since no one will be logged in, is this:
C#
IsNotAdministrator()

I do this most of the time. It keeps everything together and neat.
 
Share this answer
 
Comments
fjdiewornncalwe 25-Dec-10 18:51pm    
Way too many holes in this type of coding by which subtle bugs can be introduced.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900