using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NX_Portal; namespace Test_SichtbarkeitSteuern { internal class VisibilityControl { #region Values public static bool ButtonDoSomethingVisible { private set; get; } public static bool ButtonDoSomethingEnabled { private set; get; } public static bool CheckBoxDoItVisible { private set; get; } public static bool CheckBoxDoItEnabled { private set; get; } public static bool RadioButtonEitherVisible { private set; get; } public static bool RadioButtonEitherEnabled { private set; get; } public static bool RadioButtonOrVisible { private set; get; } public static bool RadioButtonOrEnabled { private set; get; } public static bool ButtonAdminVisible { private set; get; } public static bool ButtonAdminEnabled { private set; get; } public static bool ButtonKeyuserVisible { private set; get; } public static bool ButtonKeyuserEnabled { private set; get; } public static bool ButtonUserVisible { private set; get; } public static bool ButtonUserEnabled { private set; get; } #endregion public static void SetVisability(Userprofiles.Profile profile) { switch (profile) { case Userprofiles.Profile.Administrator: SetVisToAdmin(); break; case Userprofiles.Profile.KeyUser: SetVisToKeyuser(); break; case Userprofiles.Profile.User: SetVisToUser(); break; default: SetVisToUser(); break; } } private static void SetVisToAdmin() { ButtonDoSomethingVisible = true; ButtonDoSomethingEnabled = true; CheckBoxDoItVisible = true; CheckBoxDoItEnabled = true; RadioButtonEitherVisible = true; RadioButtonEitherEnabled = true; RadioButtonOrVisible = true; RadioButtonOrEnabled = true; ButtonAdminVisible = true; ButtonAdminEnabled = false; ButtonKeyuserVisible = true; ButtonKeyuserEnabled = true; ButtonUserVisible = true; ButtonUserEnabled = true; } private static void SetVisToKeyuser() { ButtonDoSomethingVisible = true; ButtonDoSomethingEnabled = false; CheckBoxDoItVisible = true; CheckBoxDoItEnabled = true; RadioButtonEitherVisible = true; RadioButtonEitherEnabled = false; RadioButtonOrVisible = true; RadioButtonOrEnabled = false; ButtonAdminVisible = true; ButtonAdminEnabled = true; ButtonKeyuserVisible = true; ButtonKeyuserEnabled = false; ButtonUserVisible = true; ButtonUserEnabled = true; } private static void SetVisToUser() { ButtonDoSomethingVisible = false; ButtonDoSomethingEnabled = false; CheckBoxDoItVisible = true; CheckBoxDoItEnabled = false; RadioButtonEitherVisible = true; RadioButtonEitherEnabled = false; RadioButtonOrVisible = true; RadioButtonOrEnabled = false; ButtonAdminVisible = true; ButtonAdminEnabled = true; ButtonKeyuserVisible = true; ButtonKeyuserEnabled = true; ButtonUserVisible = true; ButtonUserEnabled = false; } } }