예제 #1
0
파일: Donor.cs 프로젝트: MGD4375/ABOB
 //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
파일: Donor.cs 프로젝트: MGD4375/ABOB
        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;

        }