-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
137 lines (111 loc) · 4.01 KB
/
main.c
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
#include<stdio.h>
#include"STD_TYPES.h"
#include"Slot_LinkedList.h"
#include"Double_LinkedList.h"
#include"Config.h"
Node * NewPatient ;
Slot * NewSlot;
//slot * temp1 = temp;
void main (void)
{
s32 ch ;
s32 pass ;
s32 op ;
u8 i;
s32 P_ID;
NewSlot = CreateSlotList(NewSlot);
printf(" ** ** ** ** ** Welcome To Doctor's Clinic ** ** ** ** **\n");
printf("\n");
while(1)
{
printf("Choose:\n1 for Admin mode\n2 for User mode\n ");
scanf("%d",&ch);
if(ch == 1)
{
printf("Enter Your Password Please .. \n");
scanf("%d",&pass);
for(i=2;i>0;i--)
{
if(pass == PASSWORD)
{
break;
}
else
{
printf("Sorry You've entered Wrong Password, %d trials available\n",i);
printf("please Enter Your Password Again..\n");
scanf("%d",&pass);
}
}
printf("==========================================================================\n");
printf(" Welcome Doctor \n");
printf("==========================================================================\n");
printf(" Choose your operation \n");
printf("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n");
printf("1- Add new patient record\n2- Edit patient record\n3-Reserve a slot with the doctor\n4- Cancel reservation\n ");
scanf("%d",&op);
if(op == 1)
{
printf(" ---------- You Can Add More than one Patient Doctor ----------------\n");
printf("----------------------------------------------------------------------\n");
NewPatient = Add_New_Patient_Record (NewPatient);
DisplayList(NewPatient);
}
else if(op == 2)
{
s32 x;
printf("Enter Patient Id will be edited\n");
scanf("%d",&x);
NewPatient = Edit_Patient_Record(NewPatient,x);
DisplayList(NewPatient);
}
else if(op == 3)
{
printf(" ------- -- Time Intervals -- ------- \n");
printf("\n===================================================================\n");
printf("\n 1- 2pm to 2:30pm\n \n2- 2:30pm to 3pm \n\n3- 3pm to 3:30pm \n\n4-4pm to 4:30pm \n\n5- 4:30pm to 5pm \n\n");
printf("\n------------------------------------------------------------------------\n");
printf("\n ------- -- Available Time Intervals Till Now -- ------- \n");
DisplaySlotList(NewSlot);
NewSlot = Reserve_New_Slot(NewSlot);
}
else if (op == 4)
{
NewPatient = Cancel_Resrvation (NewPatient) ;
}
else
{
printf("operation Choosed Incorrect\n");
}
}
else if (ch == 2)
{
printf("==========================================================================\n");
printf(" Welcome User \n");
printf("==========================================================================\n");
printf(" Choose your operation \n");
printf("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n");
printf("1- View Patient Record\n2- View Today's Reservations\n");
scanf("%d",&op);
if(op == 1)
{
printf("Please Enter Patient ID \n");
scanf("%d",&P_ID);
View_Patient_Record(NewPatient,P_ID);
}
else if (op == 2)
{
printf(" ------- -- Time Intervals -- ------- \n");
printf("\n===================================================================\n");
printf("\n 1- 2pm to 2:30pm\n \n2- 2:30pm to 3pm \n\n3- 3pm to 3:30pm \n\n4-4pm to 4:30pm \n\n5- 4:30pm to 5pm \n\n");
printf("\n------------------------------------------------------------------------\n");
printf("\n ------- -- Reserved Time Intervals Till Now -- ------- \n");
View_Reservations(temp);
}
}
else
{
printf("Sorry You Entered Wrong Input\n");
}
}
}