void DetaDoc::createActions() { /*menu File*/ /*menu newTicket*/ connect(ui->firstDiagnosticAct, SIGNAL(triggered()), this, SLOT(firstDiagnostic())); connect(ui->secondDiagnosticAct, SIGNAL(triggered()), this, SLOT(secondDiagnostic())); /*menu new ticket*/ connect(ui->SaleInOfficeAct, SIGNAL(triggered()), this, SLOT(saleInOfficeS())); connect(ui->forSallingAct, SIGNAL(triggered()), this, SLOT(forSaleS())); connect(ui->timeTableAct, SIGNAL(triggered()), this, SLOT(timeTable())); connect(ui->devicesRentAct, SIGNAL(triggered()), this, SLOT(devicesRent())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quit())); /*menu file end*/ /*menu partners*/ connect(ui->addPartnerAct, SIGNAL(triggered()), this, SLOT(addPartner())); connect(ui->partnerDictionaryAct, SIGNAL(triggered()), this, SLOT(openPartnerDictionary())); /*menu partners end*/ /*menu devices*/ connect(ui->deviceAddAct, SIGNAL(triggered()), this, SLOT(addDevice())); connect(ui->devicesDictionaryAct, SIGNAL(triggered()), this, SLOT(openDeviceDict())); connect(ui->warehouseDevicesAct, SIGNAL(triggered()), this, SLOT(openDeviceWarehouse())); connect(ui->addLiteratureAct, SIGNAL(triggered()), this, SLOT(addLiterature())); connect(ui->literatureDictAct, SIGNAL(triggered()), this, SLOT(openLiteratureDict())); connect(ui->warehouseLiteratureAct, SIGNAL(triggered()), this, SLOT(openLiteratureWarehouse())); connect(ui->setLicenseCostAct, SIGNAL(triggered()), this, SLOT(changeLicenseCost())); connect(ui->warehouseLicense, SIGNAL(triggered()), this, SLOT(openLicenseWarehouse())); /*menu devices end*/ /*menu customers*/ connect(ui->addCustomerAct, SIGNAL(triggered()), this, SLOT(addCustomer())); connect(ui->customersDictionaryAct, SIGNAL(triggered()), this, SLOT(openCustomersDict())); connect(ui->addRangeCustomerCardsAct, SIGNAL(triggered()), this, SLOT(addRangeOfCustomerCards())); connect(ui->deleteRangeCustomerCardsAct, SIGNAL(triggered()), this, SLOT(deleteRangeOfCustomerCards())); connect(ui->customerCardsDictAct, SIGNAL(triggered()), this, SLOT(openDictOfCustomerCards())); /*menu customers end*/ /*menu doctors*/ connect(ui->addDoctorAct, SIGNAL(triggered()), this, SLOT(addDoctor())); connect(ui->doctorsDictionaryAct, SIGNAL(triggered()), this, SLOT(openDoctorsDict())); /*menu doctors end*/ /*menu reports*/ connect(ui->reportCustomersAct, SIGNAL(triggered()), this, SLOT(customerReport())); connect(ui->reportDevicesAct, SIGNAL(triggered()), this, SLOT(devicesReport())); /*menu reports end*/ /*menu settings*/ connect(ui->dbSettingsAct, SIGNAL(triggered()), this, SLOT(DBSettings())); connect(ui->manageUsersAct, SIGNAL(triggered()), this, SLOT(manageUsers())); /*menu setting end*/ /*menu about*/ connect(ui->aboutProgrammAct, SIGNAL(triggered()), this, SLOT(AboutProgramm())); connect(ui->aboutQtAct, SIGNAL(triggered()), this, SLOT(AboutQt())); /*menu about end*/ }
void Store::readTransactions() { ifstream transactionsFile(fileNames[2]); unsigned int n; transactionsFile >> n; transactionsFile.ignore(INT64_MAX, '\n'); for (size_t i = 0; i < n; i++) { unsigned int id; Customer * customer; Date date; string productsLine, product; stringstream ss; transactionsFile >> id; transactionsFile.ignore(3); if (existsCustomer(id)) { customer = fetchCustomer(id); } else { addCustomer(Customer(id, "", Date(1, 1, 0), 0.0, false)); customer = &(*customers.rbegin()); } transactionsFile >> date; transactionsFile.ignore(3); getline(transactionsFile, productsLine); ss << productsLine; transactions.push_back(Transaction(*customer, date)); Transaction & transaction = *transactions.rbegin(); while (ss) { getline(ss, product, ','); if (existsProduct(product)) { transaction.products.push_back(fetchProduct(product)); } ss.ignore(1); } } }
Reservation::Reservation(string name,string checkinDate ,string checkoutDate,int numberOfRooms,Room* rooms) { CustomerName = name; NumberOfRooms = numberOfRooms; RequiredRooms = new Room[NumberOfRooms]; RequiredRooms = rooms; CheckInDate = checkinDate; CheckOutDate = checkoutDate; if(CheckAvailability()){ //if available add customer in residingcustomer database addCustomer(); } else generateApology(); //else generate appology }
databasePTR init_database(char *file_path) { size_t len; ssize_t chars; FILE *customerFile; char *token; char *linebuffer; char* name; float credit; int c_id; databasePTR db = createDatabase(); //make sure filepath is referencing a valid file if (!checkFile(file_path)) { printf("Error with filepath \n", file_path); exit(EXIT_FAILURE); } customerFile = fopen(file_path, "r"); len = 0; linebuffer = NULL; while ( (chars = getline(&linebuffer, &len, customerFile) != -1) ) // tokenize for each line in input file { token = strtok(linebuffer, "|"); // name is first if (!token) {printf("Invalid customer file format \n"); exit(1);} name = strdup(token); printf("name: %s \n", name); token = strtok(NULL, "|"); // then ID if (!token) {printf("Invalid customer file format \n"); exit(1);} c_id = atoi(token); printf("cid: %d \n", c_id); token = strtok(NULL, "|"); // then credit limit if (!token) {printf("Invalid customer file format \n"); exit(1);} credit = atof(token); customerPTR newCustomer = createCustomer(name, c_id, credit); addCustomer(db, newCustomer); } free(linebuffer); fclose(customerFile); return db; }