示例#1
0
        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);
        }
示例#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;
 }
示例#3
0
 public Receiver(string firstName, string lastName, DateTime dateOfBirth, BloodType memberBloodType, string email)
     : base(firstName, lastName, dateOfBirth, memberBloodType, email)
 {
     LastReceivedDate = DateTime.MinValue;
 }
示例#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;
 }
示例#5
0
 public bool CanReceiveFrom(BloodType other)
 {
     return(other.CanDonateTo(this));
 }