예제 #1
0
파일: AdminForm.cs 프로젝트: Narrya/IBGames
        /// <summary>
        /// Handles the Load event of the AdminForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void AdminForm_Load(object sender, EventArgs e)
        {
            UsersDataAccess dataAccess = new UsersDataAccess();
            AllResultsGrid.DataSource = dataAccess.GetUsers();

            AllResultsGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
        }
예제 #2
0
        /// <summary>
        /// Rebinds all grids.
        /// </summary>
        protected void Rebind()
        {
            UsersDataAccess dataAccess = new UsersDataAccess();

            AllStudents.DataSource = dataAccess.GetAllDisconectedStudents(_username);
            AllStudents.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);

            AssociatedStudents.DataSource = dataAccess.GetMyUsers(_username);
            AssociatedStudents.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
        }
예제 #3
0
        /// <summary>
        /// Handles the Click event of the btnAssociateStudents control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnAssociateStudents_Click(object sender, EventArgs e)
        {
            UsersDataAccess dataAccess = new UsersDataAccess();

            List<int> students = new List<int>();
            foreach (DataGridViewRow student in AllStudents.SelectedRows)
            {
                dataAccess.AssociateStudent((int)student.Cells["ID"].Value, _username);
            }

            // Refresh data sets.
            Rebind();
        }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <returns></returns>
 public bool IsStudent(string username)
 {
     UsersDataAccess dataAccess = new UsersDataAccess();
     return dataAccess.IsStudent(username);
 }
예제 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <returns></returns>
 public bool IsAdmin(string username)
 {
     UsersDataAccess dataAccess = new UsersDataAccess();
     return dataAccess.IsAdmin(username);
 }
예제 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public bool Authenticate(string username, string password)
 {
     UsersDataAccess dataAccess = new UsersDataAccess();
     return dataAccess.TryAuthenticateUser(username, password);
 }