Ejemplo n.º 1
0
        //boolean BajaSeleccion( ) calls for the id of the member to terminate, if it exists is removed by moving
        //the list of participants and updating counters. Returns true if it has been unable to complete operation,
        //false otherwise.

        //public Boolean MinimumParticipant()
        //{
        //    int id;
        //    Console.WriteLine("Introduce ID.");
        //    id = Convert.ToInt32(Console.ReadLine());

        //    foreach (SeleccionFutbol x in participants)
        //    {
        //        if (participants.Count() != 0)
        //        {
        //            if (x.GetId() ==id)
        //            {
        //                Console.WriteLine("***********Participant was successfully removed**********");
        //                return true;
        //            }
        //        }
        //    }
        //    Console.WriteLine("There is no participant with that ID");
        //    return false;
        //}

        //to remove participant
        public bool RemoveParticipant(SeleccionFutbol participant)
        {
            if (participants.Remove(participant))
            {
                return(true);
            }
            else
            {
                Console.WriteLine("ID not find player in selection");
                return(false);
            }
        }
Ejemplo n.º 2
0
        //Este metodo recibe un objeto del tipo CocheSimple(puede ser: taxi, autobus o cochesimple) y lo añade a la lista
        public void AddParticipant(SeleccionFutbol participant)
        {
            if (MaximumParticipant(participant))
            {
                if (participant.GetType().Name == "Entrenador")
                {
                    numeroEntrenador++;
                }
                else if (participant.GetType().Name == "Masajista")
                {
                    numeroMasajista++;
                }

                participants.Add(participant);
            }
        }
Ejemplo n.º 3
0
 //boolean AltaSeleccion ( ) Allowed if there is room , to enlist a new member and
 public Boolean MaximumParticipant(SeleccionFutbol participant)
 {
     if (participants.Count < 30)
     {
         if (participant.GetType().Name == "Masajista" && numeroMasajista < 4)
         {
             Console.WriteLine("One more masseur is in the team");
             return(true);
         }
         else if (participant.GetType().Name == "Entrenador" && numeroEntrenador < 2)
         {
             Console.WriteLine("One more trainer is in the team");
             return(true);
         }
         else if (participant.GetType().Name == "Futbolista")
         {
             Console.WriteLine("One more player is in the team");
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        //MostrarDatosSelección(): Displays the name of the country, the number of members and their data.
        //sin parameter below
        public string MostrarDatos(List <SeleccionFutbol> participants)
        {
            string result = "";

            if (this.GetCountryName() != "")
            {
                result += "COUNTRY NAME: " + this.GetCountryName() + " ";
            }
            if (this.GetActualNumberPlayers() != 0)
            {
                result += "NUMBER OF PLAYERS " + SeleccionFutbol.GetCount() + " ";
            }
            Console.WriteLine(result);

            foreach (SeleccionFutbol person in participants)
            {
                //to get the name of the person in the beginning
                Console.WriteLine(person.GetType().Name.ToUpper());
                Console.WriteLine(person.ToString());
                Console.WriteLine("**************************");
            }
            return(result);
        }