Пример #1
0
        public MainForm(Login lgnForm, bool admin)
        {
            InitializeComponent();
            objects = new ObjectHolder();
            initializeLookupTab();   
         
            if (admin)
            {
                lblAdmin.Text = "Hello, Administrator";
                isAdmin = true;
                initializeKeyTab();
                initializeKeySetTab();
                initializeDoorGroupTab();
                initializePersonnelTab();
            }  

            else
            {
                lblAdmin.Text = "Hello User";
                tabControl.TabPages.Remove(tabPageKeysets);
                tabControl.TabPages.Remove(tabPageKeys);
                tabControl.TabPages.Remove(tabPageDoorgroups);
                tabControl.TabPages.Remove(tabPagePersonnel);
            }

            this.loginForm = lgnForm;
            initializeCheckoutTab();//Depends on admin value. Must be placed after it's determined. 
        }
        //private HelpForm helpForm;

        public MDI_ParentForm(Login lgnForm, int loginId)
        {
            InitializeComponent();
            objects = new ObjectHolder();
            currentUser = objects.GetPersonnelById(loginId);
                      
            if (currentUser.IsAdmin)
            {
                isAdmin = true;
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(Administrator)";
            }  
            else
            {
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(User)";
            }
            this.loginForm = lgnForm;

            
            SetupTreeView();
        }