Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.30 KB | None | 0 0
  1.  
  2. void Chantier_addSiteInDatabase(Llist *linkedList, const char *f_name)
  3. {
  4.     Llist tmpLinkedList;
  5.     ChantierDataFile newItem;
  6.  
  7.     if (linkedList->PTL == -1)
  8.     {
  9.         printf("Base de donn‚es pleinne");
  10.         warningColor();
  11.     }
  12.     else
  13.     {
  14.         Chantier_getInformation(linkedList, &newItem, f_name);
  15.  
  16.         // Si base de donnée vide
  17.         if (linkedList->PTO == -1)
  18.         {
  19.             tmpLinkedList.PTO = linkedList->PTL;
  20.             tmpLinkedList.PTL = newItem.offsetNextSite;
  21.  
  22.             newItem.offsetNextSite = -1;
  23.         }
  24.         else
  25.         {
  26.             // Copie de PTL et PTO
  27.             tmpLinkedList = *linkedList;
  28.             // Modifie le chainage dans le fichier pour insérer le nouveau chantier
  29.             Chantier_makeInsertionLinkings(&tmpLinkedList, &newItem, f_name);
  30.         }
  31.  
  32.         if (Chantier_saveSiteInDatabase(linkedList->PTL, &newItem, f_name))
  33.         {
  34.             if (Chantier_saveLlistInDatabase(&tmpLinkedList, f_name))
  35.             {
  36.                 *linkedList = tmpLinkedList;
  37.                 system("CLS");
  38.                 system("COLOR A");
  39.                 printf("Chantier correctement ajout‚ … la base de donn‚es\n");
  40.             }
  41.         }
  42.     }
  43.  
  44.     // Mise en pause
  45.     _getch();
  46.     system("COLOR 7");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement