private void Button_Click(object sender, RoutedEventArgs e) { if (login_user.login != login_field.Text) { if (!(Login.checklogin(login_field.Text))) { MessageBox.Show("Login already exist in database"); return; } if (login_field.Text.Trim().Length != 0) { MenuAdminLogic.changeLogin(login_user.Id, login_field.Text); } else { MessageBox.Show("Fill empty field"); return; } } else if (surname != surname_field.Text) { if (surname_field.Text.Trim().Length != 0) { MenuAdminLogic.changeSurname(login_user.u_id, login_user.role, surname_field.Text); } else { MessageBox.Show("Fill empty field"); return; } } this.Close(); }
public SMA_editData(MenuAdminLogic.UserDisplay user) { InitializeComponent(); login_user = MenuAdminLogic.getLoginInfo(user.User_ID); login_field.Text = login_user.login; surname = user.Surname; surname_field.Text = surname; }
private void Button_Click(object sender, RoutedEventArgs e) { if (new_pass0.Password != new_pass1.Password) { MessageBox.Show(""); return; } MenuAdminLogic.changePassword(new_pass0.Password, id); this.Close(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (Lecturer_Grid.SelectedItem == null) { MessageBox.Show("Choose user"); return; } else if (Lecturer_Grid.SelectedItems.Count > 1) { MessageBox.Show("Choose one user"); return; } var selected_user_id = ((MenuAdminLogic.UserDisplay)Lecturer_Grid.SelectedItem).User_ID; var selected_user_status = ((MenuAdminLogic.UserDisplay)Lecturer_Grid.SelectedItem).active; MenuAdminLogic.setUserStatus(selected_user_id, selected_user_status); Lecturer_Grid.ItemsSource = MenuAdminLogic.getLecturerList(); }
private void Button_Click(object sender, RoutedEventArgs e) { string name = Name_field.Text.Trim(); string surname = Surname_field.Text.Trim(); string login = Login_field.Text.Trim(); string pass = Pass_Field.Text.Trim(); bool avaible = isAvaible.IsChecked.Value; if (!Login.checklogin(login)) { return; } if ((name.Length == 0) || (surname.Length == 0) || (login.Length == 0) || (pass.Length == 0)) { MessageBox.Show("Wypełnij wszystkie pola"); return; } if (mode == 2) { if (Degree_choose.SelectedItem == null) { MessageBox.Show("Wybierz stopień naukowy"); return; } DataClassesDataContext context = new DataClassesDataContext(); Lecturer new_lec = new Lecturer(); int new_id = (context.Lecturer.OrderByDescending(x => x.ID_lecturer).FirstOrDefault()).ID_lecturer + 1; new_lec.ID_lecturer = (short)new_id; new_lec.Name = name; new_lec.Surname = surname; new_lec.Degree = Degree_choose.Text; MenuAdminLogic.addLecturer(new_lec); MenuAdminLogic.addLogin(login, pass, "lecturer", isAvaible.IsChecked.Value, (short)new_id); } else if (mode == 3) { if (Sem_choose.SelectedItem == null) { MessageBox.Show("Wybierz semestr"); return; } DataClassesDataContext context = new DataClassesDataContext(); Student stu = new Student(); int new_id = (context.Student.OrderByDescending(x => x.ID_Album).FirstOrDefault()).ID_Album + 1; stu.ID_Album = (short)new_id; stu.Name = name; stu.Surname = surname; var sem_id = ((Tuple <int, string, string>)Sem_choose.SelectedItem).Item1; MenuAdminLogic.addStudent(stu); MenuAdminLogic.addLogin(login, pass, "student", isAvaible.IsChecked.Value, (short)new_id); MenuAdminLogic.addStuInSem(new_id, sem_id); } else if (mode == 1) { DataClassesDataContext context = new DataClassesDataContext(); admin_tab new_admin = new admin_tab(); int new_id = (context.admin_tab.OrderByDescending(x => x.admin_id).FirstOrDefault()).admin_id + 1; new_admin.admin_id = (short)new_id; new_admin.admin_name = name; new_admin.admin_surname = surname; MenuAdminLogic.addAdmin(new_admin); MenuAdminLogic.addLogin(login, pass, "admin", isAvaible.IsChecked.Value, (short)new_id); } this.Close(); }
public SMA_Lecturer() { InitializeComponent(); Lecturer_Grid.ItemsSource = MenuAdminLogic.getLecturerList(); }
public SMA_Student() { InitializeComponent(); StudentGrid.ItemsSource = MenuAdminLogic.getStudentList(); }
public SMA_Admin() { InitializeComponent(); AdminGrid.ItemsSource = MenuAdminLogic.getAdminList(); }