Advertisement
Guest User

sdgsgsdg

a guest
Nov 20th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.58 KB | None | 0 0
  1. #include "Corporation.h"
  2.  
  3. using namespace std;
  4.  
  5. Utilities u1;
  6. Menu corpMenu;
  7.  
  8. Corporation * Corporation::instance()
  9. {
  10.  
  11. if (!singleton_instance) {
  12. singleton_instance = new Corporation;
  13. }
  14.  
  15. return singleton_instance;
  16. }
  17.  
  18. void Corporation::login() {
  19.  
  20. string password, user;
  21. bool foundUser = false;
  22. bool foundSupplier = false;
  23.  
  24. cout << "Username: ";
  25. getline(cin, user);
  26.  
  27. if (cin.eof()) {
  28. u1.cancelMessage();
  29. corpMenu.MainMenu();
  30. }
  31.  
  32. cout << "\nPassword: "; cin >> password;
  33.  
  34. u1.cinClear();
  35.  
  36. if (cin.eof()) {
  37. u1.cancelMessage();
  38. corpMenu.MainMenu();
  39. }
  40.  
  41. for (size_t i = 0; i != usersVec.size(); i++) {
  42. if (usersVec.at(i).getUsername() == user && usersVec.at(i).getPassword() == password) {
  43. Corporation::instance()->username = user;
  44. foundUser = true;
  45. u1.clearScreen();
  46. corpMenu.UsersMenu();
  47. return;
  48. }
  49. }
  50.  
  51. for (size_t i = 0; i != suppliersVec.size(); i++) {
  52. if (suppliersVec.at(i).getName() == user && suppliersVec.at(i).getPassword() == password) {
  53. Corporation::instance()->supplierName = user;
  54. foundSupplier = true;
  55. u1.clearScreen();
  56. corpMenu.SuppliersMenu();
  57. return;
  58. }
  59. }
  60.  
  61. if (!foundUser && !foundSupplier) {
  62. cout << "\n ERROR: The username/password you inserted do not exist.";
  63. Sleep(1500);
  64. u1.cinClear();
  65. return;
  66. }
  67.  
  68. }
  69.  
  70. //Checks existance of the users file
  71. bool Corporation::foundUsersFile(string usersFile) {
  72.  
  73. fstream f;
  74.  
  75. f.open(usersFile);
  76.  
  77. if (f.fail()) {
  78. f.close();
  79. u1.setColor(12); cerr << "\n ERROR: " << usersFile << " (users file) could not be found!\n Verify the directory!\n\n"; u1.setColor(15);
  80. return false;
  81. }
  82.  
  83. f.close();
  84.  
  85. this->usersFile = usersFile;
  86. return true;
  87. }
  88.  
  89. //Loads the users file to memory (Users vector)
  90. void Corporation::loadUsers() {
  91.  
  92. string line;
  93. fstream f;
  94.  
  95. f.open(usersFile);
  96.  
  97. while (getline(f, line)) {
  98.  
  99. string username = line.substr(0, line.find(" ; "));
  100. line.erase(0, line.find(" ; ") + 3);
  101. string password = line.substr(0, line.find(" ; "));
  102. line.erase(0, line.find(" ; ") + 3);
  103. unsigned int nif = stoi(line.substr(0, line.find(" ; ")));
  104. line.erase(0, line.find(" ; ") + 3);
  105. unsigned int points = stoi(line.substr(0, line.length()));
  106.  
  107. usersVec.push_back(Users(username, password, nif, points));
  108. }
  109. f.close();
  110. return;
  111. }
  112.  
  113. //Loads memory to the users file
  114. void Corporation::saveUsers() {
  115.  
  116. ofstream f("temp.txt");
  117.  
  118. for (size_t i = 0; i < usersVec.size(); i++) {
  119. f << usersVec[i].getUsername() << " ; " << usersVec[i].getPassword() << " ; " << usersVec[i].getNif() << " ; " << usersVec[i].getPoints() << endl;
  120. }
  121.  
  122. f.close();
  123.  
  124. remove(usersFile.c_str());
  125. rename("temp.txt", usersFile.c_str());
  126.  
  127. return;
  128. }
  129.  
  130. //Adds a user to the users vector
  131. void Corporation::registerUser() {
  132.  
  133. string user, password, nif;
  134.  
  135. cout << "\n Name: "; getline(cin, user);
  136.  
  137. if (cin.eof()) {
  138. u1.cancelMessage();
  139. corpMenu.RegisterMenu();
  140. }
  141.  
  142. for (unsigned int index = 0; index != user.size(); index++) {
  143. if (!isalpha(user[index]) && user[index] != ' ') {
  144. u1.setColor(12); cerr << " ERROR: Name must only contain alphabetic characters. "; u1.setColor(15);
  145. Sleep(3000);
  146. u1.clearScreen();
  147. u1.cinClear();
  148. corpMenu.RegisterMenu();
  149. }
  150. }
  151.  
  152. for (unsigned int index2 = 0; index2 != usersVec.size(); index2++) {
  153. if (usersVec.at(index2).getUsername() == user) {
  154. u1.setColor(12); cerr << " ERROR: The username you selected already exists. Please choose another one. "; u1.setColor(15);
  155. Sleep(3000);
  156. u1.clearScreen();
  157. u1.cinClear();
  158. corpMenu.RegisterMenu();
  159. }
  160. }
  161.  
  162. cout << "\n Password: "; cin >> password;
  163.  
  164. u1.cinClear();
  165.  
  166. for (unsigned int index3 = 0; index3 != password.size(); index3++) {
  167. if (!isalnum(password[index3])) {
  168. u1.setColor(12); cerr << " ERROR: Password cannot contain special characters. "; u1.setColor(15);
  169. Sleep(3000);
  170. u1.clearScreen();
  171. corpMenu.RegisterMenu();
  172. }
  173. }
  174.  
  175. cout << "\n NIF: "; cin >> nif;
  176. u1.cinClear();
  177.  
  178. for (unsigned int index4 = 0; index4 != nif.size(); index4++) {
  179. if (!isdigit(nif[index4])) {
  180. u1.setColor(12); cerr << " ERROR: NIF can only contain digits. "; u1.setColor(15);
  181. Sleep(3000);
  182. u1.clearScreen();
  183. corpMenu.RegisterMenu();
  184. }
  185. }
  186.  
  187. for (unsigned int index5 = 0; index5 != usersVec.size(); index5++) {
  188. if (usersVec.at(index5).getNif() == stoi(nif)) {
  189. u1.setColor(12); cerr << " ERROR: The NIF you selected was already found in our system. Probably you already have an account. "; u1.setColor(15);
  190. Sleep(3000);
  191. u1.clearScreen();
  192. corpMenu.RegisterMenu();
  193. }
  194.  
  195. }
  196.  
  197. if (nif.size() != 9) {
  198. u1.setColor(12); cerr << " ERROR: The NIF must have 9 digits. "; u1.setColor(15);
  199. Sleep(3000);
  200. u1.clearScreen();
  201. corpMenu.RegisterMenu();
  202. }
  203.  
  204. if (cin.eof()) {
  205. u1.cancelMessage();
  206. corpMenu.RegisterMenu();
  207. }
  208.  
  209. usersVec.push_back(Users(user, password, stoi(nif), 0));
  210. u1.clearScreen();
  211. return;
  212. }
  213.  
  214. bool Corporation::foundSuppliersFile(string suppliersFile) {
  215.  
  216. fstream f;
  217.  
  218. f.open(suppliersFile);
  219.  
  220. if (f.fail()) {
  221. f.close();
  222. u1.setColor(12); cerr << "\n ERROR: " << suppliersFile << " (suppliers file) could not be found!\n Verify the directory!\n\n"; u1.setColor(15);
  223. return false;
  224. }
  225.  
  226. f.close();
  227.  
  228. this->suppliersFile = suppliersFile;
  229. return true;
  230. }
  231.  
  232. void Corporation::loadRents()
  233. {
  234. Rent tmp;
  235. fstream r;
  236. float price;
  237. r.open("rents.txt");
  238. string lineRents;
  239. while (getline(r, lineRents)) {
  240. int nif = stoi(u1.trim(lineRents.substr(0, lineRents.find(" ; "))));
  241. lineRents.erase(0, lineRents.find(" ; ") + 3);
  242.  
  243. string typeRent = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  244. lineRents.erase(0, lineRents.find(" ; ") + 3);
  245. if (typeRent == "Hotel") {
  246. string nameHotel = lineRents.substr(0, lineRents.find(" ; "));
  247. lineRents.erase(0, lineRents.find(" ; ") + 3);
  248. string city = lineRents.substr(0, lineRents.find(" ; "));
  249. lineRents.erase(0, lineRents.find(" ; ") + 3);
  250. unsigned int startDay = stoi(lineRents.substr(0, lineRents.find("/")));
  251. lineRents.erase(0, lineRents.find("/") + 1);
  252. unsigned int startMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  253. lineRents.erase(0, lineRents.find("/") + 1);
  254. unsigned int startYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  255. lineRents.erase(0, lineRents.find(" ; ") + 3);
  256. unsigned int endDay = stoi(lineRents.substr(0, lineRents.find("/")));
  257. lineRents.erase(0, lineRents.find("/") + 1);
  258. unsigned int endMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  259. lineRents.erase(0, lineRents.find("/") + 1);
  260. unsigned int endYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  261. lineRents.erase(0, lineRents.find(" ; ") + 3);
  262. string roomType = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  263. lineRents.erase(0, lineRents.find(" ; ") + 3);
  264. price = stof(lineRents.substr(0, lineRents.find(" ; ")));
  265. lineRents.erase(0, lineRents.find(" ; ") + 3);
  266. unsigned int numPeople = stoi(lineRents);
  267. lineRents.erase(0, lineRents.length());
  268. tmp = Hotel(nif, typeRent, nameHotel, city, Date(startDay, startMonth, startYear), Date(endDay, endMonth, endYear), roomType, price, numPeople);
  269.  
  270. }
  271. else if (typeRent == "Bed'n'Breakfast") {
  272. string nameBB = lineRents.substr(0, lineRents.find(" ; "));
  273. lineRents.erase(0, lineRents.find(" ; ") + 3);
  274. string city = lineRents.substr(0, lineRents.find(" ; "));
  275. lineRents.erase(0, lineRents.find(" ; ") + 3);
  276. unsigned int startDay = stoi(lineRents.substr(0, lineRents.find("/")));
  277. lineRents.erase(0, lineRents.find("/") + 1);
  278. unsigned int startMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  279. lineRents.erase(0, lineRents.find("/") + 1);
  280. unsigned int startYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  281. lineRents.erase(0, lineRents.find(" ; ") + 3);
  282. unsigned int endDay = stoi(lineRents.substr(0, lineRents.find("/")));
  283. lineRents.erase(0, lineRents.find("/") + 1);
  284. unsigned int endMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  285. lineRents.erase(0, lineRents.find("/") + 1);
  286. unsigned int endYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  287. lineRents.erase(0, lineRents.find(" ; ") + 3);
  288. price = stof(lineRents.substr(0, lineRents.find(" ; ")));
  289. lineRents.erase(0, lineRents.find(" ; ") + 3);
  290. unsigned int numPeople = stoi(lineRents);
  291. lineRents.erase(0, lineRents.length());
  292.  
  293. tmp = bedNbreakfast(nif, typeRent, nameBB, city, Date(startDay, startMonth, startYear), Date(endDay, endMonth, endYear), price, numPeople);
  294.  
  295. }
  296. else if (typeRent == "Shared House") {
  297. string nameSH = lineRents.substr(0, lineRents.find(" ; "));
  298. lineRents.erase(0, lineRents.find(" ; ") + 3);
  299. string city = lineRents.substr(0, lineRents.find(" ; "));
  300. lineRents.erase(0, lineRents.find(" ; ") + 3);
  301. unsigned int startDay = stoi(lineRents.substr(0, lineRents.find("/")));
  302. lineRents.erase(0, lineRents.find("/") + 1);
  303. unsigned int startMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  304. lineRents.erase(0, lineRents.find("/") + 1);
  305. unsigned int startYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  306. lineRents.erase(0, lineRents.find(" ; ") + 3);
  307. unsigned int endDay = stoi(lineRents.substr(0, lineRents.find("/")));
  308. lineRents.erase(0, lineRents.find("/") + 1);
  309. unsigned int endMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  310. lineRents.erase(0, lineRents.find("/") + 1);
  311. unsigned int endYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  312. lineRents.erase(0, lineRents.find(" ; ") + 3);
  313. price = stof(lineRents.substr(0, lineRents.find(" ; ")));
  314. lineRents.erase(0, lineRents.find(" ; ") + 3);
  315. unsigned int numPeople = stoi(lineRents);
  316. lineRents.erase(0, lineRents.length());
  317. tmp = sharedHouse(nif, typeRent, nameSH, city, Date(startDay, startMonth, startYear), Date(endDay, endMonth, endYear), price, numPeople);
  318.  
  319. }
  320. else if (typeRent == "Flat") {
  321. string nameFlat = lineRents.substr(0, lineRents.find(" ; "));
  322. lineRents.erase(0, lineRents.find(" ; ") + 3);
  323. string city = lineRents.substr(0, lineRents.find(" ; "));
  324. lineRents.erase(0, lineRents.find(" ; ") + 3);
  325. unsigned int startDay = stoi(lineRents.substr(0, lineRents.find("/")));
  326. lineRents.erase(0, lineRents.find("/") + 1);
  327. unsigned int startMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  328. lineRents.erase(0, lineRents.find("/") + 1);
  329. unsigned int startYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  330. lineRents.erase(0, lineRents.find(" ; ") + 3);
  331. unsigned int endDay = stoi(lineRents.substr(0, lineRents.find("/")));
  332. lineRents.erase(0, lineRents.find("/") + 1);
  333. unsigned int endMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  334. lineRents.erase(0, lineRents.find("/") + 1);
  335. unsigned int endYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  336. lineRents.erase(0, lineRents.find(" ; ") + 3);
  337. price = stof(lineRents.substr(0, lineRents.find(" ; ")));
  338. lineRents.erase(0, lineRents.find(" ; ") + 3);
  339. unsigned int numPeople = stoi(lineRents);
  340. lineRents.erase(0, lineRents.length());
  341. tmp = flat(nif, typeRent, nameFlat, city, Date(startDay, startMonth, startYear), Date(endDay, endMonth, endYear), price, numPeople);
  342. }
  343. else if (typeRent == "Apartment") {
  344. string nameApartment = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  345. lineRents.erase(0, lineRents.find(" ; ") + 3);
  346. string city = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  347. lineRents.erase(0, lineRents.find(" ; ") + 3);
  348. unsigned int startDay = stoi(lineRents.substr(0, lineRents.find("/")));
  349. lineRents.erase(0, lineRents.find("/") + 1);
  350. unsigned int startMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  351. lineRents.erase(0, lineRents.find("/") + 1);
  352. unsigned int startYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  353. lineRents.erase(0, lineRents.find(" ; ") + 3);
  354. unsigned int endDay = stoi(lineRents.substr(0, lineRents.find("/")));
  355. lineRents.erase(0, lineRents.find("/") + 1);
  356. unsigned int endMonth = stoi(lineRents.substr(0, lineRents.find("/")));
  357. lineRents.erase(0, lineRents.find("/") + 1);
  358. unsigned int endYear = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  359. lineRents.erase(0, lineRents.find(" ; ") + 3);
  360. price = stof(lineRents.substr(0, lineRents.find(" ; ")));
  361. lineRents.erase(0, lineRents.find(" ; ") + 3);
  362. unsigned int numPeople = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  363. int numRooms = stoi(lineRents.substr(0, lineRents.find(" ; ")));
  364. bool k, s, l;
  365. string x = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  366. lineRents.erase(0, lineRents.find(" ; ") + 3);
  367. if (x == "true")
  368. k = true;
  369. else
  370. k = false;
  371. x = u1.trim(lineRents.substr(0, lineRents.find(" ; ")));
  372. lineRents.erase(0, lineRents.find(" ; ") + 3);
  373. if (x == "true")
  374. s = true;
  375. else
  376. s = false;
  377. x = u1.trim(lineRents);
  378. lineRents.erase(0, lineRents.length());
  379. if (x == "true")
  380. l = true;
  381. else
  382. l = false;
  383.  
  384. tmp = apartment(nif, typeRent, nameApartment, city, Date(startDay, startMonth, startYear), Date(endDay, endMonth, endYear), price, numPeople, numRooms, k, s, l);
  385. }
  386. string reservationsLine;
  387. getline(r, reservationsLine);
  388. int numIterations = stoi(u1.trim(reservationsLine.substr(0, reservationsLine.find(" ; "))));
  389. reservationsLine.erase(0, reservationsLine.find(" ; ") + 3);
  390. for (int j = 0; j < numIterations; j++) {
  391.  
  392. float nifR = stoi(u1.trim(reservationsLine.substr(0, reservationsLine.find(" ; "))));
  393. reservationsLine.erase(0, reservationsLine.find(" ; ") + 3);
  394.  
  395. Date d1, d2;
  396. d1 = reservationsLine.substr(0, reservationsLine.find(" ; "));
  397. reservationsLine.erase(0, reservationsLine.find(" ; ") + 3);
  398.  
  399. d2 = reservationsLine.substr(0, reservationsLine.find(" ; "));
  400.  
  401. if (j == (numIterations - 1))
  402. reservationsLine.erase(0, reservationsLine.length());
  403. else
  404. reservationsLine.erase(0, reservationsLine.find(" ; ") + 3);
  405. price = (d2.minus(d1))*price;
  406. Reservation newR(nifR, price, d1, d2);
  407. tmp.setReservation(newR);
  408. }
  409. rentsVec.push_back(tmp);
  410. }
  411. }
  412.  
  413. void Corporation::loadSuppliers() {
  414.  
  415. string line, lineRents;
  416. fstream f;
  417. vector<Rent> xVec;
  418.  
  419. double price;
  420. f.open(suppliersFile);
  421.  
  422. while (getline(f, line)) {
  423.  
  424. string supplierName = line.substr(0, line.find(" ; "));
  425. line.erase(0, line.find(" ; ") + 3);
  426. string password = line.substr(0, line.find(" ; "));
  427. line.erase(0, line.find(" ; ") + 3);
  428. unsigned int nif = stoi(line.substr(0, line.find(" ; ")));
  429. line.erase(0, line.find(" ; ") + 3);
  430. string address = line;
  431. line.erase(0, line.length());
  432.  
  433. suppliersVec.push_back(Supplier(supplierName, password, nif, address));
  434. }
  435.  
  436. f.close();
  437.  
  438. return;
  439. }
  440.  
  441. //Loads suppliersVec to the .txt file
  442. void Corporation::saveSuppliers()
  443. {
  444. ofstream f("tempSuppliers.txt");
  445.  
  446. for (int i = 0; i < suppliersVec.size(); i++)
  447. {
  448. int j;
  449. f << suppliersVec[i].getName() << " ; " << suppliersVec[i].getPassword() << " ; " << suppliersVec[i].getNif() << " ; " << suppliersVec[i].getAddress() << "\n";
  450. }
  451.  
  452.  
  453. f.close();
  454. remove(suppliersFile.c_str());
  455. rename("tempSuppliers.txt", suppliersFile.c_str());
  456.  
  457. return;
  458. }
  459.  
  460. void Corporation::saveRents()
  461. {
  462. int j;
  463. ofstream r("rents.txt");
  464. for (j = 0; j < rentsVec.size(); j++)
  465. {
  466. vector<Rent> x;
  467. x = rentsVec;
  468. if (x[j].getTypeRent() == "Hotel")
  469. {
  470. r << rentsVec[j].getNif() << " ; ";
  471. r << "Hotel ; " << x[j].getName() << " ; " << x[j].getCity() << " ; ";
  472. r << x[j].getDataInicio() << " ; ";
  473. r << x[j].getDataFim() << " ; ";
  474. r << x[j].getType() << " ; " << x[j].getPrice() << " ; " << x[j].getNumPeople();
  475. r << "\n";
  476. }
  477.  
  478. if (x[j].getTypeRent() == "Bed'n'Breakfast")
  479. {
  480. r << rentsVec[j].getNif() << " ; ";
  481. r << "Bed'n'Breakfast ; " << x[j].getName() << " ; " << u1.trim(x[j].getCity()) << " ; ";
  482. r << x[j].getDataInicio() << " ; ";
  483. r << x[j].getDataFim() << " ; ";
  484. r << x[j].getPrice() << " ; " << x[j].getNumPeople();
  485. r << "\n";
  486. }
  487. if (x[j].getTypeRent() == "Shared House")
  488. {
  489. r << rentsVec[j].getNif() << " ; ";
  490. r << "Shared House ; " << x[j].getName() << " ; " << u1.trim(x[j].getCity()) << " ; ";
  491. r << x[j].getDataInicio() << " ; ";
  492. r << x[j].getDataFim() << " ; ";
  493. r << x[j].getPrice() << " ; " << x[j].getNumPeople();
  494. r << "\n";
  495. }
  496. if (x[j].getTypeRent() == "Flat")
  497. {
  498. r << rentsVec[j].getNif() << " ; ";
  499. r << "Flat ; " << x[j].getName() << " ; " << u1.trim(x[j].getCity()) << " ; ";
  500. r << x[j].getDataInicio() << " ; ";
  501. r << x[j].getDataFim() << " ; ";
  502. r << x[j].getPrice() << " ; " << x[j].getNumPeople();
  503. r << "\n";
  504. }
  505. if (x[j].getTypeRent() == "Apartment")
  506. {
  507. r << rentsVec[j].getNif() << " ; ";
  508. r << "Apartment ; " << x[j].getName() << " ; " << u1.trim(x[j].getCity()) << " ; ";
  509. r << x[j].getDataInicio() << " ; ";
  510. r << x[j].getDataFim() << " ; ";
  511. r << x[j].getPrice() << " ; " << x[j].getNumPeople() << " ; ";
  512. r << x[j].getNumRooms() << " ; ";
  513. r << x[j].getKitchen() << " ; " << x[j].getSuite() << " ; " << x[j].getLivingRoom();
  514. r << "\n";
  515. }
  516. if (x[j].getReservations().size() == 0)
  517. r << x[j].getReservations().size() << " ;\n";
  518. else {
  519. r << x.at(j).getReservations().size() << " ; ";
  520. for (int k = 0; k < x.at(j).getReservations().size(); k++)
  521. {
  522. if (k == (x[j].getReservations().size() - 1))
  523. r << x[j].getReservations()[k].getnif() << " ; " << x[j].getReservations()[k].getDate1() << " ; " << x[j].getReservations()[k].getDate2();
  524. else
  525. r << x[j].getReservations()[k].getnif() << " ; " << x[j].getReservations()[k].getDate1() << " ; " << x[j].getReservations()[k].getDate2() << " ; ";
  526. }
  527. r << endl;
  528. }
  529.  
  530. }
  531. r.close();
  532. return;
  533. }
  534.  
  535. //Adds a supplier to the suppliers vector
  536. void Corporation::registerSupplier() {
  537.  
  538. string user, password, nif, address;
  539.  
  540.  
  541. cout << "\n Name: ";
  542. getline(cin, user);
  543.  
  544. if (cin.eof()) {
  545. u1.cancelMessage();
  546. corpMenu.RegisterMenu();
  547. }
  548.  
  549. for (unsigned int index = 0; index != user.size(); index++) {
  550. if (!isalpha(user.at(index)) && user.at(index) != ' ') {
  551. u1.setColor(12); cerr << " ERROR: Name must only contain alphabetic characters. "; u1.setColor(15);
  552. Sleep(1500);
  553. cerr << " ERROR: Name must only contain alphabetic characters. ";
  554. u1.clearScreen();
  555. u1.cinClear();
  556. corpMenu.RegisterMenu();
  557. }
  558. }
  559.  
  560. for (unsigned int index2 = 0; index2 != suppliersVec.size(); index2++) {
  561. if (suppliersVec.at(index2).getName() == user) {
  562. u1.setColor(12); cerr << " ERROR: The username you selected already exists. Please choose another one. "; u1.setColor(15);
  563. Sleep(3000);
  564. u1.clearScreen();
  565. u1.cinClear();
  566. corpMenu.RegisterMenu();
  567. }
  568. }
  569.  
  570. cout << "\n Password: "; cin >> password;
  571.  
  572. u1.cinClear();
  573.  
  574. for (unsigned int index3 = 0; index3 != password.size(); index3++) {
  575. if (!isalnum(password.at(index3))) {
  576. u1.setColor(12); cerr << " ERROR: Password cannot contain special characters. "; u1.setColor(15);
  577. Sleep(3000);
  578. u1.clearScreen();
  579. corpMenu.RegisterMenu();
  580. }
  581. }
  582.  
  583. cout << "\n NIF: "; cin >> nif;
  584. u1.cinClear();
  585.  
  586. for (unsigned int index4 = 0; index4 != nif.size(); index4++) {
  587. if (!isdigit(nif.at(index4))) {
  588. u1.setColor(12); cerr << " ERROR: NIF can only contain digits. "; u1.setColor(15);
  589. Sleep(3000);
  590. u1.clearScreen();
  591. corpMenu.RegisterMenu();
  592. }
  593. }
  594.  
  595. for (unsigned int index5 = 0; index5 != suppliersVec.size(); index5++) {
  596. if (suppliersVec.at(index5).getNif() == stoi(nif)) {
  597. u1.setColor(12); cerr << " ERROR: The NIF you selected was already found in our system. Probably you already have an account. "; u1.setColor(15);
  598. Sleep(3000);
  599. u1.clearScreen();
  600. corpMenu.RegisterMenu();
  601. }
  602.  
  603. }
  604.  
  605. if (nif.size() != 9) {
  606. u1.setColor(12); cerr << " ERROR: The NIF must have 9 digits. "; u1.setColor(15);
  607. Sleep(3000);
  608. u1.clearScreen();
  609. corpMenu.RegisterMenu();
  610. }
  611.  
  612. if (cin.eof()) {
  613. u1.cancelMessage();
  614. corpMenu.RegisterMenu();
  615. }
  616.  
  617. cout << "\n Address: "; cin >> address;
  618.  
  619. u1.cinClear();
  620.  
  621. for (unsigned int i = 0; i != suppliersVec.size(); i++) {
  622. if (suppliersVec.at(i).getAddress() == address) {
  623. u1.setColor(12); cerr << " ERROR: The address you selected was already found in our system. Probably you already have an account. "; u1.setColor(15);
  624. Sleep(3000);
  625. u1.clearScreen();
  626. corpMenu.RegisterMenu();
  627. }
  628. }
  629.  
  630. if (cin.eof()) {
  631. u1.cancelMessage();
  632. corpMenu.RegisterMenu();
  633. }
  634.  
  635. suppliersVec.push_back(Supplier(user, password, stoi(nif), address));
  636. u1.clearScreen();
  637. return;
  638. }
  639.  
  640. //Orders Suppliers
  641. void Corporation::orderSuppliersVec()
  642. {
  643. int i, j;
  644. for (i = 0; i < (suppliersVec.size() - 1); i++) {
  645. for (j = 0; j < suppliersVec.size() - 1; j++)
  646. {
  647. if (suppliersVec[j].getName() > suppliersVec[j + 1].getName())
  648. {
  649. string before, after;
  650. after = suppliersVec[j].getName();
  651. before = suppliersVec[j + 1].getName();
  652. suppliersVec[j + 1].setName(after);
  653. suppliersVec[j].setName(before);
  654. }
  655. }
  656. }
  657.  
  658. }
  659.  
  660. void Corporation::orderRentsVec()
  661. {
  662. int i;
  663. if (rentsVec.size() == 1)
  664. return;
  665. for (i = 0; i < (rentsVec.size() - 1); i++) {
  666. if (rentsVec[i].getPrice() > rentsVec[i + 1].getPrice())
  667. {
  668. Rent before, after;
  669. after = rentsVec[i];
  670. before = rentsVec[i + 1];
  671. rentsVec[i + 1] = after;
  672. rentsVec[i] = before;
  673. }
  674. }
  675.  
  676. }
  677.  
  678. //Adds rent to logged-in supplier
  679. void Corporation::makeRent() {
  680.  
  681. bool isIn = true;
  682. Date d1, d2;
  683. string cinNumIter, cinChoice;
  684. int numIteration, choice;
  685.  
  686. while (isIn) {
  687.  
  688. u1.setColor(14); cout << "\n ::| CREATE RENT |::\n"; u1.setColor(15);
  689.  
  690. cout << "\nHow many rents do you wish to be made available? : ";
  691. cin >> cinNumIter;
  692.  
  693. if (cin.eof()) {
  694. u1.cancelMessage();
  695. corpMenu.SuppliersMenu();
  696. }
  697.  
  698. for (size_t i = 0; i < cinNumIter.size(); i++) {
  699. if (!isdigit(cinNumIter.at(i))) {
  700. u1.setColor(12); cerr << endl << " ERROR: Input can only contain digits. "; u1.setColor(15);
  701. Sleep(1500);
  702. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  703. Sleep(1500);
  704. u1.cinClear();
  705. u1.clearScreen();
  706. }
  707. else {
  708.  
  709. numIteration = stoi(cinNumIter);
  710. cin.clear();
  711. isIn = false;
  712. }
  713. }
  714. }
  715. long nif;
  716. isIn = true;
  717.  
  718. for (int i = 0; i < suppliersVec.size(); i++)
  719. if (suppliersVec[i].getName() == Corporation::instance()->supplierName) {
  720. nif = suppliersVec[i].getNif();
  721. }
  722.  
  723.  
  724. for (int i = 0; i < numIteration; i++) {
  725.  
  726.  
  727. //u1.clearScreen();
  728. cout << "What is the type of rent? \n1 - Hotel\n2 - Bed'n'Breakfast\n3 - Apartment\n4 - Flat\n5 - Shared House\n\n";
  729. cout << "Select the number corresponding to the option you wish to select: ";
  730. cin >> cinChoice;
  731.  
  732. if (cin.eof()) {
  733. u1.cancelMessage();
  734. corpMenu.SuppliersMenu();
  735. }
  736.  
  737. if (stoi(cinChoice) < 1 || stoi(cinChoice) > 5) {
  738. u1.setColor(12); cerr << endl << " ERROR: Input can only range from 1 to 5. "; u1.setColor(15);
  739. Sleep(1500);
  740. u1.cinClear();
  741. corpMenu.SuppliersMenu();
  742. }
  743.  
  744. for (size_t i = 0; i < cinChoice.size(); i++) {
  745. if (!isdigit(cinChoice.at(i))) {
  746. u1.setColor(12); cerr << endl << " ERROR: Input can only contain digits. "; u1.setColor(15);
  747. Sleep(1500);
  748. u1.cinClear();
  749. corpMenu.SuppliersMenu();
  750. }
  751. }
  752.  
  753. choice = stoi(cinChoice);
  754.  
  755.  
  756. if (choice == 1) {
  757. u1.clearScreen();
  758. Hotel h;
  759. rentsVec.push_back(h.buildRent(nif));
  760. }
  761. if (choice == 2) {
  762. u1.clearScreen();
  763. bedNbreakfast bnb;
  764. rentsVec.push_back(bnb.buildRent(nif));
  765. }
  766. if (choice == 3) {
  767. u1.clearScreen();
  768. flat fl;
  769. rentsVec.push_back(fl.buildRent(nif));
  770. break;
  771. }
  772. if (choice == 4) {
  773. u1.clearScreen();
  774. apartment ap;
  775. rentsVec.push_back(ap.buildRent(nif));
  776. break;
  777. }
  778. if (choice == 5) {
  779. u1.clearScreen();
  780. sharedHouse sh;
  781. rentsVec.push_back(sh.buildRent(nif));
  782. break;
  783. }
  784. }
  785. u1.successMessage();
  786.  
  787. return;
  788.  
  789. }
  790.  
  791.  
  792.  
  793. void Corporation::makeReservation() // o unico erro é como dar display das rents e ainda vai haver modificacoes na estrutura da funcao
  794. {
  795.  
  796. string city, nameRent, typeRent, type;
  797. unsigned int n_people, n, counter = 1, option;
  798. bool isIn = true;
  799. float xPrice;
  800.  
  801. #pragma warning(disable : 4996)
  802. time_t ti = time(0);
  803. struct tm * now = localtime(&ti);
  804. unsigned int year = 1900 + now->tm_year, month = 1 + now->tm_mon, day = now->tm_mday;
  805. Date real_date = Date(day, month, year);
  806.  
  807. city = Corporation::instance()->cities();
  808. u1.clearScreen();
  809.  
  810. string dateB, dateE;
  811.  
  812. while (isIn) {
  813. cout << "\nDate of check-in: "; cin >> dateB;
  814.  
  815. Date date1 = Date(dateB);
  816.  
  817. if (cin.eof()) {
  818. u1.cancelMessage();
  819. corpMenu.UsersMenu();
  820. }
  821.  
  822. if (!date1.isValid() || (real_date > date1)) {
  823. u1.setColor(12); cerr << endl << " ERROR: The date you inserted is not valid."; u1.setColor(15);
  824. Sleep(1500);
  825. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  826. Sleep(1500);
  827. u1.cinClear();
  828. u1.clearScreen();
  829. }
  830. else {
  831. u1.cinClear();
  832. isIn = false;
  833. }
  834. }
  835.  
  836. isIn = true;
  837. while (isIn) {
  838. cout << "\nDate of check-out : "; cin >> dateE; cout << endl;
  839.  
  840. Date date2 = Date(dateE);
  841.  
  842. if (cin.eof()) {
  843. u1.cancelMessage();
  844. corpMenu.UsersMenu();
  845. }
  846.  
  847. if (!date2.isValid() || (real_date > date2)) {
  848. u1.setColor(12); cerr << endl << " ERROR: The date you inserted is not valid. Please use the format dd/mm/yyyy"; u1.setColor(15);
  849. Sleep(2000);
  850. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  851. Sleep(1500);
  852. u1.cinClear();
  853. u1.clearScreen();
  854. }
  855. else {
  856. u1.cinClear();
  857. isIn = false;
  858. }
  859. }
  860.  
  861. Date date1 = Date(dateB);
  862. Date date2 = Date(dateE);
  863. Rent * c = nullptr;
  864.  
  865. isIn = true;
  866.  
  867. while (isIn) {
  868. u1.setColor(11); cout << "Rooms available between " << date1 << " and " << date2 << " in " << city << ": \n\n"; u1.setColor(15);
  869.  
  870. for (size_t i = 0; i < rentsVec.size(); i++, counter++) {
  871. if (rentsVec[i].isValid(date1, date2)) {
  872. if (rentsVec.at(i).getTypeRent() == "Hotel") {
  873. cout << "Option " << counter << endl;
  874. cout << "Type of accommodation: " << rentsVec.at(i).getTypeRent() << endl;
  875. cout << "Name: " << rentsVec.at(i).getName() << endl;
  876. cout << "Available from: " << rentsVec.at(i).getDataInicio();
  877. cout << " To: " << rentsVec.at(i).getDataFim() << endl;
  878. cout << "Room type: " << rentsVec.at(i).getType() << endl;
  879. cout << "Price per night: " << rentsVec.at(i).getPrice() << endl;
  880. cout << "Room's capacity: " << rentsVec.at(i).getNumPeople() << endl << endl;
  881. }
  882. else if (rentsVec.at(i).getTypeRent() == "Apartment") {
  883. cout << "Option " << counter << endl;
  884. cout << "Type of accommodation: " << rentsVec.at(i).getTypeRent() << endl;
  885. cout << "Name: " << rentsVec.at(i).getName() << endl;
  886. cout << "Available from: " << rentsVec.at(i).getDataInicio();
  887. cout << " To: " << rentsVec.at(i).getDataFim() << endl;
  888. cout << "Has Kitchen: " << rentsVec.at(i).getKitchen() << endl;
  889. cout << "Has Living Room: " << rentsVec.at(i).getLivingRoom() << endl;
  890. cout << "Has Suite: " << rentsVec.at(i).getSuite() << endl;
  891. cout << "Price per night: " << rentsVec.at(i).getPrice() << endl;
  892. cout << "Room's capacity: " << rentsVec.at(i).getNumPeople() << endl << endl;
  893. }
  894. else {
  895. cout << "Option " << counter << endl;
  896. cout << "Type of accommodation: " << rentsVec.at(i).getTypeRent() << endl;
  897. cout << "Name: " << rentsVec.at(i).getName() << endl;
  898. cout << "Available from: " << rentsVec.at(i).getDataInicio();
  899. cout << " To: " << rentsVec.at(i).getDataFim() << endl;
  900. cout << "Price per night: " << rentsVec.at(i).getPrice() << endl;
  901. cout << "Room's capacity: " << rentsVec.at(i).getNumPeople() << endl << endl;
  902. }
  903. }
  904. }
  905.  
  906. cout << "Insert the option's number: ";
  907. cin >> option;
  908.  
  909. xPrice = rentsVec[option - 1].getPrice();
  910.  
  911. if (cin.eof()) {
  912. u1.cancelMessage();
  913. corpMenu.UsersMenu();
  914. }
  915.  
  916. if (cin.fail()) {
  917. u1.setColor(12); cerr << endl << " ERROR: Input is not an integer."; u1.setColor(15);
  918. Sleep(1500);
  919. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  920. Sleep(1500);
  921. u1.cinClear();
  922. u1.clearScreen();
  923. }
  924. }
  925.  
  926. isIn = true;
  927.  
  928. while (isIn) {
  929. u1.setColor(14); cout << "\n\nCity: " << city << " From: " << date1 << " To: " << date2 << endl;
  930. cout << "\nNumber of people: ";
  931. cin >> n_people;
  932.  
  933. if (cin.eof()) {
  934. u1.cancelMessage();
  935. corpMenu.UsersMenu();
  936. }
  937.  
  938. if (cin.fail()) {
  939. u1.setColor(12); cerr << endl << " ERROR: Input is not an integer."; u1.setColor(15);
  940. Sleep(1500);
  941. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  942. Sleep(1500);
  943. u1.cinClear();
  944. u1.clearScreen();
  945. }
  946.  
  947. for (int i = 0; i < rentsVec.size(); i++) {
  948. if (n_people > rentsVec.at(i).getNumPeople()) {
  949. u1.setColor(12); cerr << endl << " ERROR: The value you inserted exceeds the room's maximum capacity."; u1.setColor(15);
  950. Sleep(1500);
  951. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  952. Sleep(1500);
  953. u1.cinClear();
  954. }
  955. else {
  956. cin.clear();
  957. isIn = false;
  958. }
  959. }
  960. }
  961. int nif = rentsVec[option - 1].getNif();
  962. float totalPrice = xPrice*(date2.minus(date1));
  963. rentsVec[option - 1].setReservation(Reservation(nif, totalPrice, date1, date2));
  964.  
  965. }
  966.  
  967.  
  968. void Corporation::cancelReservation()
  969. {
  970. #pragma warning(disable : 4996)
  971. time_t ti = time(0);
  972. struct tm * now = localtime(&ti);
  973. unsigned int year = 1900 + now->tm_year, month = 1 + now->tm_mon, day = now->tm_mday;
  974. Date real_date = Date(day, month, year);
  975.  
  976. unsigned int nif_user;
  977. for (int i = 0; i < usersVec.size(); i++)
  978. {
  979. if (usersVec.at(i).getUsername() == username)
  980. nif_user = usersVec.at(i).getNif();
  981. }
  982.  
  983. bool found = false;
  984. for (int j = 0; j < rentsVec.size(); j++)
  985. {
  986. for (int k = 0; k < rentsVec.at(j).getReservations().size(); k++)
  987. {
  988. if (rentsVec.at(j).getReservations().at(k).getnif() == nif_user)
  989. {
  990. found = true;
  991. }
  992. }
  993. }
  994.  
  995. if (found)
  996. {
  997. cout << "List of your reservations : " << endl;
  998. for (int j = 0; j < rentsVec.size(); j++)
  999. {
  1000. for (int k = 0; k < rentsVec.at(j).getReservations().size(); k++)
  1001. {
  1002. if (rentsVec.at(j).getReservations().at(k).getnif() == nif_user)
  1003. {
  1004. cout << "City : " << rentsVec.at(j).getCity() << endl;
  1005. cout << "Type of accommodation : " << rentsVec.at(j).getTypeRent() << endl;
  1006. cout << "Name : " << rentsVec.at(j).getName() << endl;
  1007. cout << "Date of Check-in : " << rentsVec.at(j).getReservations().at(k).getDate1();
  1008. cout << "Date of Check-out : " << rentsVec.at(j).getReservations().at(k).getDate2() << endl;
  1009. cout << "Price : " << rentsVec.at(j).getReservations().at(k).getPrice() << endl;
  1010. cout << "Room's capacity: " << rentsVec.at(j).getNumPeople() << endl << endl;
  1011. if (rentsVec.at(j).getLivingRoom() && rentsVec.at(j).getSuite() && rentsVec.at(j).getKitchen())
  1012. cout << "Includes : LivingRoom, Suite and Kitchen" << endl;
  1013. else if (rentsVec.at(j).getLivingRoom() && rentsVec.at(j).getKitchen())
  1014. cout << "Includes : LivingRoom and Kitchen" << endl;
  1015. else if (rentsVec.at(j).getLivingRoom() && rentsVec.at(j).getSuite())
  1016. cout << "Includes : LivingRoom and Suite" << endl;
  1017. else if (rentsVec.at(j).getSuite() && rentsVec.at(j).getKitchen())
  1018. cout << "Includes : Suite and Kitchen" << endl;
  1019. else if (rentsVec.at(j).getKitchen())
  1020. cout << "Includes : Kitchen" << endl;
  1021. else if (rentsVec.at(j).getSuite())
  1022. cout << "Includes : Suite" << endl;
  1023. else if (rentsVec.at(j).getLivingRoom())
  1024. cout << "Includes : LivingRoom" << endl;
  1025. }
  1026. }
  1027. }
  1028. }
  1029.  
  1030. string name_answer;
  1031. cout << " Which one would you like to cancel :";
  1032. getline(cin, name_answer);
  1033.  
  1034. vector<Reservation>x_vec;
  1035. for (int i = 0; i < rentsVec.size(); i++)
  1036. {
  1037. for (int j = 0; j < rentsVec.at(i).getReservations().size(); j++)
  1038. {
  1039. if (name_answer == rentsVec.at(i).getName() && nif_user == rentsVec.at(i).getReservations().at(j).getnif())
  1040. {
  1041. string answer;
  1042. cout << "Do you want to confirm ? (yes|No)";
  1043. getline(cin, answer);
  1044. if (answer == "Yes" || answer == "yes")
  1045. {
  1046. Date x = rentsVec.at(i).getReservations().at(j).getDate1() - real_date;
  1047. if (x.getYear() != 0 || x.getMonth() > 0)
  1048. cout << " You will receive " << rentsVec.at(i).getReservations().at(j).getPrice() << " euros." << endl;
  1049. else if (x.getDay() >= 15)
  1050. cout << "You will receive " << rentsVec.at(i).getReservations().at(j).getPrice() / 2 << " euros." << endl;
  1051. else
  1052. cout << "You will not receive any money." << endl;
  1053. }
  1054. else
  1055. {
  1056. cout << "You canceled the operation." << endl;
  1057. Sleep(2000);
  1058. return;
  1059. }
  1060. }
  1061. else
  1062. {
  1063. x_vec.push_back(rentsVec.at(i).getReservations().at(j));
  1064. }
  1065. }
  1066. rentsVec.at(i).setReservationVector(x_vec);
  1067. }
  1068.  
  1069. }
  1070.  
  1071.  
  1072. bool Corporation::foundRentsFile(string rentsFile)
  1073. {
  1074. fstream f;
  1075.  
  1076. f.open(rentsFile);
  1077.  
  1078. if (f.fail()) {
  1079. f.close();
  1080. u1.setColor(12); cerr << "\n ERROR: " << rentsFile << " (suppliers file) could not be found!\n Verify the directory!\n\n"; u1.setColor(15);
  1081. return false;
  1082. }
  1083.  
  1084. f.close();
  1085.  
  1086. this->rentsFile = rentsFile;
  1087. return true;
  1088. }
  1089.  
  1090. string Corporation::cities() {
  1091.  
  1092. string *item = new string[18];
  1093. int counter = 1, option;
  1094. string cinOption;
  1095. bool run = true;
  1096.  
  1097. item[0] = "Aveiro";
  1098. item[1] = "Beja";
  1099. item[2] = "Braga";
  1100. item[3] = "Bragança";
  1101. item[4] = "Castelo Branco";
  1102. item[5] = "Coimbra";
  1103. item[6] = "Evora";
  1104. item[7] = "Faro";
  1105. item[8] = "Guarda";
  1106. item[9] = "Leiria";
  1107. item[10] = "Lisboa";
  1108. item[11] = "Portalegre";
  1109. item[12] = "Porto";
  1110. item[13] = "Santarem";
  1111. item[14] = "Setubal";
  1112. item[15] = "Viana do Castelo";
  1113. item[16] = "Vila Real";
  1114. item[17] = "Viseu";
  1115.  
  1116. u1.setColor(11); cout << "Cities available: \n\n"; u1.setColor(15);
  1117. for (size_t i = 0; i < 18; i++) {
  1118. cout << counter << " - " << item[i] << endl;
  1119. counter++;
  1120. }
  1121.  
  1122. u1.setColor(14); cout << "\nInsert the number corresponding to the city\nin which you wish to make your rent available: "; u1.setColor(15);
  1123. cin >> cinOption;
  1124.  
  1125. if (cin.eof()) {
  1126. u1.cancelMessage();
  1127. corpMenu.SuppliersMenu();
  1128. }
  1129.  
  1130. if (stoi(cinOption) < 1 || stoi(cinOption) > 18) {
  1131. u1.setColor(12); cerr << endl << " ERROR: Input can only range from 1 to 18. "; u1.setColor(15);
  1132. Sleep(1500);
  1133. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  1134. Sleep(1500);
  1135. u1.cinClear();
  1136. }
  1137.  
  1138. for (size_t i = 0; i < cinOption.size(); i++) {
  1139. if (!isdigit(cinOption.at(i))) {
  1140. u1.setColor(12); cerr << endl << " ERROR: Input can only contain digits. "; u1.setColor(15);
  1141. Sleep(1500);
  1142. cout << endl << " Please try again. If you wish to cancel the operation press CTRL + Z.";
  1143. Sleep(1500);
  1144. u1.cinClear();
  1145. }
  1146. }
  1147.  
  1148. option = stoi(cinOption);
  1149.  
  1150. switch (option) {
  1151.  
  1152. case 1:
  1153. u1.clearScreen();
  1154. cout << item[0];
  1155. Sleep(2000);
  1156. return item[0];
  1157. case 2:
  1158. return item[1];
  1159. case 3:
  1160. return item[2];
  1161. case 4:
  1162. return item[3];
  1163. case 5:
  1164. return item[4];
  1165. case 6:
  1166. return item[5];
  1167. case 7:
  1168. return item[6];
  1169. case 8:
  1170. return item[7];
  1171. case 9:
  1172. return item[8];
  1173. case 10:
  1174. return item[9];
  1175. case 11:
  1176. return item[10];
  1177. case 12:
  1178. return item[11];
  1179. case 13:
  1180. return item[12];
  1181. case 14:
  1182. return item[13];
  1183. case 15:
  1184. return item[14];
  1185. case 16:
  1186. return item[15];
  1187. case 17:
  1188. return item[16];
  1189. case 18:
  1190. return item[17];
  1191. }
  1192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement