Beispiel #1
0
        public frmStuDashboard(string user, string firstName)
        {
            InitializeComponent();
            this.Text = ("Welcome " + firstName + "!");

            //Form load, instantiate subforms
            frmStuDetails           = new frmStuDetails(user, false);
            frmStuDetails.MdiParent = this;

            frmEnrolments           = new frmEnrolments(user, false);
            frmEnrolments.MdiParent = this;

            frmProject           = new frmProject(user, false, false);
            frmProject.MdiParent = this;

            frmTeamDetails           = new frmTeamDetails(user, false, false);
            frmTeamDetails.MdiParent = this;

            frmMeeting           = new frmMeeting(user, false);
            frmMeeting.MdiParent = this;

            frmStuAssessment           = new frmStuAssessment(user, false);
            frmStuAssessment.MdiParent = this;
        }
        public frmEmpDashboard(string user, string firstName, bool isAdmin, bool isConvenor, bool isSupervisor)
        {
            InitializeComponent();
            User      = user;
            this.Text = ("Welcome " + firstName + "!");

            //for testing: MessageBox.Show("Form initialised. isAdmin: " + isAdmin + "; isConvenor: " + isConvenor + "; isSupervisor: " + isSupervisor);

            //Enable menus based on user's type --> except a user may have many types
            if (isAdmin) //(user == "admin")
            {
                administratorFunctionsToolStripMenuItem.Enabled = true;

                frmStuDetails           = new frmStuDetails(user, isAdmin); //to be updated soon...
                frmStuDetails.MdiParent = this;

                frmUnits           = new frmUnits(true);
                frmUnits.MdiParent = this;

                frmUnitOfferings           = new frmUnitOfferings(user, isAdmin);
                frmUnitOfferings.MdiParent = this;

                frmEnrolments           = new frmEnrolments(user, isAdmin);
                frmEnrolments.MdiParent = this;

                frmReports         = new frmReports(user, isAdmin);
                frmUnits.MdiParent = this;
            }
            else
            {
                administratorFunctionsToolStripMenuItem.Enabled = false;
            }

            if (isSupervisor) //(user == "supervisor")
            {
                supervisorFunctionsToolStripMenuItem.Enabled = true;

                frmMeeting           = new frmMeeting(user, isSupervisor);
                frmMeeting.MdiParent = this;

                frmAssessment           = new frmAssessment(user, isConvenor, isSupervisor);
                frmAssessment.MdiParent = this;

                frmTeamDetails           = new frmTeamDetails(user, isConvenor, isSupervisor);
                frmTeamDetails.MdiParent = this;

                frmProject           = new frmProject(user, isConvenor, isSupervisor);
                frmProject.MdiParent = this;
            }
            else
            {
                supervisorFunctionsToolStripMenuItem.Enabled = false;
            }

            if (isConvenor) //(user == "convenor")
            {
                convenorFunctionsToolStripMenuItem.Enabled = true;

                frmAssessment           = new frmAssessment(user, isConvenor, isSupervisor);
                frmAssessment.MdiParent = this;

                frmTeamDetails           = new frmTeamDetails(user, isConvenor, isSupervisor);
                frmTeamDetails.MdiParent = this;

                //ensures that the frmUnits won't be overwritten if the user is also an admin
                if (!isAdmin)
                {
                    frmUnits           = new frmUnits(false);
                    frmUnits.MdiParent = this;
                }

                //ensures that the frmUnitOfferings won't be overwritten if the user is also an admin
                if (!isAdmin)
                {
                    frmUnitOfferings           = new frmUnitOfferings(user, isAdmin);
                    frmUnitOfferings.MdiParent = this;
                }

                frmProject           = new frmProject(user, isConvenor, isSupervisor);
                frmProject.MdiParent = this;
            }
            else
            {
                convenorFunctionsToolStripMenuItem.Enabled = false;
            }

            frmEmpDetails           = new frmEmpDetails(user, isAdmin);
            frmEmpDetails.MdiParent = this;
        }