public void GenetateMed() { for (int i = 1; i < 7; i++) { MedOrganization med = new MedOrganization(); med.Id = i; med.NameOrg = ((Organisation)(rand.Next(0, 6))).ToString(); med.Address = ((Address)rand.Next(0, 6)).ToString(); med.Tel = (rand.Next(300000, 999999)).ToString(); listMed.Add(med); } }
public bool Zakreplenir(ref GenerateMedCenter organ, ref GeneratePatient pat, out string message) { Console.Clear(); foreach (Patient item in pat.listPat) { item.PrintInfo(); } Console.WriteLine(""); Patient selectPatient = new Patient(); Console.WriteLine("Select Patient "); int choicePatient = Int32.Parse(Console.ReadLine()); selectPatient = pat[choicePatient]; Console.WriteLine(""); foreach (MedOrganization item2 in organ.listMed) { item2.PrintInfo(); } Console.WriteLine(""); MedOrganization selectMed = new MedOrganization(); Console.WriteLine("Select Med organization "); int choiceMed = Int32.Parse(Console.ReadLine()); selectMed = organ[choiceMed]; Console.WriteLine(""); Console.Clear(); var t = organ.listMed.FirstOrDefault(f => f.Id == choiceMed); foreach (var p in t.patients) { if (p.ID == choicePatient) { message = "This patient is already attached!"; return(false); } } t.patients.Add(selectPatient); pat.listPat.FirstOrDefault(f => f.ID == choicePatient) .MedOrgan = selectMed; message = "The patient is successfully attached!"; return(true); }