Esempio n. 1
0
        /// <summary>
        /// Refresh the form information
        /// </summary>
        private void RefreshForm()
        {
            //Create a database object to get the list of departments
            LibraryDB     dbInfo          = new LibraryDB();
            List <String> departmentsList = new List <String>();
            //To store the new student ID calculated by database
            String newStudentID = "";

            //Get the new student ID
            newStudentID = dbInfo.getNewID("Student");
            //Set the textbox to display new student ID (Can't be modified by user)
            txtID.Text = newStudentID;

            //Put the list of departments into a list
            departmentsList = dbInfo.getDepartments();

            //Set the depart ment combo box datasource as the department list
            cmbDepartments.DataSource = departmentsList;

            //Makes it so there is no selected date when the user loads the form
            dtpDOB.CustomFormat = " ";
            //Clear the name data (for when the user wants to enter another student
            txtName.Text       = "";
            txtContactNum.Text = "";
            //Makes it so there is no selected option starting off
            cmbGender.SelectedIndex      = -1;
            cmbDepartments.SelectedIndex = -1;

            //Sets it so the maximum date is today. Technically no one can be born today and enter into the database, but its ok
            dtpDOB.MaxDate = DateTime.Now;
        }
Esempio n. 2
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);
            }
        }