lundi 29 mai 2017

Assigning numbers to members of a list

I need some ideas to implement in my project. I need to assign a ticket number to persons on this list.

ListaUtente.Add(new Utente(100001, "John", 914754123, "john@gmail.com", GetRandomColor()));
        ListaUtente.Add(new Utente(100002, "Peter", 974123214, "peter@gmail.com", GetRandomColor()));
        ListaUtente.Add(new Utente(100003, "Tidus", 941201456, "tidus@gmail.com", GetRandomColor()));
        ListaUtente.Add(new Utente(100004, "Poppy", 987453210, "pops@gmail.com", GetRandomColor()));

Utente class is:

class Utente
{
    // Class Atributes

    private int numUtenteSaude;
    private String nome;
    private int telefone;
    private String email;
    private ConsoleColor color;





    public Utente(int numUtenteSaude, String nome, int telefone, String email, ConsoleColor color)
    {
        this.numUtenteSaude = numUtenteSaude;
        this.nome = nome;
        this.telefone = telefone;
        this.email = email;
        this.color = color;
    }



    public void display()
    {
        Console.ForegroundColor = this.color;
        Console.WriteLine("Pessoa: Numero Utente Saude: " + numUtenteSaude + " Telefone: " + telefone + "  " + "Nome:" + nome + " Email: " + email);
    }

    public override string ToString()
    {
        return String.Format("{0} {1} {2} {3} {4}", numUtenteSaude, nome, telefone, email, color);
    }
}

}

This is like an hospital and the people on the list are arriving at the medical center. I need to assign a ticket number to people in the list. How can I do this?




Aucun commentaire:

Enregistrer un commentaire