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); }
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; }
public Receiver(string firstName, string lastName, DateTime dateOfBirth, BloodType memberBloodType, string email) : base(firstName, lastName, dateOfBirth, memberBloodType, email) { LastReceivedDate = DateTime.MinValue; }
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)); }