Пример #1
0
 //Methods
 public static List<Donor> GetAllDonors()
 {
     List<Donor> allDonors = new List<Donor>();
     DonorTableAdapter taDonor = new DonorTableAdapter();
     DataLayer.DSHHBloodBank.DonorDataTable dtDonor = taDonor.GetData();
     foreach(DataLayer.DSHHBloodBank.DonorRow currentDonor in dtDonor)
     {
         Donor newDonor = new Donor(
             currentDonor.Id,
             currentDonor.NIN,
             currentDonor.Forename,
             currentDonor.Surname,
             currentDonor.BloodType,
             currentDonor.Address,
             currentDonor.Postcode,
             currentDonor.Telephone);
         allDonors.Add(newDonor);
     }
     return allDonors;
 }
Пример #2
0
        public static Donor GetDonorByNIN(string nin)
        {
            Donor donorByNIN = new Donor();

            DonorTableAdapter taDonor = new DonorTableAdapter();
            DataLayer.DSHHBloodBank.DonorDataTable dtDonor = taDonor.GetDonorByNIN(nin);
            foreach (DataLayer.DSHHBloodBank.DonorRow currentDonor in dtDonor)
            {
                Donor returnDonor = new Donor(
                    currentDonor.Id,
                    currentDonor.NIN,
                    currentDonor.Forename,
                    currentDonor.Surname,
                    currentDonor.BloodType,
                    currentDonor.Address,
                    currentDonor.Postcode,
                    currentDonor.Telephone);
                donorByNIN = returnDonor;
            };

            return donorByNIN;

        }