示例#1
0
 // Constructeur
 public Location(Vehicule vehi, Client cli, Trajet tra, uint id, string dateDeDepart, string dateDArriver, double prixLoc)   // Constructeur 1
 {
     this.id           = id;
     this.cli          = cli;
     this.vehi         = vehi;
     this.tra          = tra;
     this.dateDeDepart = dateDeDepart;
     this.dateDArriver = dateDArriver;
     this.prixLoc      = prixLoc;
 }
示例#2
0
        static void CreerLocation(Client cli, Vehicule veh, Parc parc)    // Méthode de création d'une location
        {
            Console.Clear();
            Console.WriteLine("\t\tPage de Location :\n\nLocation du vehicule :");
            veh.ToString();
            Trajet   tra = new Trajet();
            Location loc = new Location(veh, cli, tra);

            parc.AjouterUneLocation(loc);
            cli.ChargementLocationClient();
        }
示例#3
0
 public Location(Vehicule vehi, Client cli, Trajet tra) // Constructeur 2
 {
     this.cli  = cli;
     this.vehi = vehi;
     this.tra  = tra;
     Console.WriteLine("Date de départ :\t\t(jj/mm/aaaa)");
     dateDeDepart = Console.ReadLine();
     Console.WriteLine("Date d'arriver :\t\t(jj/mm/aaaa)");
     dateDArriver = Console.ReadLine();
     CalculCoutLocation();
     EnvoiMailValidationLoc();
 }
示例#4
0
        public void ChargementDonnees()     // Chargement de tous les contenus des fichiers dans les listes
        {
            listCli  = new List <Client>();
            listVeh  = new List <Vehicule>();
            listLoca = new List <Location>();
            try
            {
                CreationFichierSiNonExistant();
                StreamReader fluxLec = new StreamReader("FichierClient.txt");   // Chargement du FichierClient dans la liste listCli
                while (fluxLec.EndOfStream == false)
                {
                    string[] tab = fluxLec.ReadLine().Split(';');
                    Client   cli = new Client(Convert.ToUInt32(tab[0]), tab[1], tab[2], tab[3], Convert.ToUInt32(tab[4]), Convert.ToBoolean(tab[5]), Convert.ToBoolean(tab[6]), Convert.ToBoolean(tab[7]), Convert.ToBoolean(tab[8]));

                    listCli.Add(cli);
                }
                fluxLec.Close();

                fluxLec = new StreamReader("FichierVehicule.txt");        // Chargement du FichierVehicule dans la liste listVeh
                while (fluxLec.EndOfStream == false)
                {
                    string[] tab = fluxLec.ReadLine().Split(';');
                    Vehicule veh = null;
                    if (tab.Length == 10)
                    {
                        veh = new Moto(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]));
                    }
                    else if (tab.Length == 11)
                    {
                        veh = new Camion(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]), Convert.ToDouble(tab[10]));
                    }
                    else if (tab.Length == 12)
                    {
                        veh = new Voiture(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]), Convert.ToInt32(tab[10]), tab[11]);
                    }
                    listVeh.Add(veh);
                }
                fluxLec.Close();

                fluxLec = new StreamReader("FichierLocation.txt");       // Chargement du FichierLocation dans la liste listLoca
                while (fluxLec.EndOfStream == false)
                {
                    string[] tab  = fluxLec.ReadLine().Split(';');
                    Vehicule veh  = null;
                    Client   cli  = null;
                    Trajet   tra  = null;
                    Location loca = null;
                    if (tab.Length == 26)
                    {
                        veh  = new Moto(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]));
                        cli  = new Client(Convert.ToUInt32(tab[10]), tab[11], tab[12], tab[13], Convert.ToUInt32(tab[14]), Convert.ToBoolean(tab[15]), Convert.ToBoolean(tab[16]), Convert.ToBoolean(tab[17]), Convert.ToBoolean(tab[18]));
                        tra  = new Trajet(tab[19], tab[20], Convert.ToInt32(tab[21]));
                        loca = new Location(veh, cli, tra, Convert.ToUInt32(tab[22]), tab[23], tab[24], Convert.ToDouble(tab[25]));
                        listLoca.Add(loca);
                    }
                    else if (tab.Length == 27)
                    {
                        veh  = new Camion(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]), Convert.ToDouble(tab[10]));
                        cli  = new Client(Convert.ToUInt32(tab[11]), tab[12], tab[13], tab[14], Convert.ToUInt32(tab[15]), Convert.ToBoolean(tab[16]), Convert.ToBoolean(tab[17]), Convert.ToBoolean(tab[18]), Convert.ToBoolean(tab[19]));
                        tra  = new Trajet(tab[20], tab[21], Convert.ToInt32(tab[22]));
                        loca = new Location(veh, cli, tra, Convert.ToUInt32(tab[23]), tab[24], tab[25], Convert.ToDouble(tab[26]));
                        listLoca.Add(loca);
                    }
                    else if (tab.Length == 28)
                    {
                        veh  = new Voiture(Convert.ToUInt32(tab[0]), tab[1], tab[2], Convert.ToInt32(tab[3]), tab[4], Convert.ToInt32(tab[5]), tab[6], tab[7], Convert.ToDouble(tab[8]), Convert.ToInt32(tab[9]), Convert.ToInt32(tab[10]), tab[11]);
                        cli  = new Client(Convert.ToUInt32(tab[12]), tab[13], tab[14], tab[15], Convert.ToUInt32(tab[16]), Convert.ToBoolean(tab[17]), Convert.ToBoolean(tab[18]), Convert.ToBoolean(tab[19]), Convert.ToBoolean(tab[20]));
                        tra  = new Trajet(tab[21], tab[22], Convert.ToInt32(tab[23]));
                        loca = new Location(veh, cli, tra, Convert.ToUInt32(tab[24]), tab[25], tab[26], Convert.ToDouble(tab[27]));
                    }
                    listLoca.Add(loca);
                }
                fluxLec.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "parc.ChargementDonnees");
                Console.ReadKey();
            }
        }