Skip to content

Commit

Permalink
Merge pull request #201 from kzi-nastava/refactor/properties
Browse files Browse the repository at this point in the history
Refactor AppController and rename UserGender -> Gender
  • Loading branch information
natasakasikovic authored Apr 28, 2024
2 parents 1e3b7af + 4cce4de commit bc76d5e
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 23 deletions.
17 changes: 6 additions & 11 deletions LangLang/Core/Controller/AppController.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
using LangLang.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LangLang.Core.Controller
{
public class AppController
{
public TutorController TutorController { get; }
public CourseController CourseController { get; }
public StudentController StudentController { get; }
public EnrollmentRequestController EnrollmentRequestController { get; }
public ExamSlotController ExamSlotController { get; }
public LoginController LoginController { get; }
public readonly TutorController TutorController;
public readonly CourseController CourseController;
public readonly StudentController StudentController;
public readonly EnrollmentRequestController EnrollmentRequestController;
public readonly ExamSlotController ExamSlotController;
public readonly LoginController LoginController;
public AppController()
{
this.TutorController = new TutorController();
Expand Down
2 changes: 1 addition & 1 deletion LangLang/Core/Model/Director.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Profile Profile
set { _profile = value;}
}

public Director(int id, string name, string lastName, UserGender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role) {
public Director(int id, string name, string lastName, Gender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role) {
_profile = new Profile(id, name, lastName, gender, dateOfBirth, phoneNumber, email, password, role);
}

Expand Down
2 changes: 1 addition & 1 deletion LangLang/Core/Model/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Student : ISerializable, IProfileHolder

public Student() { }

public Student(int id, string name, string lastName, UserGender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role, string profession)
public Student(int id, string name, string lastName, Gender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role, string profession)
{
Profile = new Profile(id, name, lastName, gender, dateOfBirth, phoneNumber, email, password, role);
Profession = profession;
Expand Down
2 changes: 1 addition & 1 deletion LangLang/Core/Model/Tutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Profile Profile
private set { _profile = value; }
}

public Tutor(int id, string name, string lastName, UserGender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role, DateTime employmentDate, List<string> languages, List<LanguageLevel>levels) {
public Tutor(int id, string name, string lastName, Gender gender, DateTime dateOfBirth, string phoneNumber, string email, string password, UserType role, DateTime employmentDate, List<string> languages, List<LanguageLevel>levels) {
_profile = new Profile(id, name, lastName, gender, dateOfBirth, phoneNumber, email, password, role);
_employmentDate = employmentDate;
_skill = new(languages, levels);
Expand Down
4 changes: 2 additions & 2 deletions LangLang/DTO/StudentDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public StudentDTO() { }
private string password;
private string profession;
private string phoneNumber;
private UserGender gender;
private Gender gender;
private DateTime birthDate;


Expand Down Expand Up @@ -99,7 +99,7 @@ public string PhoneNumber
}
}

public UserGender Gender
public Gender Gender
{
get { return gender; }
set
Expand Down
4 changes: 2 additions & 2 deletions LangLang/DTO/TutorDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TutorDTO : INotifyPropertyChanged, IDataErrorInfo

private string name;
private string lastName;
private UserGender gender;
private Gender gender;
private DateTime birthDate;
private string phoneNumber;
private string email;
Expand Down Expand Up @@ -56,7 +56,7 @@ public string LastName
}
}

public UserGender Gender
public Gender Gender
{
get
{
Expand Down
2 changes: 1 addition & 1 deletion LangLang/View/DirectorGUI/AddTutorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public AddTutorWindow(AppController appController)
Tutor = new TutorDTO();
DataContext = this;

genderCB.ItemsSource = Enum.GetValues(typeof(UserGender));
genderCB.ItemsSource = Enum.GetValues(typeof(Gender));
levelCB.ItemsSource = Enum.GetValues(typeof(LanguageLevel));
}

Expand Down
4 changes: 2 additions & 2 deletions LangLang/View/DirectorGUI/DirectorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Update()

void SetUpWindow()
{
gendercb.ItemsSource = Enum.GetValues(typeof(UserGender));
gendercb.ItemsSource = Enum.GetValues(typeof(Gender));
levelCB.ItemsSource = Enum.GetValues(typeof(LanguageLevel));
ClearFields();
DisableForm();
Expand Down Expand Up @@ -77,7 +77,7 @@ private void updateBtn_Click(object sender, RoutedEventArgs e)
SelectedTutor.Email = emailtb.Text;
SelectedTutor.BirthDate = BirthDatePicker.SelectedDate.Value;
SelectedTutor.PhoneNumber = phonenumbertb.Text;
SelectedTutor.Gender = (UserGender)gendercb.SelectedItem;
SelectedTutor.Gender = (Gender)gendercb.SelectedItem;
SelectedTutor.Password = passwordTB.Text;
SelectedTutor.EmploymentDate = EmploymentDatePicker.SelectedDate.Value;

Expand Down
2 changes: 1 addition & 1 deletion LangLang/View/StudentGUI/Registration.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public Registration(AppController appController)
Student = new StudentDTO();
this.studentController = appController.StudentController;
this.appController = appController;
gendercb.ItemsSource = Enum.GetValues(typeof(UserGender));
gendercb.ItemsSource = Enum.GetValues(typeof(Gender));
}

private void SignUp_Click(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion LangLang/View/StudentGUI/StudentWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public StudentWindow(AppController appController, Profile currentlyLoggedIn)
examSlotsForReview = this.studentController.GetAvailableExamSlots(this.currentlyLoggedIn, courseController, examSlotController, enrollmentRequestController);
coursesForReview = this.studentController.GetAvailableCourses(courseController);

gendercb.ItemsSource = Enum.GetValues(typeof(UserGender));
gendercb.ItemsSource = Enum.GetValues(typeof(Gender));
levelExamcb.ItemsSource = Enum.GetValues(typeof(LanguageLevel));
levelCoursecb.ItemsSource = Enum.GetValues(typeof(LanguageLevel));

Expand Down

0 comments on commit bc76d5e

Please sign in to comment.