private void ControlTableButton_Click(object sender, EventArgs e) { StudentPanel.Show(); label2.Show(); UserBox.Show(); TeachersPanel.Hide(); AdministratorPanel.Hide(); DepartmentPanel.Hide(); PasswordPanel.Hide(); }
private void UserSettingsButton_Click(object sender, EventArgs e) { UserBox.SelectedIndex = 2; PasswordPanel.Show(); StudentPanel.Hide(); TeachersPanel.Hide(); AdministratorPanel.Hide(); DepartmentPanel.Hide(); label2.Hide(); UserBox.Hide(); }
private void UserBox_SelectedIndexChanged(object sender, EventArgs e) { try { string current = selectedUser(); if (current == "Administratora") { AdministratorPanel.Show(); label2.Show(); UserBox.Show(); StudentPanel.Hide(); TeachersPanel.Hide(); PasswordPanel.Hide(); DepartmentPanel.Hide(); } if (current == "Nastavnika") { TeachersPanel.Show(); label2.Show(); UserBox.Show(); StudentPanel.Hide(); AdministratorPanel.Hide(); PasswordPanel.Hide(); DepartmentPanel.Hide(); } if (current == "Ucenika i roditelja") { StudentPanel.Show(); label2.Show(); UserBox.Show(); TeachersPanel.Hide(); AdministratorPanel.Hide(); PasswordPanel.Hide(); DepartmentPanel.Hide(); } if (current == "Odjeljenja i razrednici") { DepartmentPanel.Show(); label2.Show(); UserBox.Show(); StudentPanel.Hide(); TeachersPanel.Hide(); AdministratorPanel.Hide(); PasswordPanel.Hide(); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void ChangePassAdminButton_Click(object sender, EventArgs e) { if (OldPassTextBox.Text.Length == 0 || NewPassTextBox.Text.Length == 0 || ConfirmedNewPassTextBox.Text.Length == 0) { Warning(); } else { if (OldPassTextBox.Text == NewPassTextBox.Text && OldPassTextBox.Text == CurrentUser.Password) { MessageBox.Show("Unesite novu lozinku koja se razlikuje od stare !"); } else if (Encrypt.hashPassword(OldPassTextBox.Text) == CurrentUser.Password && NewPassTextBox.Text == ConfirmedNewPassTextBox.Text) { bool isChanged = UsersRepository.ChangePassword(CurrentUser.Id, OldPassTextBox.Text, NewPassTextBox.Text, ConfirmedNewPassTextBox.Text); if (isChanged == true) { StudentPanel.Show(); label2.Show(); UserBox.Show(); TeachersPanel.Hide(); AdministratorPanel.Hide(); DepartmentPanel.Hide(); PasswordPanel.Hide(); UserSettingsButton.Hide(); } } else if (NewPassTextBox.Text != ConfirmedNewPassTextBox.Text) { MessageBox.Show("Nove lozinke se ne poklapaju !"); } else { MessageBox.Show("Pogrešna lozinka !"); } } }