-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeWindow.xaml.cs
125 lines (116 loc) · 3.9 KB
/
HomeWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Classes;
namespace ftn_sims_hci_hospital
{
/// <summary>
/// Interaction logic for HomeWindow.xaml
/// </summary>
public partial class HomeWindow : Window
{
public HomeWindow()
{
InitializeComponent();
initMenu();
menu.SelectedItem = menu.Items[0];
updateDoctorsList();
}
private void initMenu()
{
menu.Items.Add("Home");
menu.Items.Add("Your Profile");
menu.Items.Add("Patients");
menu.Items.Add("Appointments");
menu.Items.Add("Notifications");
menu.Items.Add("Exchange Patient Info");
}
private void menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int index = menu.SelectedIndex;
switch (index)
{
case 0:
break;
case 1:
Window profile = new ProfileWindow();
this.Hide();
profile.ShowDialog();
this.Close();
break;
case 2:
Window patients = new SecretaryPatients();
this.Hide();
patients.ShowDialog();
this.Close();
break;
case 3:
Window appointments = new SecretaryAppointments();
this.Hide();
appointments.ShowDialog();
this.Close();
break;
case 4:
Window notifications = new NotificationBoard();
this.Hide();
notifications.ShowDialog();
this.Close();
break;
}
}
private void btncreatedoctor_Click(object sender, RoutedEventArgs e)
{
Window secretaryCreateDoctor = new SecretaryCreateDoctor();
secretaryCreateDoctor.ShowDialog();
doctorData.Items.Clear();
updateDoctorsList();
}
private void btnviewdoctor_Click(object sender, RoutedEventArgs e)
{
if (!doctorData.Items.IsEmpty)
{
if (doctorData.SelectedItem != null)
{
Doctor selectedDoctor = (Doctor)doctorData.SelectedItem;
String id = selectedDoctor.user.Jmbg1;
Window doctorView = new SecretaryViewDoctor(id);
doctorView.ShowDialog();
doctorData.Items.Clear();
updateDoctorsList();
}
}
}
private void updateDoctorsList()
{
List<Doctor> allDoctors = MainWindow.doctorController.GetAll();
foreach (Doctor doctor in allDoctors)
{
doctorData.Items.Add(new Doctor { user = doctor.user, specialization = doctor.specialization });
}
}
private void btndeletedoctor_Click(object sender, RoutedEventArgs e)
{
if (!doctorData.Items.IsEmpty)
{
if (doctorData.SelectedItem != null)
{
String id = ((Doctor)doctorData.SelectedItem).user.Jmbg1;
MainWindow.doctorController.Delete(id);
MessageBox.Show("You have successfuly deleted a doctor!");
doctorData.Items.Clear();
updateDoctorsList();
}
}
}
}
}