public bool CanDonateTo(BloodType other)
        {
            // O- can donate to anyone/ O+ can donate to any +
            if (Letter == "O")
            {
                return(Sign == '-' || other.Sign == '+');
            }

            if (Letter == "A" || Letter == "B")
            {
                if (other.Letter == Letter || other.Letter == "AB")
                {
                    return(Sign == '-' || other.Sign == '+');
                }
            }

            if (Letter == "AB")
            {
                if (other.Letter == Letter)
                {
                    return(Sign == '-' || other.Sign == '+');
                }
            }

            return(false);
        }
Exemple #2
0
 public Member(string firstName, string lastName, DateTime dateOfBirth, BloodType memberBloodType, string email)
 {
     Id              = Guid.NewGuid();
     FirstName       = firstName;
     LastName        = lastName;
     DateOfBirth     = dateOfBirth;
     MemberBloodType = memberBloodType;
     Email           = email;
 }
Exemple #3
0
 public Receiver(string firstName, string lastName, DateTime dateOfBirth, BloodType memberBloodType, string email)
     : base(firstName, lastName, dateOfBirth, memberBloodType, email)
 {
     LastReceivedDate = DateTime.MinValue;
 }
Exemple #4
0
 public Donor(string firstName, string lastName, DateTime dateOfBirth, BloodType memberBloodType, string email)
     : base(firstName, lastName, dateOfBirth, memberBloodType, email)
 {
     LastDonatedDate = DateTime.MinValue;
     NumTimesDonated = 0;
 }
 public bool CanReceiveFrom(BloodType other)
 {
     return(other.CanDonateTo(this));
 }