Example #1
0
        private void Dashboard_Load(object sender, EventArgs e)
        {
            //Get the name from the logged in user and display it in the corner
            lblName.Text = "Welcome, " + CurrentUser.Name + "!";

            //List of strings (departments in database)
            List <String> departmentsList = new List <String>();
            //List of strings (genders in database)
            List <String> gendersList = new List <String>();
            //Create a new database object to search from
            LibraryDB formInfo = new LibraryDB();

            //Retrieve list of departments from the library DB
            departmentsList = formInfo.getDepartments();
            //Retrieve list of genders from the library DB
            gendersList = formInfo.getGenders();

            //Fill the combo box with the list of departments
            cmbDepartment.DataSource = departmentsList;
            cmbGender.DataSource     = gendersList;

            //Only way to make the date time picker empty
            dtpDOB.CustomFormat = " ";
            //Maximum date it today
            dtpDOB.MaxDate = DateTime.Now;

            //List of strings (departments in database)
            List <String> languagesList = new List <String>();
            //List of strings (genders in database)
            List <String> categoriesList = new List <String>();

            //Retrieve list of departments from the library DB
            languagesList = formInfo.getLanguages();
            //Retrieve list of genders from the library DB
            categoriesList = formInfo.getCategories();

            //Fill the combo box with the list of departments
            cmbLang.DataSource     = languagesList;
            cmbCategory.DataSource = categoriesList;

            //Empty the combo boxes to give user a blank slate to search on
            cmbLang.SelectedIndex       = -1;
            cmbCategory.SelectedIndex   = -1;
            cmbDepartment.SelectedIndex = -1;
            cmbGender.SelectedIndex     = -1;

            //Only way to make the date time picker empty
            dtpPubYear.CustomFormat = " ";
            //Maximum date it today
            dtpPubYear.MaxDate = DateTime.Now;

            if (CurrentUser.IsAdmin == "False")
            {
                tabDashboard.TabPages.Remove(tabAdmin);
            }
        }