void Functionality::searchTask(vector<string> userInput) { int searchResult = 0; unsigned i; vector<EventStorage> outputVector; if(userInput[0].size()!=0) { for(unsigned iterator = 0; iterator < userInput[0].size(); iterator++) userInput[0][iterator] = tolower(userInput[0][iterator]); } searchResult += searchTitle(userInput[0], outputVector); if(userInput[1].size() != 0) searchResult += searchOtherParameters(userInput[1], outputVector, 1); if(userInput[2].size() != 0) searchResult += searchOtherParameters(userInput[2], outputVector, 2); if(userInput[3].size() != 0) searchResult += searchOtherParameters(userInput[3], outputVector, 3); if(searchResult > 0) { removeDuplicates(outputVector); for(i=0;i<outputVector.size();i++) outputVector[i].displayEvent(); cout<<endl; system("Pause"); } else { cout<<"\nSearch is Unsuccessful"; performLogging("Search is Unsuccessful."); Sleep(1000); } }
int deleteLost() { int stop; struct lost * lost; char * title = calloc(1, STRLEN); do { title = strdup(searchTitle()); if (title == '\0') return stop = 0; lost = findPrevLostMovement(title); if (lost == NULL) { printf("nessuna transazione trovata\n"); char prova = '\0'; scanf("%c", &prova); if (prova == 'N' || prova == 'n') { stop = 0; break; } } } while (lost == NULL); if (stop == 0) return stop; struct lost * p; if (lost == firstLostMovement) { p = firstLostMovement; firstLostMovement = firstLostMovement->next; } else { p = lost->next; lost->next = lost->next->next; } free(p); stop = 1; return stop; }
int deleteRevenue() { int stop; struct revenue * revenue; char * title = calloc(1, STRLEN); do { title = strdup(searchTitle()); if (title == '\0') return stop = 0; revenue = findPrevRevenueMovement(title); if (revenue == NULL) { printf("nessuna transazione trovata\n"); char prova = '\0'; scanf("%c", &prova); if (prova == 'N' || prova == 'n') { stop = 0; break; } } } while (revenue == NULL); if (stop == 0) return stop; struct revenue * p; if (revenue == firstRevenueMovement) { p = firstRevenueMovement; firstRevenueMovement = firstRevenueMovement->next; } else { p = revenue->next; revenue->next = revenue->next->next; } free(p); stop = 1; return stop; }
static HWND FindWindowHandle(const char *windowTitle) { char buf[CHAR_BUFFER_SIZE]; std::string searchTitle(windowTitle); ToLowerString(searchTitle); for (HandleList::iterator it = s_windows->begin(); it != s_windows->end(); ++it) { GetWindowText(*it, buf, sizeof(buf)); std::string s(buf); ToLowerString(s); if (s.find(searchTitle) != -1) { return *it; } } return 0; }
int updateLost() { int stop = 1; struct lost * lost; char * title = calloc(1, STRLEN); do { title = strdup(searchTitle()); if (title == '\0') return stop = 0; lost = findLostMovement(title); if (lost == NULL) { printf("nessuna transazione trovata\n"); char prova = '\0'; scanf("%c", &prova); getchar(); if (prova == 'N' || prova == 'n') { stop = 0; break; } } } while (lost == NULL); if (stop == 0) return stop; changeLostField(lost); return stop; }
int updateRevenue() { int stop = 1; struct revenue * revenue; char * title = calloc(1, STRLEN); do { title = strdup(searchTitle()); if (title == '\0') return stop = 0; revenue = findRevenueMovement(title); if (revenue == NULL) { printf("nessuna transazione trovata\n"); char prova = '\0'; scanf("%c", &prova); if (prova == 'N' || prova == 'n') { stop = 0; break; } } } while (revenue == NULL); if (stop == 0) return stop; changeRevenueField(revenue); return stop; }