-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDoctorsAppointmentUserControl.cs
341 lines (239 loc) · 8.96 KB
/
DoctorsAppointmentUserControl.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OOP_Project___Hospital_Management_System
{
public partial class DoctorsAppointmentUserControl : UserControl
{
public DoctorsAppointmentUserControl()
{
InitializeComponent();
dateTimePicker1.Value = DateTime.Today;
}
public string ID { get; set; }
public void display()
{
DatabaseOps databaseOps = new DatabaseOps();
dataGridViewINP.DataSource = databaseOps.doctorAppointment();
}
public void patientList()
{
comboBoxpatient.Items.Clear();
DatabaseOps databaseOps = new DatabaseOps();
DataTable dataTable = new DataTable();
dataTable = databaseOps.patientList();
comboBoxpatient.DataSource = dataTable;
comboBoxpatient.DisplayMember = "PAT_NAME" ;
comboBoxpatient.ValueMember = "ID";
}
public void DoctorList()
{
comboBoxDoctor.Items.Clear();
DatabaseOps databaseOps = new DatabaseOps();
comboBoxDoctor.DataSource = databaseOps.doctorList(); ;
comboBoxDoctor.DisplayMember = "DOC_NAME";
comboBoxDoctor.ValueMember = "ID";
}
public void TimeSlotlist()
{
//comboBoxslots.Items.Clear();
DatabaseOps databaseOps = new DatabaseOps();
comboBoxslots.DataSource = databaseOps.timeslotlist(Convert.ToInt32(comboBoxDoctor.SelectedValue.ToString())); ;
comboBoxslots.DisplayMember = "slotdec";
comboBoxslots.ValueMember = "id";
}
private void DoctorsAppointmentUserControl_Load(object sender, EventArgs e)
{
display();
patientList();
DoctorList();
}
private void dataGridViewINP_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
comboBoxDoctor.Text = "";
comboBoxpatient.Text = "";
comboBoxslots.Text = "";
textBoxAppointmentID.Text = dataGridViewINP.Rows[e.RowIndex].Cells[0].Value.ToString();
comboBoxDoctor.Text = dataGridViewINP.Rows[e.RowIndex].Cells[1].Value.ToString();
comboBoxpatient.Text = dataGridViewINP.Rows[e.RowIndex].Cells[2].Value.ToString();
dateTimePicker1.Value = Convert.ToDateTime(dataGridViewINP.Rows[e.RowIndex].Cells[3].Value.ToString());
comboBoxslots.Text = "";
comboBoxslots.Text = dataGridViewINP.Rows[e.RowIndex].Cells[4].Value.ToString();
}
private void buttonCancelAppointment_Click(object sender, EventArgs e)
{
if(textBoxAppointmentID.Text.Length != 0)
{
DatabaseOps databaseOps = new DatabaseOps();
int oldslotid = databaseOps.gettimeslotidfromappointment(textBoxAppointmentID.Text);
databaseOps.updatetimeslotavailability(oldslotid, 1);
databaseOps.delete("APPOINTMENT", textBoxAppointmentID.Text);
display();
}
else
{
MessageBox.Show("Unable to Cancel Appointment, Select a row which you want to Cancel", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonReschedule_Click(object sender, EventArgs e)
{
Appointment appointment = new Appointment();
appointment.AppointmentID = textBoxAppointmentID.Text;
appointment.AppointmentDate = Convert.ToDateTime(dateTimePicker1.Value.ToString("yyyy-MM-dd"));
appointment.TimeslotID = Convert.ToInt32(comboBoxslots.SelectedValue.ToString());
appointment.DoctorID = Convert.ToInt32(comboBoxDoctor.SelectedValue.ToString());
appointment.PatientID = Convert.ToInt32(comboBoxpatient.SelectedValue.ToString());
DatabaseOps update = new DatabaseOps();
int oldslotid = update.gettimeslotidfromappointment(appointment.AppointmentID);
update.updatetimeslotavailability(oldslotid, 1);
update.update(appointment);
update.updatetimeslotavailability(appointment.TimeslotID, 0);
display();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
private void comboBoxDoctor_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void comboBoxDoctor_SelectionChangeCommitted(object sender, EventArgs e)
{
TimeSlotlist();
}
private void button1_Click(object sender, EventArgs e)
{
Appointment appointment = new Appointment();
appointment.AppointmentDate = dateTimePicker1.Value;
appointment.TimeslotID = Convert.ToInt32(comboBoxslots.SelectedValue.ToString());
appointment.DoctorID = Convert.ToInt32(comboBoxDoctor.SelectedValue.ToString());
appointment.PatientID = Convert.ToInt32(comboBoxpatient.SelectedValue.ToString());
DatabaseOps insert = new DatabaseOps();
insert.insert(appointment);
insert.updatetimeslotavailability(appointment.TimeslotID, 0);
display();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBoxTel_TextChanged(object sender, EventArgs e)
{
}
private void label9_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void textBoxName_TextChanged(object sender, EventArgs e)
{
}
private void textBoxDesignation_TextChanged(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBoxid_TextChanged(object sender, EventArgs e)
{
}
private void dateTimePickerENDTIME_ValueChanged(object sender, EventArgs e)
{
}
private void dataGridViewINP_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void comboBoxSearchBy_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void label15_Click(object sender, EventArgs e)
{
}
private void label11_Click(object sender, EventArgs e)
{
}
private void label16_Click(object sender, EventArgs e)
{
}
private void textBoxAppointmentID_TextChanged(object sender, EventArgs e)
{
}
private void label17_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label10_Click(object sender, EventArgs e)
{
}
private void label18_Click(object sender, EventArgs e)
{
}
private void label19_Click(object sender, EventArgs e)
{
}
private void textBoxEmail_TextChanged(object sender, EventArgs e)
{
}
private void label6_Click(object sender, EventArgs e)
{
}
private void textBoxDepartment_TextChanged(object sender, EventArgs e)
{
}
private void label8_Click(object sender, EventArgs e)
{
}
private void textBoxAddress_TextChanged(object sender, EventArgs e)
{
}
private void label7_Click(object sender, EventArgs e)
{
}
private void label20_Click(object sender, EventArgs e)
{
}
private void Content_Paint(object sender, PaintEventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void comboBoxslots_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void comboBoxpatient_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void comboBoxGender_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
private void buttonDisplay_Click(object sender, EventArgs e)
{
}
private void buttonUpdate_Click(object sender, EventArgs e)
{
}
private void buttonDelete_Click(object sender, EventArgs e)
{
}
private void buttonInsert_Click(object sender, EventArgs e)
{
}
private void textBoxSearch_TextChanged(object sender, EventArgs e)
{
}
}
}