string firstName, lastName, dateOfBirth, fathersName, mothersName, fathersBloodGroup, mothersBloodGroup, donorsBloodGroup,
public static DonorsData contributer;
get { return this.firstName; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid first name");
get { return this.lastName; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid last name");
public string DateOfBirth
get { return this.dateOfBirth; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid date of birth");
this.dateOfBirth = value;
get { return DateTime.Parse(DateOfBirth); }
get { return DateTime.Now.Year - YearOfBirth.Year; }
public string FathersName
get { return this.fathersName; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid father's name");
this.fathersName = value;
public string MothersName
get { return this.mothersName; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid mother's name");
this.mothersName = value;
get { return this.address; }
if (string.IsNullOrEmpty(value))
throw new Exception("Please enter a valid address");
get { return this.phoneNo; }
if (string.IsNullOrEmpty(value)||value.Length!=10)
throw new Exception("Please enter a valid phone number");
public string FatherSBloodGroup
get { return this.fathersBloodGroup; }
if (string.IsNullOrEmpty(value) || (value != "A+" && value != "A-" && value != "B+" && value != "B-" && value != "AB+"
&& value != "AB-" && value != "O+" && value != "O-"))
throw new Exception("Please enter a valid blood group");
this.fathersBloodGroup = value;
public string MothersBloodGroup
get { return this.mothersBloodGroup; }
if (string.IsNullOrEmpty(value) || (value != "A+" && value != "A-" && value != "B+" && value != "B-" && value != "AB+"
&& value != "AB-" && value != "O+" && value != "O-"))
throw new Exception("Please enter a valid blood group");
this.mothersBloodGroup = value;
public string DonorsBloodGroup
get { return this.donorsBloodGroup; }
if (string.IsNullOrEmpty(value) || (value != "A+" && value != "A-" && value != "B+" && value != "B-" && value != "AB+"
&& value != "AB-" && value != "O+" && value != "O-"))
throw new Exception("Please enter a valid blood group");
this.donorsBloodGroup = value;
Console.WriteLine(CheckingRhfactor());
string CheckingRhfactor()
if ((DonorsData.contributer.FatherSBloodGroup == "A+") && (DonorsData.contributer.MothersBloodGroup == "B+")
&& (DonorsData.contributer.DonorsBloodGroup == "AB+"))
message = "Your Rh factor is B+";
else if ((DonorsData.contributer.FatherSBloodGroup == "A+") && (DonorsData.contributer.MothersBloodGroup == "A+")
&& (DonorsData.contributer.DonorsBloodGroup == "A+"))
message = "Your Rh factor is A+";
else if ((DonorsData.contributer.FatherSBloodGroup == "B+") && (DonorsData.contributer.MothersBloodGroup == "AB+")
&& (DonorsData.contributer.DonorsBloodGroup == "AB+"))
message = "Your Rh factor is B+";
else if ((DonorsData.contributer.FatherSBloodGroup == "A-") && (DonorsData.contributer.MothersBloodGroup == "A+")
&& (DonorsData.contributer.DonorsBloodGroup == "A-"))
message = "Your Rh factor is A-";
else if ((DonorsData.contributer.FatherSBloodGroup == "O+") && (DonorsData.contributer.MothersBloodGroup == "A+")
&& (DonorsData.contributer.DonorsBloodGroup == "O+"))
message = "Your Rh factor is A+";
else if ((DonorsData.contributer.FatherSBloodGroup == "AB+") && (DonorsData.contributer.MothersBloodGroup == "AB-")
&& (DonorsData.contributer.DonorsBloodGroup == "AB+"))
message = "Your Rh factor is B+";
static Dictionary<int,> data;}
data = new Dictionary<int,>();
DonorsData.contributer = new DonorsData();
public void AcceptingData()
Console.Write("Enter your first name:");
DonorsData.contributer.FirstName = Console.ReadLine().ToUpper();
Console.Write("Enter your last name:");
DonorsData.contributer.LastName = Console.ReadLine().ToUpper();
Console.Write("Enter your date of birth:");
DonorsData.contributer.DateOfBirth = Console.ReadLine().ToUpper();
Console.Write("Enter your father's name:");
DonorsData.contributer.FathersName = Console.ReadLine().ToUpper();
Console.Write("Enter your mother's name:");
DonorsData.contributer.MothersName = Console.ReadLine().ToUpper();
Console.Write("Enter your address:");
DonorsData.contributer.Address = Console.ReadLine().ToUpper();
Console.Write("Enter your phone no.:");
DonorsData.contributer.Phone = Console.ReadLine().ToUpper();
Console.Write("Enter your father's blood group:");
DonorsData.contributer.FatherSBloodGroup = Console.ReadLine().ToUpper();
Console.Write("Enter your mother's blood group:");
DonorsData.contributer.MothersBloodGroup = Console.ReadLine().ToUpper();
Console.Write("Enter your donor's blood group:");
DonorsData.contributer.DonorsBloodGroup = Console.ReadLine().ToUpper();
RhFactor rhfactor = new RhFactor();
static void Main(string[] args)
BloodBank bank = new BloodBank();