Example #1
0
 public Receiver(
     string firstNameArg,
     string lastNameArg,
     DateTime dateOfBirthArg,
     BloodType bloodTypeArg
     ) : base(firstNameArg, lastNameArg, dateOfBirthArg)
 {
     _bloodType = bloodTypeArg;
 }
Example #2
0
 public Donor(
     string firstNameArg,
     string lastNameArg,
     DateTime dateOfBirthArg,
     BloodType bloodTypeArg
     ) : base(firstNameArg, lastNameArg, dateOfBirthArg)
 {
     _bloodType       = bloodTypeArg;
     _numTimesDonated = 0;
 }
Example #3
0
        public bool CanDonateTo(BloodType receiverType)
        {
            // Console.WriteLine("Donating type:");
            // PrintDetails(); //donor1 bloodType
            // Console.WriteLine("Receiving type:");
            // receiverType.PrintDetails();


            /*** O ***/
            if (_abo == "O" && _sign == '-')
            {
                return(true);
            }

            if (_abo == "O" && _sign == '+')
            {
                if (receiverType._sign == '+')
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            /*** B ***/
            if (_abo == "B" && _sign == '-')
            {
                if (receiverType._abo == "B" || receiverType._abo == "AB")
                {
                    return(true);
                }
            }

            if (_abo == "B" && _sign == '+')
            {
                if (receiverType._abo == "B" || receiverType._abo == "AB")
                {
                    if (receiverType._sign == '+')
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            /*** A ***/
            if (_abo == "A" && _sign == '-')
            {
                if (receiverType._abo == "A" || receiverType._abo == "AB")
                {
                    return(true);
                }
            }

            if (_abo == "A" && _sign == '+')
            {
                if (receiverType._abo == "A" || receiverType._abo == "AB")
                {
                    if (receiverType._sign == '+')
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            /*** AB ***/
            if (_abo == "AB" && _sign == '-')
            {
                if (receiverType._abo == "AB")
                {
                    return(true);
                }
            }

            if (_abo == "AB" && _sign == '+')
            {
                if (receiverType._abo == "AB" && receiverType._sign == '+')
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }