Esempio n. 1
0
        public Donor GetById(Guid donorId)
        {
            Donor donor = null;

            for (int i = 0; i < _donors.Count; i++)
            {
                if (_donors[i].Id == donorId)
                {
                    Console.WriteLine($"Found Donor! {_donors[i].FullName}");
                    donor = _donors[i];
                }
            }

            if (donor == null)
            {
                throw new Exception($"Donor {donorId} not found!");
            }
            return(donor);
        }
Esempio n. 2
0
        public BloodBank()
        {
            _members = new List <Member>();

            BloodType typeONeg  = new BloodType("O", '-');
            BloodType typeAbPos = new BloodType("AB", '+');

            // Test donors
            Donor firstDonor  = new Donor("Pablo", "Listingart", new DateTime(1980, 2, 23), typeONeg, "*****@*****.**");
            Donor secondDonor = new Donor("Jesselyn", "Popoff", new DateTime(1990, 1, 1), typeAbPos, "*****@*****.**");

            // Test receiver
            Receiver testReceiver = new Receiver("Homer", "Simpson", new DateTime(1970, 3, 22), typeONeg, "*****@*****.**");

            // Basic member
            Member member = new Member("Lisa", "Simpson", new DateTime(2000, 3, 24), typeAbPos, "");

            _members.Add(firstDonor);
            _members.Add(secondDonor);
            _members.Add(testReceiver);
            _members.Add(member);
        }
Esempio n. 3
0
        public BloodBank(IStoreDonors donorStorageArg)
        {
            _donorStorage = donorStorageArg;
            _donations    = new List <Donation>(); // 3.3: This should be replaced with a constructor argument

            _receivers = new List <Receiver>();

            // TODO: Add all blood types
            BloodType typeONeg  = new BloodType("O", '-');
            BloodType typeAbPos = new BloodType("AB", '+');

            // Test donors
            Donor firstDonor = new Donor("Pablo", "Listingart", new DateTime(1980, 2, 23), typeONeg, "*****@*****.**");

            Console.WriteLine($"ID: {firstDonor.Id}");
            Donor secondDonor = new Donor("Jesselyn", "Popoff", new DateTime(1990, 1, 1), typeAbPos, "*****@*****.**");

            // Test receiver
            Receiver testReceiver = new Receiver("Homer", "Simpson", new DateTime(1970, 3, 22), typeONeg, "*****@*****.**");

            _donorStorage.Create(firstDonor);
            _donorStorage.Create(secondDonor);
            _receivers.Add(testReceiver);
        }
 public void Create(Donor donorToCreate)
 {
     //....
 }
Esempio n. 5
0
 public void Create(Donor donorToCreate)
 {
     // Code...
     return;
 }
Esempio n. 6
0
 public void Create(Donor donorToCreate)
 {
     _donors.Add(donorToCreate);
 }