private void btnEditUser_Click(object sender, RoutedEventArgs e)
 {
     while (pbConfirmPassword.Password != pbPassword.Password)
     {
         ClearPassword();
         MessageBox.Show("Passwords do not match!");
     }
     try
     {
         if (flag == 1)
         {
             aStudent = new Student(Convert.ToInt32(txtNumber.Text), txtName.Text, cmbxSection.Text, pbPassword.Password, 0);
             aStudent.Update();
         }
         else if (flag == 2)
         {
             aTeacher = new Teacher(Convert.ToInt32(txtNumber.Text), txtName.Text, cmbxDepartment.Text, pbPassword.Password);
             aTeacher.Update();
         }
         else if (flag == 3)
         {
             aAdmin = new Admin(Convert.ToInt32(txtNumber.Text), txtName.Text, pbPassword.Password);
             aAdmin.Update();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         MessageBox.Show("Do not leave any field blank!");
     }
 }
 private void txtDeleteNumber_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     //write some code
     if (e.Key == System.Windows.Input.Key.Enter)
     {
         string usertype = GetUType(Convert.ToInt32(txtDeleteNumber.Text));
         if (usertype == "Student")
         {
             aStudent = new Student(Convert.ToInt32(txtDeleteNumber.Text));
             if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
             {
                 aStudent.Delete();
             }
             else if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
             {
                 DoNothing();
             }
         }
         else if (usertype == "Teacher")
         {
             aTeacher = new Teacher(Convert.ToInt32(txtDeleteNumber.Text));
             if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
             {
                 aTeacher.Delete();
             }
             else if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
             {
                 DoNothing();
             }
         }
         else if (usertype == "Admin")
         {
             aAdmin = new Admin(Convert.ToInt32(txtDeleteNumber.Text));
             if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
             {
                 aAdmin.Delete();
             }
             else if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
             {
                 DoNothing();
             }
         }
         //PopulateSList();
     }
 }
 private void btnConfirm_Click(object sender, RoutedEventArgs e)
 {
     aStudent = new Student(cmbxClass.Text, 1);
     aStudent.VUpdate();
     GetClass(cmbxClass.Text);
 }