public Programare[] ObtineProgramari(DateTime d) { Programare[] programari = new Programare[listaProgramari.Count]; int i = 0; foreach (Programare p in listaProgramari) { if (p.Data.Day == d.Day) { programari[i] = p; i++; } } return(programari); }
private void Programari_Load(object sender, EventArgs e) { Programare[] p = new Programare[3]; Programare p1 = new Programare(1, "Popescu Ion", Convert.ToDateTime("16/05/2015 15:00"), 2); Programare p2 = new Programare(2, "Mangu Bogdan", Convert.ToDateTime("25/08/2015 12:00"), 1); Programare p3 = new Programare(3, "Vrancea Marian", Convert.ToDateTime("10/07/2015 13:00"), 0); cab.AdaugaProgramare(p1); cab.AdaugaProgramare(p2); cab.AdaugaProgramare(p3); p[0] = p1; p[1] = p2; p[2] = p3; for (int i = 0; i < 3; i++) { ListViewItem item = new ListViewItem(Convert.ToString(p[i].Cod)); item.SubItems.Add(p[i].NumePacient); item.SubItems.Add(Convert.ToString(p[i].Data)); item.SubItems.Add(Convert.ToString(p[i].Specialitate1)); lvProgramari.Items.Add(item); } }
public void AdaugaProgramare(Programare p) { listaProgramari.Add(p); AdaugareProgramare = new DelegatAdaugareProgramare(AfisareInformatii); AdaugareProgramare(p); }
public void AfisareInformatii(Programare p) { Console.WriteLine("Ultima programare a fost: " + p.ToString()); }