Advertisement
Guest User

Untitled

a guest
May 15th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Threading;
  5. using System.Text;
  6. using System.Linq;
  7.  
  8. namespace ProjetFinalP2O
  9.  
  10. {
  11. public class DepotVente
  12. {
  13.  
  14. public List<Don> dons;
  15. public double Total;
  16. public string NomDepot;
  17.  
  18. public DepotVente(string nom)
  19. {
  20.  
  21.  
  22. this.NomDepot = nom;
  23. this.Total = 1000;
  24. this.dons = new List<Don>();
  25.  
  26. }
  27.  
  28.  
  29.  
  30. }
  31.  
  32. public abstract class PersonneMorale
  33. {
  34.  
  35. string EntrepriseNom;
  36. string Dirigeant;
  37.  
  38.  
  39. }
  40.  
  41. public class Don : IComparable<Don>
  42. {
  43.  
  44. public string Date;
  45. public string Type;
  46. public string Référence;
  47. public string Nom;
  48. public string Tel;
  49. public string Adresse;
  50. public string Description;
  51. public int Statut; // 0 RIEN 1 ACCEPTE 2 REFUSE 3 STOCKE 4 ARCHIVE
  52. public Beneficiaire beneficiaire;
  53. public double Montant;
  54.  
  55.  
  56. public Don(string a, string b, string c, string d, string e, string f, string g, int h)
  57. {
  58.  
  59. this.Date = a;
  60. this.Type = b;
  61. this.Référence = c;
  62. this.Nom = d;
  63. this.Tel = e;
  64. this.Adresse = f;
  65. this.Description = g;
  66. this.Statut = h;
  67. this.beneficiaire = null;
  68. this.Montant = 0.0;
  69.  
  70.  
  71. }
  72.  
  73.  
  74. public void AjouterBenef(Beneficiaire b)
  75. {
  76.  
  77.  
  78. this.beneficiaire = b;
  79.  
  80. }
  81.  
  82. public void AjouterMontant(double x)
  83. {
  84.  
  85.  
  86. this.Montant = x;
  87.  
  88.  
  89. }
  90.  
  91. public void SetStatut(int statut)
  92. {
  93.  
  94. this.Statut = statut;
  95.  
  96. }
  97. public virtual string ToString()
  98. {
  99. string retour = null;
  100. retour += "Date : ";
  101. retour += this.Date;
  102. retour += "\n";
  103. retour += "Type : ";
  104. retour += this.Type;
  105. retour += "\n";
  106. retour += "Reference : ";
  107. retour += this.Référence;
  108. retour += "\n";
  109. retour += "Nom : ";
  110. retour += this.Nom;
  111. retour += "\n";
  112. retour += "Tel : ";
  113. retour += this.Tel;
  114. retour += "\n";
  115. retour += "Adresse : ";
  116. retour += this.Adresse;
  117. retour += "\n";
  118. retour += "Description : ";
  119. retour += this.Description;
  120. retour += "\n";
  121.  
  122. return retour;
  123. }
  124.  
  125. public int TriDate(Don objet)
  126. {
  127.  
  128.  
  129. DateTime date1 = Convert.ToDateTime(this.Date);
  130. DateTime date2 = Convert.ToDateTime(objet.Date);
  131.  
  132. if(date1 > date2)
  133. {
  134.  
  135.  
  136. return 1;
  137.  
  138. }
  139.  
  140. if(date2 > date1)
  141. {
  142.  
  143. return -1;
  144. }
  145.  
  146. return 0;
  147.  
  148.  
  149. }
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156. }
  157.  
  158. public class Objet_Volumineux : Don
  159. {
  160.  
  161.  
  162. public double longueur;
  163. public double largeur;
  164. public string meuble;
  165.  
  166. public Objet_Volumineux(string a, string b, string c, string d, string e, string f, string g, int h, double i,double j, string k)
  167. :base(a,b,c,d,e,f,g,h)
  168. {
  169. this.longueur = i;
  170. this.largeur = j;
  171. this.meuble = k;
  172.  
  173. }
  174.  
  175. public override string ToString()
  176. {
  177. string retour = base.ToString();
  178. retour += "Longueur : ";
  179. retour += this.longueur;
  180. retour += "\n";
  181. retour += "Largeur : ";
  182. retour += this.largeur;
  183. retour += "\n";
  184. retour += "Meuble : ";
  185. retour += this.meuble;
  186. retour += "\n";
  187. return retour;
  188. }
  189.  
  190.  
  191. }
  192.  
  193. public class Cuisiniere : Objet_Volumineux
  194. {
  195.  
  196. double puissance;
  197. int nombre_de_plaque;
  198.  
  199. public Cuisiniere(string a, string b, string c, string d, string e, string f, string g, int h, double i, double j,double k, int l, string m)
  200. :base(a, b, c, d, e, f, g, h,i,j,m)
  201. {
  202.  
  203. this.puissance = k;
  204. this.nombre_de_plaque = l;
  205.  
  206.  
  207. }
  208.  
  209. public override string ToString()
  210. {
  211. string retour = base.ToString();
  212. retour += "Puissance : ";
  213. retour += this.puissance;
  214. retour += "\n";
  215. retour += "Nombre de plaques : ";
  216. retour += this.nombre_de_plaque;
  217. retour += "\n";
  218.  
  219. return retour;
  220. }
  221.  
  222.  
  223.  
  224. }
  225.  
  226. public class Table : Objet_Volumineux
  227. {
  228.  
  229. string Type_Table;
  230. string Forme;
  231.  
  232. public Table(string a, string b, string c, string d, string e, string f, string g, int h, double i, double j, string k, string l, string m)
  233. :base(a, b, c, d, e, f, g, h, i, j,m)
  234. {
  235.  
  236. this.Type_Table = k;
  237. this.Forme = l;
  238.  
  239.  
  240. }
  241.  
  242. public override string ToString()
  243. {
  244. string retour = base.ToString();
  245. retour += "Type de table : ";
  246. retour += this.Type_Table;
  247. retour += "\n";
  248. retour += "Forme : ";
  249. retour += this.Forme;
  250. retour += "\n";
  251. return retour;
  252. }
  253.  
  254.  
  255. }
  256.  
  257. public class Vaisselle : Don
  258. {
  259.  
  260. string vaisselle;
  261. int nombre;
  262.  
  263. public Vaisselle(string a, string b, string c, string d, string e, string f, string g, int h, string i, int j)
  264. :base(a, b, c, d, e, f, g, h)
  265. {
  266.  
  267.  
  268. this.vaisselle = i;
  269. this.nombre = j;
  270.  
  271. }
  272.  
  273. public override string ToString()
  274. {
  275. string retour = base.ToString();
  276. retour += "Vaisselle : ";
  277. retour += this.vaisselle;
  278. retour += "\n";
  279. retour += "Nombre : ";
  280. retour += this.nombre;
  281. retour += "\n";
  282. return retour;
  283. }
  284.  
  285.  
  286. }
  287.  
  288. public class Stock
  289. {
  290.  
  291.  
  292. public Don Objets;
  293.  
  294. public Stock(Don objets)
  295. {
  296. this.Objets = objets;
  297. }
  298.  
  299. public virtual string ToString()
  300. {
  301.  
  302. return Objets.ToString();
  303.  
  304. }
  305. }
  306.  
  307. public class Garde_Meuble : Stock
  308. {
  309. public Beneficiaire Benef;
  310. public string Date_Depot;
  311. public string Date_Enlevement;
  312.  
  313. public Garde_Meuble(Don objets, Beneficiaire benef, string date_depot, string date_enlevement)
  314. : base(objets)
  315. {
  316.  
  317. this.Benef = benef;
  318. this.Date_Depot = date_depot;
  319. this.Date_Enlevement = date_enlevement;
  320.  
  321. }
  322.  
  323. public override string ToString()
  324. {
  325. string retour = base.ToString();
  326. retour += "Beneficiaire : \n";
  327. retour += Benef.ToString();
  328. retour += "\n";
  329. retour += "Date de Depot :";
  330. retour += this.Date_Depot;
  331. retour += "\n";
  332. retour += "Date d'enlevement ";
  333. retour += this.Date_Enlevement;
  334. return retour;
  335. }
  336.  
  337. }
  338.  
  339.  
  340.  
  341.  
  342. public class Adherent
  343. {
  344. public int ID;
  345. public string Nom;
  346. public string Adresse;
  347. public string Telephone;
  348. public string Prenom;
  349. public string Statut;
  350.  
  351. public Adherent(int a, string b, string c, string d, string e, string f)
  352. {
  353.  
  354. this.ID = a;
  355. this.Nom = b;
  356. this.Adresse = c;
  357. this.Telephone = d;
  358. this.Prenom = e;
  359. this.Statut = f;
  360.  
  361. }
  362.  
  363.  
  364. }
  365.  
  366. public class Beneficiaire
  367. {
  368.  
  369. public int ID;
  370. public string Nom;
  371. public string Adresse;
  372. public string Telephone;
  373. public string Prenom;
  374. public string DateNaissance;
  375. public Beneficiaire(int a, string b, string c, string d, string e, string f)
  376. {
  377.  
  378. this.ID = a;
  379. this.Nom = b;
  380. this.Adresse = c;
  381. this.Telephone = d;
  382. this.Prenom = e;
  383. this.DateNaissance = f;
  384.  
  385. }
  386.  
  387. public override string ToString()
  388. {
  389. return "ID : " + Convert.ToString(this.ID) + "\n" + "Nom : " + this.Nom + "\n" + "Adresse : " + this.Adresse + "\n" + "Telephone : " + this.Telephone + "\n" + "Prenom : " + this.Prenom + "\n" + "Date de Naissance : " + this.DateNaissance;
  390. }
  391.  
  392.  
  393.  
  394. }
  395.  
  396.  
  397.  
  398. class MainClass
  399.  
  400. {
  401.  
  402. public static void AjouterBenef(List<Beneficiaire> beneficiaires)
  403. {
  404.  
  405.  
  406. Console.WriteLine("Nom ? ");
  407. string nom = Console.ReadLine();
  408. Console.WriteLine("Adresse ? ");
  409. string adresse = Console.ReadLine();
  410. Console.WriteLine("Telephone ? ");
  411. string telephone = Console.ReadLine();
  412. Console.WriteLine("Prenom ?");
  413. string prenom = Console.ReadLine();
  414. Console.WriteLine("Date de naissance ?");
  415. string datenaissance = Console.ReadLine();
  416.  
  417. Beneficiaire temp = new Beneficiaire(beneficiaires.Count+1, nom, adresse, telephone, prenom, datenaissance);
  418. beneficiaires.Add(temp);
  419.  
  420. }
  421.  
  422. delegate int Operation(int valeur1, int valeur2);
  423. static int Addition(int v1, int v2)
  424. {
  425.  
  426. return v1 + v2;
  427.  
  428. }
  429. static int Soustraction(int v1, int v2)
  430. {
  431.  
  432. return v1 - v2;
  433.  
  434. }
  435. static int Multiplication(int v1, int v2)
  436. {
  437.  
  438. return v1 * v2;
  439.  
  440. }
  441. static int Division(int v1, int v2)
  442. {
  443.  
  444. return v1 / v2;
  445.  
  446. }
  447. static int AppliquerOperation(Operation o, int v1, int v2)
  448. {
  449. return o(v1, v2);
  450.  
  451. }
  452.  
  453. public static void Calculatrice()
  454. {
  455.  
  456.  
  457. Console.WriteLine("Valeur 1 :");
  458. int val1 = Convert.ToInt32(Console.ReadLine());
  459. Console.WriteLine("Valeur 2 :");
  460. int val2 = Convert.ToInt32(Console.ReadLine());
  461.  
  462. Console.WriteLine("+ - * / ?");
  463.  
  464. string ope = Console.ReadLine();
  465. int resultat = 0;
  466.  
  467. if(ope == "+")
  468. {
  469.  
  470. resultat = AppliquerOperation(Addition, val1, val2);
  471.  
  472. }
  473. if (ope == "-")
  474. {
  475.  
  476. resultat = AppliquerOperation(Soustraction, val1, val2);
  477.  
  478. }
  479. if (ope == "/")
  480. {
  481.  
  482. resultat = AppliquerOperation(Division, val1, val2);
  483.  
  484. }
  485. if (ope == "*")
  486. {
  487.  
  488. resultat = AppliquerOperation(Multiplication, val1, val2);
  489.  
  490. }
  491.  
  492. Console.WriteLine(resultat);
  493.  
  494. }
  495. public static void MoyDepotRecep(List<Garde_Meuble> GM)
  496. {
  497. List<int> intervalle = new List<int>();
  498. int days;
  499. foreach(Garde_Meuble item in GM)
  500. {
  501.  
  502. days = Convert.ToInt32(Convert.ToDateTime(item.Date_Enlevement) - Convert.ToDateTime(item.Date_Depot));
  503.  
  504. intervalle.Add(days);
  505. }
  506.  
  507. Console.WriteLine(intervalle.Average());
  508.  
  509.  
  510. }
  511. public static void MoyPrixDepotVente(List<DepotVente> DV)
  512. {
  513.  
  514. List<double> prix = new List<double>();
  515. foreach(DepotVente item in DV) {
  516.  
  517. foreach(Don item2 in item.dons)
  518. {
  519.  
  520. prix.Add(item2.Montant);
  521.  
  522. }
  523.  
  524.  
  525. }
  526.  
  527. Console.WriteLine(prix.Average());
  528.  
  529. }
  530.  
  531. public static void MoyAgeBenef(List<Beneficiaire> BL)
  532. {
  533.  
  534. List<int> Age = new List<int>();
  535. int age;
  536. foreach(Beneficiaire item in BL)
  537. {
  538.  
  539. age = Convert.ToInt32(DateTime.Now - Convert.ToDateTime(item.DateNaissance));
  540. Age.Add(age);
  541.  
  542. }
  543.  
  544. Console.WriteLine(Age.Average());
  545.  
  546.  
  547. }
  548.  
  549. public static void TriDepotPrix(List<DepotVente> DV)
  550. {
  551.  
  552. List<Don> DonTrieFinal = new List<Don>();
  553. List<Don> DonTemporaire = new List<Don>();
  554.  
  555. foreach(DepotVente item in DV)
  556. {
  557.  
  558. DonTemporaire.AddRange(item.dons);
  559. DonTemporaire.OrderBy(d => d.Montant);
  560. DonTrieFinal.AddRange(DonTemporaire);
  561. DonTemporaire.Clear();
  562.  
  563. }
  564.  
  565.  
  566. }
  567. public static void TriDonVendu(List<Don> dons)
  568. {
  569.  
  570. List<Don> nouveauDons = new List<Don>();
  571. foreach(Don item in dons)
  572. {
  573.  
  574. if(item.Statut == 2)
  575. {
  576.  
  577. nouveauDons.Add(item);
  578.  
  579. }
  580.  
  581. }
  582.  
  583. nouveauDons.OrderBy(d => Convert.ToDateTime(d.Date)).ThenBy(d => d.beneficiaire.ID);
  584.  
  585. foreach(Don item in nouveauDons)
  586. {
  587.  
  588. Console.WriteLine(item.ToString());
  589.  
  590. }
  591.  
  592.  
  593. }
  594.  
  595. public static void TriDonStockeType(List<Garde_Meuble> GM, List<DepotVente> DV)
  596. {
  597.  
  598. List<Don> DonTrieFinal = new List<Don>();
  599. List<Don> nouveauDons = new List<Don>();
  600. foreach(Garde_Meuble item in GM)
  601. {
  602.  
  603. nouveauDons.Add(item.Objets);
  604.  
  605. }
  606.  
  607. nouveauDons.OrderBy(d => d.Type);
  608.  
  609. DonTrieFinal.AddRange(nouveauDons);
  610.  
  611. nouveauDons.Clear();
  612.  
  613. foreach(DepotVente item in DV)
  614. {
  615.  
  616. nouveauDons.AddRange(item.dons);
  617. nouveauDons.OrderBy(d => d.Type);
  618. DonTrieFinal.AddRange(nouveauDons);
  619. nouveauDons.Clear();
  620.  
  621.  
  622. }
  623.  
  624. foreach(Don item in DonTrieFinal)
  625. {
  626.  
  627. Console.WriteLine(item.ToString());
  628. }
  629.  
  630. }
  631. public static void AfficherDV(List<DepotVente> depotVentes)
  632. {
  633.  
  634. foreach(DepotVente item in depotVentes)
  635. {
  636. Console.WriteLine("###########");
  637. Console.WriteLine(item.NomDepot);
  638. Console.WriteLine(item.Total);
  639. Console.WriteLine("###########");
  640.  
  641. foreach (Don item2 in item.dons)
  642. {
  643.  
  644. Console.WriteLine(item2.ToString());
  645.  
  646. }
  647.  
  648. }
  649.  
  650. }
  651. public static void CreerDV(List<DepotVente> depotVentes)
  652. {
  653.  
  654. Console.WriteLine("Entrez le nom du Depot Vente :");
  655. string nom = Console.ReadLine();
  656. DepotVente temp = new DepotVente(nom);
  657. depotVentes.Add(temp);
  658.  
  659. }
  660. public static void TransfertDonBenef(List<Don> dons, List<Beneficiaire> beneficiaires)
  661. {
  662.  
  663. bool ok = false;
  664. while(ok == false)
  665. {
  666.  
  667. foreach(Don item in dons)
  668. {
  669.  
  670. if(item.Statut == 1 || item.Statut == 3)
  671. {
  672.  
  673. Console.WriteLine("Objet : " + dons.IndexOf(item));
  674. Console.WriteLine(item.ToString());
  675.  
  676. }
  677.  
  678. }
  679.  
  680. Console.WriteLine("Votre choix :");
  681. int choix = Convert.ToInt32(Console.ReadLine());
  682.  
  683.  
  684. foreach(Beneficiaire benef in beneficiaires)
  685. {
  686.  
  687. Console.WriteLine("Beneficiaire : " + beneficiaires.IndexOf(benef));
  688. Console.WriteLine(benef.ToString());
  689.  
  690. }
  691.  
  692. Console.WriteLine("Votre choix :");
  693. int choix2 = Convert.ToInt32(Console.ReadLine());
  694.  
  695. dons[choix].AjouterBenef(beneficiaires[choix2]);
  696. dons[choix].Statut = 4;
  697. Console.WriteLine("Effectué appuyez pour retourner au menu");
  698. Console.ReadLine();
  699. ok = true;
  700.  
  701. }
  702.  
  703. }
  704.  
  705. public static void AfficherArchives(List<Don> dons)
  706. {
  707.  
  708. foreach(Don item in dons)
  709. {
  710.  
  711. if(item.Statut == 4)
  712. {
  713.  
  714. Console.WriteLine(item.ToString());
  715.  
  716. }
  717.  
  718. }
  719.  
  720. }
  721.  
  722. public static void TriDonTraitement(List<Don> dons)
  723. {
  724.  
  725.  
  726. List<Don> DonBackup = dons;
  727. dons.OrderBy(x => x.Nom);
  728. foreach(Don item in dons)
  729. {
  730.  
  731. if(item.Statut == 0 || item.Statut == 1)
  732. {
  733.  
  734. Console.WriteLine(item.ToString());
  735. Console.WriteLine(" ");
  736.  
  737.  
  738. }
  739.  
  740. }
  741. dons = DonBackup;
  742.  
  743.  
  744. }
  745. public static void TriDonRefuseDate(List<Don> dons)
  746. {
  747.  
  748. List<Don> DonBackup = dons;
  749. dons.Sort((x, y) => x.TriDate(y));
  750. foreach(Don item in dons)
  751. {
  752.  
  753.  
  754. if(item.Statut == 2)
  755. {
  756.  
  757. Console.WriteLine(item.ToString());
  758. Console.WriteLine(" ");
  759.  
  760. }
  761.  
  762. }
  763.  
  764. dons = DonBackup;
  765.  
  766.  
  767.  
  768.  
  769.  
  770. }
  771.  
  772. public static void StockerMenu(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Garde_Meuble> Garde_Meuble, List<DepotVente> depotVentes)
  773. {
  774.  
  775. int i = 0;
  776. int j = 0;
  777. while(i < dons.Count)
  778. {
  779.  
  780. if (dons[i].Statut == 1)
  781. {
  782.  
  783.  
  784. Console.WriteLine("(" + Convert.ToString(i) + ") " + dons[i].Type + " " + dons[i].Référence + " " + dons[i].Description);
  785. j++;
  786.  
  787. }
  788. i++;
  789.  
  790. }
  791.  
  792. bool ok = false;
  793.  
  794. while(ok == false)
  795. {
  796.  
  797. Console.WriteLine("ID à stocker ?");
  798. string lecture = Console.ReadLine();
  799.  
  800. if(lecture == "")
  801. {
  802.  
  803. MenuDons(adherents, beneficiaires, dons, Garde_Meuble, depotVentes);
  804.  
  805. }
  806.  
  807. int choix = Convert.ToInt32(lecture);
  808.  
  809. if(choix < j)
  810. {
  811.  
  812.  
  813. Console.WriteLine(dons[choix].ToString());
  814. bool ok2 = false;
  815. while(ok2 == false)
  816. {
  817.  
  818. Console.WriteLine("1 pour stocker asso / 2 pour stocker garde-meuble / 3 pour stocker dépot vente");
  819. int choix2 = Convert.ToInt32(Console.ReadLine());
  820. if(choix2 == 1)
  821. {
  822.  
  823.  
  824. StockageAsso(dons, adherents, beneficiaires, choix);
  825. ok2 = true;
  826.  
  827. }
  828.  
  829. if(choix2 == 2)
  830. {
  831.  
  832. StockageGardeMeuble(dons, adherents, beneficiaires, Garde_Meuble, choix, depotVentes);
  833. ok2 = true;
  834.  
  835. }
  836.  
  837.  
  838. if(choix2 == 3)
  839. {
  840.  
  841. StockageDV(dons, adherents, beneficiaires, Garde_Meuble, choix, depotVentes);
  842. ok2 = true;
  843.  
  844. }
  845.  
  846.  
  847. ok = true;
  848.  
  849. }
  850.  
  851. }
  852.  
  853.  
  854. }
  855. }
  856.  
  857. public static void StockageAsso(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaires, int choix)
  858. {
  859.  
  860. dons[choix].Statut = 3;
  861. Console.WriteLine("Don stocké dans l'association. Appuyez sur une touche pour revenir au menu");
  862. Console.ReadLine();
  863.  
  864.  
  865.  
  866. }
  867.  
  868. public static void StockageGardeMeuble(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaire, List<Garde_Meuble> Garde_Meuble, int choix, List<DepotVente> depotVentes)
  869. {
  870. bool ok = false;
  871. int index = 0;
  872. while (ok == false)
  873. {
  874. Console.WriteLine("Nom du beneficiaire :");
  875. string benef = Console.ReadLine();
  876. try
  877. {
  878. index = beneficiaire.IndexOf(beneficiaire.Find(item => item.Nom == benef));
  879. ok = true;
  880.  
  881. }
  882. catch
  883. {
  884. Console.WriteLine("Nom introuvable");
  885.  
  886. }
  887. }
  888.  
  889. Console.WriteLine("Date de Depot");
  890. string date_depot = Console.ReadLine();
  891. Console.WriteLine("Date de retrait");
  892. string date_retrait = Console.ReadLine();
  893. dons[choix].Statut = 3;
  894. Garde_Meuble temp = new Garde_Meuble(dons[choix], beneficiaire[index], date_depot, date_retrait);
  895. Garde_Meuble.Add(temp);
  896. Console.WriteLine("Appuyez pour retourner au menu");
  897. Console.ReadKey();
  898. MenuDons(adherents, beneficiaire, dons, Garde_Meuble, depotVentes);
  899.  
  900.  
  901. }
  902.  
  903. public static void StockageDV(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaire, List<Garde_Meuble> Garde_Meuble, int choix, List<DepotVente> depotVentes)
  904. {
  905.  
  906.  
  907.  
  908. foreach(DepotVente item in depotVentes)
  909. {
  910.  
  911. Console.Write(depotVentes.IndexOf(item));
  912. Console.Write(" ");
  913. Console.Write(item.NomDepot);
  914. Console.Write("\n");
  915.  
  916. }
  917.  
  918. Console.WriteLine("Choisissez votre depot vente");
  919. int choix2 = Convert.ToInt32(Console.ReadLine());
  920. dons[choix].Statut = 3;
  921. depotVentes[choix2].dons.Add(dons[choix]);
  922. Console.WriteLine("Montant ? ");
  923. double montant = Convert.ToDouble(Console.ReadLine());
  924. dons[choix].Montant = montant;
  925. depotVentes[choix2].Total += dons[choix].Montant;
  926. Console.WriteLine("Don Stocké !");
  927. Console.ReadLine();
  928.  
  929.  
  930. }
  931.  
  932. public static void AfficherGardeMeuble(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Garde_Meuble> garde_Meubles, List<DepotVente> depotVentes)
  933. {
  934. int i = 0;
  935. foreach(Garde_Meuble item in garde_Meubles)
  936. {
  937. Console.WriteLine("############");
  938. Console.WriteLine("Objet :" + i);
  939. Console.WriteLine("############");
  940. Console.WriteLine(" ");
  941. Console.WriteLine(item.ToString());
  942. Console.WriteLine("\n");
  943.  
  944. }
  945. Console.WriteLine("Appuyez sur une touche pour retourner au menu.");
  946. Console.ReadKey();
  947. MenuDons(adherents, beneficiaires, dons, garde_Meubles, depotVentes);
  948.  
  949. }
  950.  
  951. public static void CreerDons(List<Don> dons, List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Garde_Meuble> Garde_Meuble, List<DepotVente> depotVentes)
  952. {
  953.  
  954. Console.WriteLine("Creation d'un don");
  955. Console.WriteLine("");
  956. Console.WriteLine("Date ? ");
  957. string date = Console.ReadLine();
  958. Console.WriteLine("Type ? ");
  959. string type = Console.ReadLine();
  960. Console.WriteLine("Référence ? ");
  961. string reference = Console.ReadLine();
  962. Console.WriteLine("Nom ? ");
  963. string nom = Console.ReadLine();
  964. Console.WriteLine("Téléphone ? ");
  965. string tel = Console.ReadLine();
  966. Console.WriteLine("Adresse ? ");
  967. string adresse = Console.ReadLine();
  968. Console.WriteLine("Description ? ");
  969. string description = Console.ReadLine();
  970. bool ok = false;
  971. string choix = "";
  972. string Type = "";
  973. while (ok == false)
  974. {
  975.  
  976. Console.WriteLine("Vaisselle ? (O/N)");
  977. choix = Console.ReadLine();
  978. if(choix == "O")
  979. {
  980.  
  981.  
  982. ok = true;
  983. Type = "Vaisselle";
  984.  
  985. }
  986. if(choix == "N")
  987. {
  988.  
  989.  
  990. ok = true;
  991. }
  992.  
  993.  
  994.  
  995. }
  996.  
  997.  
  998.  
  999.  
  1000. if(Type == "Vaisselle")
  1001. {
  1002.  
  1003.  
  1004.  
  1005. ok = false;
  1006. while (ok == false)
  1007. {
  1008. Console.WriteLine("Nombre ? ");
  1009. int nb = Convert.ToInt32(Console.ReadLine());
  1010. Console.WriteLine("Couverts ou Assiettes ?");
  1011. choix = Console.ReadLine().ToLower();
  1012.  
  1013. if(choix == "couverts")
  1014. {
  1015.  
  1016. Vaisselle temp = new Vaisselle(date, type, reference, nom, tel, adresse, description, 0, "Couverts", nb);
  1017. dons.Add(temp);
  1018. ok = true;
  1019.  
  1020. }
  1021.  
  1022. if(choix == "assiettes")
  1023. {
  1024.  
  1025.  
  1026. Vaisselle temp = new Vaisselle(date, type, reference, nom, tel, adresse, description, 0, "Assiettes", nb);
  1027. dons.Add(temp);
  1028. ok = true;
  1029.  
  1030.  
  1031. }
  1032.  
  1033.  
  1034. }
  1035.  
  1036. MenuDons(adherents, beneficiaires, dons, Garde_Meuble, depotVentes);
  1037.  
  1038. }
  1039.  
  1040.  
  1041.  
  1042.  
  1043. ok = false;
  1044. while (ok == false)
  1045. {
  1046.  
  1047. Console.WriteLine("Table ? (O/N)");
  1048. choix = Console.ReadLine();
  1049. if (choix == "O")
  1050. {
  1051.  
  1052.  
  1053. ok = true;
  1054. Type = "Table";
  1055.  
  1056. }
  1057. if (choix == "N")
  1058. {
  1059.  
  1060.  
  1061. ok = true;
  1062. }
  1063.  
  1064.  
  1065.  
  1066. }
  1067.  
  1068.  
  1069.  
  1070. if(Type == "Table")
  1071. {
  1072. string Table_Type = null;
  1073.  
  1074. ok = false;
  1075.  
  1076. while(ok == false)
  1077. {
  1078.  
  1079.  
  1080.  
  1081. Console.WriteLine("Cuisine ou Salon ?");
  1082. Table_Type = Console.ReadLine().ToLower();
  1083.  
  1084. if(Table_Type == "cuisine")
  1085. {
  1086.  
  1087. ok = true;
  1088.  
  1089. }
  1090. if (Table_Type == "salon")
  1091. {
  1092.  
  1093. ok = true;
  1094.  
  1095. }
  1096.  
  1097. }
  1098.  
  1099. ok = false;
  1100. string Table_Forme = null;
  1101.  
  1102. while(ok == false)
  1103. {
  1104.  
  1105.  
  1106. Console.WriteLine("Rectangulaire, Carree, ou Ronde ?");
  1107. Table_Forme = Console.ReadLine().ToLower();
  1108.  
  1109. if(Table_Forme == "rectangulaire")
  1110. {
  1111.  
  1112. ok = true;
  1113.  
  1114. }
  1115.  
  1116. if (Table_Forme == "carree")
  1117. {
  1118.  
  1119. ok = true;
  1120.  
  1121. }
  1122.  
  1123. if (Table_Forme == "ronde")
  1124. {
  1125.  
  1126. ok = true;
  1127.  
  1128. }
  1129.  
  1130.  
  1131. }
  1132.  
  1133. ok = false;
  1134.  
  1135. while(ok == false)
  1136. {
  1137.  
  1138. Console.WriteLine("Longueur ?");
  1139. double longueur = Convert.ToDouble(Console.ReadLine());
  1140. Console.WriteLine("Largeur ?");
  1141. double largeur = Convert.ToDouble(Console.ReadLine());
  1142.  
  1143. Table temp = new Table(date, type, reference, nom, tel, adresse, description, 0, longueur, largeur, Table_Type, Table_Forme, "Table");
  1144.  
  1145. dons.Add(temp);
  1146.  
  1147. ok = true;
  1148.  
  1149.  
  1150. }
  1151.  
  1152.  
  1153. MenuDons(adherents, beneficiaires, dons,Garde_Meuble, depotVentes);
  1154.  
  1155. }
  1156.  
  1157.  
  1158. ok = false;
  1159.  
  1160. while (ok == false)
  1161. {
  1162.  
  1163. Console.WriteLine("Cuisiniere ? (O/N)");
  1164. choix = Console.ReadLine();
  1165. if (choix == "O")
  1166. {
  1167.  
  1168.  
  1169. ok = true;
  1170. Type = "Cuisiniere";
  1171.  
  1172. }
  1173. if (choix == "N")
  1174. {
  1175.  
  1176.  
  1177. ok = true;
  1178. }
  1179.  
  1180.  
  1181.  
  1182. }
  1183.  
  1184.  
  1185.  
  1186. if(Type == "Cuisiniere")
  1187. {
  1188.  
  1189. Console.WriteLine("Puissance ?");
  1190. double puissance = Convert.ToDouble(Console.ReadLine());
  1191.  
  1192. Console.WriteLine("Nombre de plaques ?");
  1193.  
  1194. int plaques = Convert.ToInt32(Console.ReadLine());
  1195.  
  1196.  
  1197. Console.WriteLine("Longueur ?");
  1198. double Longueur = Convert.ToDouble(Console.ReadLine());
  1199.  
  1200. Console.WriteLine("Largeur ?");
  1201.  
  1202. double largeur = Convert.ToDouble(Console.ReadLine());
  1203.  
  1204.  
  1205.  
  1206.  
  1207. Cuisiniere temp = new Cuisiniere(date, type, reference, nom, tel, adresse, description, 0, Longueur, largeur, puissance, plaques, "Cuisiniere");
  1208.  
  1209. dons.Add(temp);
  1210.  
  1211. MenuDons(adherents, beneficiaires, dons, Garde_Meuble, depotVentes);
  1212.  
  1213.  
  1214. }
  1215.  
  1216.  
  1217. if(Type == "")
  1218. {
  1219.  
  1220.  
  1221. Console.WriteLine("Type de meuble ?");
  1222. string meuble = Console.ReadLine();
  1223. Console.WriteLine("Longueur ?");
  1224. double Longueur = Convert.ToDouble(Console.ReadLine());
  1225.  
  1226. Console.WriteLine("Largeur ? ");
  1227. double Largeur = Convert.ToDouble(Console.ReadLine());
  1228.  
  1229. Objet_Volumineux temp = new Objet_Volumineux(date, type, reference, nom, tel, adresse, description, 0, Longueur, Largeur, meuble);
  1230.  
  1231. dons.Add(temp);
  1232.  
  1233. MenuDons(adherents, beneficiaires, dons, Garde_Meuble, depotVentes);
  1234.  
  1235. }
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245. }
  1246.  
  1247. public static List<Don> ChargerDons()
  1248. {
  1249. int i = 0;
  1250. List<Don> dons = new List<Don>();
  1251. string[] lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Accepte.txt");
  1252. string[] lignes;
  1253. while (i < lines.Length )
  1254. {
  1255. lignes = lines[i].Split(';');
  1256. Don temp = new Don(lignes[0], lignes[1], lignes[2], lignes[3], lignes[4], lignes[5], lignes[6], 1);
  1257. dons.Add(temp);
  1258.  
  1259. i++;
  1260.  
  1261. }
  1262. i = 0;
  1263. lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Refuse.txt");
  1264. while (i < lines.Length )
  1265. {
  1266. lignes = lines[i].Split(';');
  1267. Don temp = new Don(lignes[0], lignes[1], lignes[2], lignes[3], lignes[4], lignes[5], lignes[6], 2);
  1268. dons.Add(temp);
  1269.  
  1270. i++;
  1271.  
  1272. }
  1273. i = 0;
  1274. lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/EnCours.txt");
  1275. while (i < lines.Length)
  1276. {
  1277. lignes = lines[i].Split(';');
  1278. Don temp = new Don(lignes[0], lignes[1], lignes[2], lignes[3], lignes[4], lignes[5], lignes[6], 0);
  1279. dons.Add(temp);
  1280.  
  1281. i++;
  1282.  
  1283. }
  1284. i = 0;
  1285. lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Stocke.txt");
  1286. while (i < lines.Length )
  1287. {
  1288. lignes = lines[i].Split(';');
  1289. Don temp = new Don(lignes[0], lignes[1], lignes[2], lignes[3], lignes[4], lignes[5], lignes[6], 3);
  1290. dons.Add(temp);
  1291.  
  1292. i++;
  1293.  
  1294. }
  1295.  
  1296.  
  1297.  
  1298. return dons;
  1299.  
  1300. }
  1301. public static void AfficherDonsReduit(List<Don> L, List<Adherent> A, List<Beneficiaire> B, List<Garde_Meuble> G, List<DepotVente> D)
  1302. {
  1303.  
  1304. int i = 0;
  1305. Console.WriteLine("Liste des dons à Accepter/Refuser");
  1306. foreach(Don item in L)
  1307. {
  1308.  
  1309. if(item.Statut == 0)
  1310. {
  1311.  
  1312. Console.WriteLine("(" + L.IndexOf(item) + ") " + item.Type + " " + item.Référence + " " + item.Description);
  1313. i++;
  1314.  
  1315. }
  1316.  
  1317. }
  1318. int choix = -1;
  1319. int choix2 = -1;
  1320. do
  1321. {
  1322. Console.WriteLine("Choisissez le don à accepter/Refuser");
  1323. string lecture = Console.ReadLine();
  1324. if(lecture == "")
  1325. {
  1326.  
  1327.  
  1328. MenuDons(A, B, L, G, D);
  1329. }
  1330. choix = Convert.ToInt32(lecture);
  1331. if (choix < L.Count)
  1332. {
  1333. do
  1334. {
  1335. Console.Clear();
  1336. Console.WriteLine(L[choix].ToString());
  1337. Console.WriteLine("Accepter (1) ou Refuser (2) ?");
  1338. choix2 = Convert.ToInt32(Console.ReadLine());
  1339. if (choix2 == 1)
  1340. {
  1341.  
  1342. L[choix].Statut = 1;
  1343. Console.WriteLine("Don Accepté appuyez sur un touche pour revenir au menu");
  1344. Console.ReadKey();
  1345. Menu(A, B, L,G, D);
  1346.  
  1347. }
  1348. if (choix2 == 2)
  1349. {
  1350. L[choix].Statut = 4;
  1351. Console.WriteLine("Don refusé appuyez sur une touche pour revenir au menu");
  1352. Console.ReadKey();
  1353. Menu(A, B, L,G, D);
  1354.  
  1355. }
  1356.  
  1357. } while (choix2 != 1 || choix2 != 2);
  1358. }
  1359.  
  1360. } while (choix > i-1);
  1361.  
  1362.  
  1363.  
  1364. }
  1365. public static List<Adherent> ChargerAdherents()
  1366. {
  1367. int i = 0;
  1368. List<Adherent> adherents = new List<Adherent>();
  1369. string[] lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Adherents.txt");
  1370. string[] lignes;
  1371. while (i < lines.Length-1)
  1372. {
  1373. lignes = lines[i].Split(';');
  1374. Adherent temp = new Adherent(Convert.ToInt32(lignes[0]), lignes[1], lignes[2], lignes[3], lignes[4], lignes[5]);
  1375. adherents.Add(temp);
  1376.  
  1377. i++;
  1378.  
  1379. }
  1380.  
  1381. return adherents;
  1382.  
  1383.  
  1384. }
  1385.  
  1386. public static List<Beneficiaire> ChargerBeneficiaires()
  1387. {
  1388. int i = 0;
  1389. List<Beneficiaire> beneficiaires = new List<Beneficiaire>();
  1390. string[] lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Beneficiaires.txt");
  1391. string[] lignes;
  1392. while (i < lines.Length)
  1393. {
  1394. lignes = lines[i].Split(';');
  1395. Beneficiaire temp = new Beneficiaire(Convert.ToInt32(lignes[0]), lignes[1], lignes[2], lignes[3], lignes[4], lignes[5]);
  1396. beneficiaires.Add(temp);
  1397.  
  1398. i++;
  1399.  
  1400. }
  1401.  
  1402. return beneficiaires;
  1403.  
  1404.  
  1405. }
  1406. public static string RechercheBeneficiaireTel(string Tel, List<Beneficiaire> benef)
  1407. {
  1408. try
  1409. {
  1410. Beneficiaire resultat = benef.Find(item => item.Telephone == Tel);
  1411. return resultat.ToString();
  1412.  
  1413. } catch {
  1414.  
  1415. return "Aucune personne trouvée";
  1416. }
  1417.  
  1418.  
  1419. }
  1420. public static string RechercheBeneficiaireNom(string Nom, List<Beneficiaire> benef)
  1421. {
  1422. try
  1423. {
  1424. Beneficiaire resultat = benef.Find(item => item.Nom == Nom);
  1425. return resultat.ToString();
  1426. }
  1427. catch
  1428. {
  1429.  
  1430. return "Aucune personne trouvée";
  1431. }
  1432.  
  1433.  
  1434. }
  1435.  
  1436. public static List<Garde_Meuble> ChargerGardeMeuble()
  1437. {
  1438. List<Garde_Meuble> Garde_Meuble = new List<Garde_Meuble>();
  1439. int i = 0;
  1440. string[] lines = System.IO.File.ReadAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Garde_Meuble.txt");
  1441. while (i < lines.Length)
  1442. {
  1443. string[] lignes = lines[i].Split(';');
  1444. Don temp = new Don(lignes[0], lignes[1], lignes[2], lignes[3], lignes[4], lignes[5], lignes[6], 3);
  1445. Beneficiaire temp2 = new Beneficiaire(Convert.ToInt32(lignes[7]), lignes[8], lignes[9], lignes[10], lignes[11], lignes[12]);
  1446. string Datedepot = lignes[13];
  1447. string DateEnlevement = lignes[14];
  1448. Garde_Meuble temp3 = new Garde_Meuble(temp, temp2, Datedepot, DateEnlevement);
  1449. Garde_Meuble.Add(temp3);
  1450. i++;
  1451.  
  1452. }
  1453.  
  1454. return Garde_Meuble;
  1455.  
  1456.  
  1457. }
  1458.  
  1459. public static void Menu(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> Garde_Meuble, List<DepotVente> depots_ventes)
  1460. {
  1461.  
  1462. bool passe = false;
  1463. int choix = 0;
  1464. do
  1465. {
  1466. Console.WriteLine(" ");
  1467. Console.WriteLine(" ");
  1468. Console.WriteLine(" ");
  1469. Console.WriteLine(" ");
  1470. Console.WriteLine(" ");
  1471. Console.WriteLine(" ");
  1472. Console.WriteLine(" Gestion de Dons ");
  1473. Console.WriteLine(" ");
  1474. Console.WriteLine(" ");
  1475. Console.WriteLine("(1) Module Personnes");
  1476. Console.WriteLine("(2) Module Dons");
  1477. Console.WriteLine("(3) Module Tris");
  1478. Console.WriteLine("(4) Module Statistique");
  1479. Console.WriteLine("(5) Module Autres");
  1480. Console.WriteLine("(6) Sauvegarder et quitter");
  1481. Console.WriteLine("Votre choix ?");
  1482. choix = Convert.ToInt32(Console.ReadLine());
  1483.  
  1484. if(choix == 1)
  1485. {
  1486.  
  1487. MenuPersonnes(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1488. passe = true;
  1489. }
  1490. if (choix == 2)
  1491. {
  1492.  
  1493. MenuDons(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1494. passe = true;
  1495. }
  1496. if (choix == 3)
  1497. {
  1498.  
  1499. MenuTris(adherents,beneficiaires,dons, Garde_Meuble, depots_ventes);
  1500. passe = true;
  1501. }
  1502. if(choix == 4)
  1503. {
  1504.  
  1505. MenuStats(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1506. passe = true;
  1507. }
  1508. if (choix == 5)
  1509. {
  1510.  
  1511. MenuBonus(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1512. passe = true;
  1513. }
  1514. if (choix == 6)
  1515. {
  1516. Sauvegarder(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1517. passe = true;
  1518.  
  1519. }
  1520.  
  1521. } while (passe == false);
  1522.  
  1523.  
  1524.  
  1525. }
  1526.  
  1527. public static void MenuPersonnes(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> Garde_Meuble, List<DepotVente> depots_ventes)
  1528. {
  1529. int choix = 0;
  1530. bool passe = false;
  1531. do
  1532. {
  1533.  
  1534. Console.WriteLine(" Module Personnes ");
  1535. Console.WriteLine(" ");
  1536. Console.WriteLine(" ");
  1537. Console.WriteLine("(1) Rechercher un beneficiaire par nom");
  1538. Console.WriteLine("(2) Rechercher un beneficiaire par Téléphone");
  1539. Console.WriteLine("Votre choix ? ");
  1540. choix = Convert.ToInt32(Console.ReadLine());
  1541.  
  1542. if(choix == 1)
  1543. {
  1544.  
  1545. Console.WriteLine("Entrez le nom du beneficiaire à chercher");
  1546. string nom = Console.ReadLine();
  1547. string resultat = RechercheBeneficiaireNom(nom, beneficiaires);
  1548. Console.WriteLine(resultat);
  1549. passe = true;
  1550. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1551.  
  1552.  
  1553. }
  1554. if(choix == 2)
  1555. {
  1556. Console.WriteLine("Entrez le numéro du beneficiaire à chercher");
  1557. string Tel = Console.ReadLine();
  1558. string resultat = RechercheBeneficiaireTel(Tel, beneficiaires);
  1559. Console.WriteLine(resultat);
  1560. passe = true;
  1561. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1562.  
  1563.  
  1564. }
  1565.  
  1566.  
  1567. } while (passe == false);
  1568.  
  1569. }
  1570.  
  1571. public static void MenuDons(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> Garde_Meuble, List<DepotVente> depots_ventes)
  1572. {
  1573.  
  1574. int choix = 0;
  1575. bool passe = false;
  1576. do
  1577. {
  1578. Console.WriteLine(" Module Dons ");
  1579. Console.WriteLine(" ");
  1580. Console.WriteLine(" ");
  1581. Console.WriteLine("(1) Creer un Don");
  1582. Console.WriteLine("(2) Accepter/Refuser un Don");
  1583. Console.WriteLine("(3) Stockage d'un Don");
  1584. Console.WriteLine("(4) Contenu du Garde Meuble");
  1585. Console.WriteLine("(5) Contenu des archives");
  1586. Console.WriteLine("(6) Transfert Don beneficiaire");
  1587. Console.WriteLine("(7) Creer depot vente");
  1588. Console.WriteLine("(8) Afficher depot vente");
  1589. Console.WriteLine("(9) Retour");
  1590. Console.WriteLine("Votre choix ? ");
  1591. choix = Convert.ToInt32(Console.ReadLine());
  1592.  
  1593. if(choix == 1)
  1594. {
  1595.  
  1596. CreerDons(dons, adherents, beneficiaires, Garde_Meuble, depots_ventes);
  1597. passe = true;
  1598. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1599.  
  1600.  
  1601. }
  1602. if(choix == 2)
  1603. {
  1604. AfficherDonsReduit(dons,adherents,beneficiaires, Garde_Meuble, depots_ventes);
  1605. passe = true;
  1606. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1607.  
  1608. }
  1609. if(choix == 3 )
  1610. {
  1611.  
  1612. StockerMenu(dons, adherents,beneficiaires, Garde_Meuble, depots_ventes);
  1613. passe = true;
  1614. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1615.  
  1616. }
  1617.  
  1618. if (choix == 4)
  1619. {
  1620.  
  1621. AfficherGardeMeuble(dons, adherents, beneficiaires, Garde_Meuble, depots_ventes);
  1622. passe = true;
  1623. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1624.  
  1625. }
  1626. if(choix == 5)
  1627. {
  1628.  
  1629. AfficherArchives(dons);
  1630. passe = true;
  1631. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1632.  
  1633. }
  1634. if(choix == 6)
  1635. {
  1636.  
  1637. TransfertDonBenef(dons, beneficiaires);
  1638. passe = true;
  1639. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1640.  
  1641. }
  1642. if(choix == 7)
  1643. {
  1644. CreerDV(depots_ventes);
  1645. passe = true;
  1646. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1647.  
  1648. }
  1649. if(choix == 8)
  1650. {
  1651. AfficherDV(depots_ventes);
  1652. passe = true;
  1653. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1654. }
  1655. if (choix == 9)
  1656. {
  1657.  
  1658. passe = true;
  1659. Menu(adherents, beneficiaires, dons, Garde_Meuble, depots_ventes);
  1660.  
  1661. }
  1662.  
  1663.  
  1664.  
  1665. } while (passe == false);
  1666.  
  1667. }
  1668.  
  1669. public static void MenuTris(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> garde_Meubles, List<DepotVente> depots_ventes)
  1670. {
  1671.  
  1672. int choix = 0;
  1673. bool ok = false;
  1674. while(ok == false)
  1675. {
  1676.  
  1677. Console.WriteLine(" Module Tris ");
  1678. Console.WriteLine(" ");
  1679. Console.WriteLine(" ");
  1680. Console.WriteLine("(1) Lister les dons refuses tries par date ");
  1681. Console.WriteLine("(2) Lister les dons en traitement (accepté ou stocké) par ordre d’identifiant et de Nom de Donataire ");
  1682. Console.WriteLine("(3) Lister les dons vendus/donnés par mois /numéro de bénéficiaire");
  1683. Console.WriteLine("(4) Lister les dons stockés par entrepôt et par catégorie/description");
  1684. Console.WriteLine("(5) Lister les dons stockés par entrepôt et par volume");
  1685. Console.WriteLine("(6) Lister les dons par dépôt-vente et par prix");
  1686. Console.WriteLine("(7) Retour");
  1687. Console.WriteLine("Votre choix ? ");
  1688. choix = Convert.ToInt32(Console.ReadLine());
  1689.  
  1690. if(choix == 1)
  1691. {
  1692.  
  1693. TriDonRefuseDate(dons);
  1694. ok = true;
  1695. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1696.  
  1697. }
  1698. if (choix == 2)
  1699. {
  1700.  
  1701. TriDonTraitement(dons);
  1702. ok = true;
  1703. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1704.  
  1705. }
  1706. if (choix == 3)
  1707. {
  1708. TriDonVendu(dons);
  1709.  
  1710. ok = true;
  1711. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1712.  
  1713. }
  1714. if(choix == 4)
  1715. {
  1716.  
  1717. TriDonStockeType(garde_Meubles, depots_ventes);
  1718. ok = true;
  1719. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1720.  
  1721. }
  1722. if(choix == 5)
  1723. {
  1724.  
  1725.  
  1726. }
  1727.  
  1728. if(choix == 6)
  1729. {
  1730.  
  1731. TriDepotPrix(depots_ventes);
  1732. ok = true;
  1733. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1734.  
  1735. }
  1736. if(choix == 7)
  1737. {
  1738.  
  1739. ok = true;
  1740. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1741.  
  1742. }
  1743.  
  1744.  
  1745.  
  1746.  
  1747. }
  1748.  
  1749.  
  1750. }
  1751. public static void MenuStats(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> garde_Meubles, List<DepotVente> depots_ventes)
  1752. {
  1753.  
  1754. int choix = 0;
  1755. bool ok = false;
  1756. while (ok == false)
  1757. {
  1758.  
  1759. Console.WriteLine(" Module Stats ");
  1760. Console.WriteLine(" ");
  1761. Console.WriteLine(" ");
  1762. Console.WriteLine("(1) Calculer la moyenne de temps entre la date de réception et la date de retrait des dons\ndans les zones de stockage ");
  1763. Console.WriteLine("(2) Calculer la moyenne de prix des objets dans les dépôts-ventes ");
  1764. Console.WriteLine("(3) Calculez la moyenne d’âge des bénéficiaires");
  1765. Console.WriteLine("(4) Retour");
  1766. Console.WriteLine("Votre choix ? ");
  1767. choix = Convert.ToInt32(Console.ReadLine());
  1768.  
  1769. if(choix == 1)
  1770. {
  1771.  
  1772. MoyDepotRecep(garde_Meubles);
  1773. ok = true;
  1774. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1775.  
  1776. }
  1777.  
  1778. if(choix == 2)
  1779. {
  1780.  
  1781. MoyPrixDepotVente(depots_ventes);
  1782. ok = true;
  1783. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1784.  
  1785. }
  1786.  
  1787. if(choix == 3)
  1788. {
  1789. MoyAgeBenef(beneficiaires);
  1790. ok = true;
  1791. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1792.  
  1793. }
  1794.  
  1795. if(choix == 4)
  1796. {
  1797.  
  1798. ok = true;
  1799. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1800. }
  1801. }
  1802. }
  1803.  
  1804.  
  1805. public static void MenuBonus(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> garde_Meubles, List<DepotVente> depots_ventes)
  1806. {
  1807. int choix = 0;
  1808. bool ok = false;
  1809. while (ok == false)
  1810. {
  1811.  
  1812. Console.WriteLine(" Module Stats ");
  1813. Console.WriteLine(" ");
  1814. Console.WriteLine(" ");
  1815. Console.WriteLine("(1) Calculatrice ");
  1816. Console.WriteLine("(2) Ajouter Beneficiaire ");
  1817. Console.WriteLine("(3) ??? ");
  1818. Console.WriteLine("(4) ??? ");
  1819. Console.WriteLine("(5) Retour");
  1820. Console.WriteLine("Votre choix ? ");
  1821. choix = Convert.ToInt32(Console.ReadLine());
  1822.  
  1823. if(choix == 1)
  1824. {
  1825.  
  1826. Calculatrice();
  1827. ok = true;
  1828. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1829.  
  1830. }
  1831. if(choix == 2)
  1832. {
  1833.  
  1834. AjouterBenef(beneficiaires);
  1835. ok = true;
  1836. Menu(adherents, beneficiaires, dons, garde_Meubles, depots_ventes);
  1837.  
  1838. }
  1839.  
  1840. }
  1841.  
  1842. }
  1843.  
  1844. public static void Sauvegarder(List<Adherent> adherents, List<Beneficiaire> beneficiaires, List<Don> dons, List<Garde_Meuble> garde_Meubles,List<DepotVente> depotVentes)
  1845. {
  1846.  
  1847. SaveAdherents(adherents);
  1848. SaveBeneficiaires(beneficiaires);
  1849. Environment.Exit(0);
  1850.  
  1851.  
  1852. }
  1853.  
  1854. public static void SaveAdherents(List<Adherent> A)
  1855. {
  1856. int i = 0;
  1857. int longueur = A.Count;
  1858. string[] lines = new string[longueur];
  1859. string str = null;
  1860. foreach(Adherent item in A)
  1861. {
  1862. str = "";
  1863.  
  1864. str += Convert.ToString(item.ID);
  1865. str += ";";
  1866. str += item.Nom;
  1867. str += ";";
  1868. str += item.Adresse;
  1869. str += ";";
  1870. str += item.Telephone;
  1871. str += ";";
  1872. str += item.Prenom;
  1873. str += ";";
  1874. str += item.Statut;
  1875. lines[i] = str;
  1876. i++;
  1877.  
  1878. }
  1879. System.IO.File.WriteAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Adherents.txt", lines);
  1880.  
  1881.  
  1882. }
  1883.  
  1884. public static void SaveBeneficiaires(List<Beneficiaire> B)
  1885. {
  1886.  
  1887. int i = 0;
  1888. int longueur = B.Count;
  1889. string[] lines = new string[longueur];
  1890. string str = null;
  1891. foreach(Beneficiaire item in B)
  1892. {
  1893. str = "";
  1894.  
  1895. str += Convert.ToString(item.ID);
  1896. str += ";";
  1897. str += item.Nom;
  1898. str += ";";
  1899. str += item.Adresse;
  1900. str += ";";
  1901. str += item.Telephone;
  1902. str += ";";
  1903. str += item.Nom;
  1904. str += ";";
  1905. str += item.DateNaissance;
  1906. lines[i] = str;
  1907. i++;
  1908.  
  1909.  
  1910. }
  1911. System.IO.File.WriteAllLines(@"/Users/Paul/Projects/ProjetFinalP2O/Beneficiaires.txt", lines);
  1912.  
  1913.  
  1914. }
  1915.  
  1916. public static void Main(string[] args)
  1917. {
  1918. List<Adherent> adherents = ChargerAdherents();
  1919. List<Beneficiaire> beneficiaires = ChargerBeneficiaires();
  1920. List<Don> dons = ChargerDons();
  1921. List<Garde_Meuble> garde_meuble = ChargerGardeMeuble();
  1922. List<DepotVente> depots_ventes = new List<DepotVente>();
  1923. Menu(adherents, beneficiaires, dons, garde_meuble, depots_ventes);
  1924.  
  1925. }
  1926. }
  1927. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement