/** * @brief genere un nouveau code de devis l'applique à la class et retourn la valeur * @return code */ QString proposal::generateNewCode() { //Generation du code // TYPE + DATE + ID QString typp = tr("DE"); setCode( typp + QDateTime::currentDateTime().toString("yyMM") + QString::number(getLastId()+1) ); return m_code; }
int Servicios_init(){ hash_servicios = HashExtensible_crear( SERVICIOS_HASH_BLOQUE_PATH, SERVICIOS_HASH_TABLA_PATH, SERVICIOS_HASH_BAJA_PATH, SERVICIOS_HASH_BLOQUE_SIZE, &HashDispersionModulo, &Servicios_get_id ); if(!hash_servicios) return 1; servicios_last_id = getLastId(SERVICIOS_LAST_ID_FILE); indice_cat = Arbol_crear(SERVICIOS_INDICE_CAT_PATH, SERVICIOS_ARBM_CAT_ORDEN); return 0; }
string ProRataSICReader::getChromatogram( int iChroIdentifier ) const { int iFirstId = getFirstId(); int iLastId = getLastId(); if ( iChroIdentifier < iFirstId || iChroIdentifier > iLastId ) { cout << "Error: Chromatogram identifier " << iChroIdentifier << " is not available." << endl; return ""; } if ( sFileName == "" ) { cout << "Error: The SIC file is not valid." << endl; return ""; } return getChro( sFileName.c_str(), iChroIdentifier ); }
/** Suppression du facture de la bdd ATTENTION ICI on supprimer le facture de la bdd avec les details associes @return true si ok */ bool proposal::remove(){ // Construction de la requette pour supprimer la proposition QString req = "DELETE FROM TAB_PROPOSALS"; req += " WHERE ID='"+ QString::number(m_id) +"';"; QSqlQuery query; query.prepare(req); if(!query.exec()) { QMessageBox::critical(this->m_parent, tr("Erreur"), query.lastError().text()); return false; } else{ // Si cest la derniere devis on rafraichit l'index if(getLastId() == m_id){ req = "UPDATE SQLITE_SEQUENCE SET SEQ='"+QString::number(m_id-1)+"' WHERE name='TAB_PROPOSALS';"; query.prepare(req); if(!query.exec()) { QMessageBox::critical(this->m_parent, tr("Erreur"), req+'\n'+query.lastError().text()); return false; } } return true; } }
int ProRataSICReader::getLastIdentifier() const { return getLastId(); }
void forkIt(char **argv, LinkedList* historyList) { pid_t pid = fork(); int status; if(pid < -1){ perror("error in fork()!!!!"); exit(-99); } if(pid != 0) // Parent is always non - zero { waitpid(pid, &status, 0); } else { char *at; if(strcmp(argv[0],"history") == 0){ printList(historyList,printType); exit(getpid()); } else if((at = strchr(argv[0], '!')) != NULL) { int id; if(argv[0][1] == '!'){ int lastId = getLastId(historyList); printf("lastid: %d\n", --lastId); print_execByID(historyList, lastId); exit(getpid()); } else { printf("\n"); id = atoi(at+1); printf("testing id: %d \n", id); if (id >= 0 && id <= HISTCOUNT) { print_execByID(historyList, id); exit(getpid()); } else { printf("Invalid format, please type the number right after the !. ex: !12\n"); } exit(getpid()); } exit(getpid()); } else{ if(execvp(argv[0], argv) < 0) { perror("Error on child execution"); exit(getpid()); } exit(getpid()); } exit(getpid()); } }// end forkit