private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            LecturerGridModel lecturer = (LecturerGridModel)LecturerDataGrid.SelectedItem;

            LecturerDataService lecturerDataService = new LecturerDataService(new EntityFramework.TimetableManagerDbContext());

            lecturerDataService.DeleteLecturer(lecturer.EmployeeId).ContinueWith(result =>
            {
                if (result == null)
                {
                    MessageBox.Show("Sorry! Error occured", "Error");
                }
            });

            _ = LecturerDataList.Remove(lecturer);
        }
        private async Task LoadLecturerData()
        {
            LecturerDataService lecturerDataService = new LecturerDataService(new EntityFramework.TimetableManagerDbContext());

            LecturerList = await lecturerDataService.GetLecturersAsync();

            LecturerList.ForEach(e =>
            {
                LecturerGridModel lecturerObj = new LecturerGridModel
                {
                    EmployeeId     = e.EmployeeId,
                    EmployeeName   = e.EmployeeName,
                    FacultyName    = e.Faculty.FacultyName,
                    DepartmentName = e.Department.DepartmentName,
                    CenterName     = e.Center.CenterName,
                    BuildingName   = e.Building.BuildingName,
                    LevelName      = e.Level.LevelName,
                    Rank           = e.Rank
                };

                LecturerDataList.Add(lecturerObj);
            });
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (EmployeeIdTextBox.Text.Trim() == "" || EmployeeNameTextBox.Text.Trim() == "" || RankTextBox.Text.Trim() == "" || FacutlyComboBox.SelectedItem == null || DepartmentComboBox.SelectedItem == null || CenterComboBox.SelectedItem == null || BuildingComboBox.SelectedItem == null || LevelComboBox.SelectedItem == null)
            {
                MessageBox.Show("Sorry! Fields cannot be empty!", "Error");
                return;
            }
            Lecturer lecturer = new Lecturer
            {
                EmployeeId   = Int32.Parse(EmployeeIdTextBox.Text.Trim()),
                EmployeeName = EmployeeNameTextBox.Text.Trim(),
                Rank         = float.Parse(RankTextBox.Text.Trim())
            };

            string facultyName    = FacutlyComboBox.SelectedItem.ToString();
            string departmentName = DepartmentComboBox.SelectedItem.ToString();
            string centerName     = CenterComboBox.SelectedItem.ToString();
            string buildingName   = BuildingComboBox.SelectedItem.ToString();
            string levelName      = LevelComboBox.SelectedItem.ToString();

            LecturerDataService lecturerDataService = new LecturerDataService(new EntityFramework.TimetableManagerDbContext());

            if (!EmployeeIdTextBox.IsEnabled)
            {
                EmployeeIdTextBox.IsEnabled = true;

                lecturerDataService.UpdateLecturer(lecturer, facultyName, departmentName, centerName, buildingName, levelName).ContinueWith(result =>
                {
                    if (result != null)
                    {
                        MessageBox.Show("Lecture Updated!", "Success");
                    }
                    else
                    {
                        MessageBox.Show("Sorry! Error occured!", "Error");
                    }
                });
            }
            else
            {
                lecturerDataService.AddLecturer(lecturer, facultyName, departmentName, centerName, buildingName, levelName).ContinueWith(result =>
                {
                    if (result != null)
                    {
                        MessageBox.Show("Lecture Added!", "Success");
                    }
                    else
                    {
                        MessageBox.Show("Sorry! Error occured!", "Error");
                    }
                });
            }

            EmployeeIdTextBox.Clear();
            EmployeeNameTextBox.Clear();
            RankTextBox.Clear();
            FacutlyComboBox.SelectedIndex    = -1;
            DepartmentComboBox.SelectedIndex = -1;
            CenterComboBox.SelectedIndex     = -1;
            BuildingComboBox.SelectedIndex   = -1;
            LevelComboBox.SelectedIndex      = -1;

            LecturerDataList.Clear();
            _ = this.LoadLecturerData();
        }