-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBusAutomation.cpp
More file actions
370 lines (317 loc) · 8.24 KB
/
BusAutomation.cpp
File metadata and controls
370 lines (317 loc) · 8.24 KB
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
//MIT License
//Copyright(c) 2020 Semih Aydın
//UTF - 8
//Display Languague : Turkish
#include <iostream>
#include <locale.h>
#include <cstdlib>
#include <fstream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <windows.h>
#include "Customer.h"
#include "Worker.h"
#include "Expeditions.h"
#include "Tickets.h"
using namespace std;
int main()
{
//Turkish
setlocale(LC_ALL, "Turkish");
Customer c;
Worker w;
Expeditions e;
Tickets t;
int choice, due = 3, result = 0;
cout << "Merhaba , otobüs otomasyonuna hoşgeldiniz. Lütfen seçim yapınız." << endl;
MainMenu:
cout << "1-Müşteri Girişi\n2-Yetkili Girişi\n3-Müşteri Kaydı\n9-Çıkış\nSeçiminiz :";
cin >> choice;
do
{
switch (choice)
{
case 1:
system("cls");
CustomerLoginAGAIN:
result = c.CustomerLogin();
if (result == 2)
{
system("cls");
cout << "Giriş başarılı.Müşteri paneline yönlendiriliyor..." << endl;
Sleep(2000);
system("cls");
int CustomerChoice1;
CustomerAGAIN1:
cout << "-----Müşteri Paneli-----\n1-Bilet Al\n2-Biletlerim\n3-Çıkış Yap\n9-Kullanıcı İşlemleri\nSeçiminiz :";
cin >> CustomerChoice1;
switch (CustomerChoice1)
{
case 1:
system("cls");
t.GetTicketID();
if (t.AddTicket(c.LoggedUserID) == 1)
{
system("cls");
cout << "Bilet alımı başarıyla gerçekleştirildi." << endl;
goto CustomerAGAIN1;
}
break;
case 2:
system("cls");
int secim;
t.CustomerTickets(c.LoggedUserID);
CustomerAGAINx:
cout << "Geri dönmek için 9 tuşuna basınız :";
cin >> secim;
if (secim != 9)
{
cout << "Hatalı tuşlama yaptınız." << endl;
goto CustomerAGAINx;
}
else
{
system("cls");
goto CustomerAGAIN1;
}
break;
case 3:
system("cls");
cout << "Çıkış yapıldı..." << endl;
goto MainMenu;
break;
case 9:
system("cls");
int CustomerChoice2;
CustomerAGAIN2:
cout << "---Kullanıcı İşlemleri---\n1-Şifre Güncelleme\n2-Hesap Kapatma\nSeçiminiz :";
cin >> CustomerChoice2;
switch (CustomerChoice2)
{
case 1:
if (c.CustomerChangePassword(c.LoggedUserID) == 1)
{
cout << "Şifre değiştirme işlemi başarıyla tamamlandı.Ana menüye geri dönülüyor...";
Sleep(2000);
system("cls");
goto MainMenu;
}
break;
case 2:
if (c.CustomerDeregistration(c.LoggedUserID) == 1)
{
cout << "Hesap kapatma işlemi başarıyla tamamlandı.Ana menüye geri dönülüyor...";
Sleep(2000);
system("cls");
goto MainMenu;
}
break;
default:
system("cls");
cout << "Hatalı seçim yaptınız.Lütfen tekrar seçim yapınız" << endl;
goto CustomerAGAIN2;
break;
}
break;
default:cout << "Hatalı seçim yaptınız.Lütfen tekrar seçim yapınız" << endl;
goto CustomerAGAIN1;
break;
}
}
else if (result == 1)
{
system("cls");
cout << "Bu müşteri hesabı kapatılmıştır.Ana menüye yönlendiriliyorsunuz..." << endl;
Sleep(2500);
system("cls");
goto MainMenu;
}
else
{
system("cls");
due--;
cout << "Giriş başarısız. Kalan hak sayınız :" << due << endl;
if (due == 0)
{
cout << "Çok fazla hatalı oturum açma girişiminde bulundunuz.Program kapatılıyor.";
Sleep(2500);
exit(0);
}
else
{
goto CustomerLoginAGAIN;
}
}
break;
case 2:
system("cls");
WorkerLoginAGAIN:
result = w.WorkerLogin();
if (result == 2)
{
system("cls");
cout << "Giriş başarılı.Yetkili paneline yönlendiriliyor..." << endl;
Sleep(2000);
system("cls");
WorkerAGAIN1:
cout << "-----Yetkili Paneli-----\n1-Sefer Ekle\n2-Sefer Düzenle\n3-Bilet İşlemleri\n4-Çıkış Yap\n9-Yetkili İşlemleri\nSeçiminiz :" << endl;
int WorkerChoice1, WorkerChoice2;
cin >> WorkerChoice1;
switch (WorkerChoice1)
{
case 1:
system("cls");
e.GetExID();
if (e.AddExpedition() == 1)
{
system("cls");
cout << "Sefer ekleme işleminiz başarıyla gerçekleştirildi." << endl;
goto WorkerAGAIN1;
}
break;
case 2:
system("cls");
if (e.EditExpedition(w.LoggedWorkerID) == 1)
{
system("cls");
cout << "Sefer düzenleme işlemi başarıyla tamamlandı." << endl;
goto WorkerAGAIN1;
}
else
{
goto WorkerAGAIN1;
}
break;
case 3:
system("cls");
cout << "---Bilet İşlemleri---\n1-Bilet Düzenleme\n2-Bilet Sil\nSeçiminiz :";
cin >> WorkerChoice2;
switch (WorkerChoice2)
{
case 1:
system("cls");
if (t.EditTicket() == 1)
{
system("cls");
cout << "Bilet düzenleme işlemi başarılı." << endl;
goto WorkerAGAIN1;
}
break;
case 2:
system("cls");
if (t.DeletingTicket(w.LoggedWorkerID) == 1)
{
system("cls");
cout << "Bilet silme işlemi başarıyla tamamlandı." << endl;
goto WorkerAGAIN1;
}
else
{
goto WorkerAGAIN1;
}
break;
default:
break;
}
break;
case 4:
system("cls");
cout << "Çıkış yapıldı..." << endl;
goto MainMenu;
break;
case 9:
system("cls");
WorkerAGAIN2:
cout << "---Yetkili İşlemleri---\n1-Şifre Güncelleme\n2-Hesap Kapatma\n3-Yeni Çalışan Kaydı Ekle\nSeçiminiz :";
cin >> WorkerChoice2;
switch (WorkerChoice2)
{
case 1:
system("cls");
if (w.WorkerResetPassword(w.LoggedWorkerID) == 1)
{
cout << "Şifre değiştirme işlemi başarıyla tamamlandı.Ana menüye geri dönülüyor...";
Sleep(2000);
system("cls");
goto MainMenu;
}
break;
case 2:
system("cls");
if (w.WorkerDeregistration(w.LoggedWorkerID) == 1)
{
cout << "Hesap kapatma işlemi başarıyla tamamlandı.Ana menüye geri dönülüyor...";
Sleep(2000);
system("cls");
goto MainMenu;
}
break;
case 3:
system("cls");
w.GetWorkerID();
if (w.WorkerRegistration() == 1)
{
system("cls");
cout << "Kayıt işleminiz başarıyla gerçekleştirildi." << endl;
goto WorkerAGAIN1;
}
break;
default:system("cls");
cout << "Hatalı seçim yaptınız.Lütfen tekrar seçim yapınız" << endl;
goto WorkerAGAIN2;
break;
}
break;
default:
system("cls");
cout << "Hatalı seçim yaptınız.Lütfen tekrar seçim yapınız" << endl;
goto WorkerAGAIN1;
break;
}
}
else if (result == 1)
{
system("cls");
cout << "Bu yetkili hesabı kapatılmıştır.Ana menüye yönlendiriliyorsunuz..." << endl;
Sleep(2500);
goto MainMenu;
}
else
{
system("cls");
due--;
cout << "Giriş başarısız. Kalan hak sayınız :" << due << endl;
if (due == 0)
{
cout << "Çok fazla hatalı oturum açma girişiminde bulundunuz.Program kapatılıyor.";
Sleep(2500);
exit(0);
}
else
{
goto WorkerLoginAGAIN;
}
}
break;
case 3:
system("cls");
c.CustomerUserID();
if (c.CustomerRegistration() == 1)
{
system("cls");
cout << "Kayıt işleminiz başarıyla gerçekleştirildi.Giriş yapabilirsiniz." << endl;
goto MainMenu;
}
break;
case 9:
exit(0);
break;
default:
system("cls");
cout << "Hatalı seçim yaptınız.Lütfen tekrar seçim yapınız" << endl;
goto MainMenu;
}
} while (choice != 1 && choice != 2 && choice != 9);
return 0;
}