public override void Run()
		{
			var firstName = ConsoleX.WriteQuery("Please enter First Name:");
			var lastName = ConsoleX.WriteQuery("Please enter Last Name:");
			var isMale = ConsoleX.WriteBooleanQuery("Gender: Are they male?");
			
			var vol = new Volunteer();
			vol.FirstName = firstName;
			vol.LastName = lastName;
			vol.Gender = isMale ? GenderKind.Male : GenderKind.Female;
			
			TrySearchForNames(vol, ConsoleX);
		}
		public static bool TrySearchForNames(Volunteer volunteer, ConsoleX consoleX)
		{
			// TODO Use Gender also to help with match.
			bool matchesFound = true;
			
			consoleX.WriteLine("Searching for matches on both First and Last name...");
			
			var table = Volunteers.GetByBothNames(volunteer.FirstName, volunteer.LastName, volunteer.Gender);
			
			if(table.Rows.Count == 0)
			{
				consoleX.WriteLine("No matched found on both First and Last name! Trying a wider search:");
				if(volunteer.Gender == GenderKind.Male)
				{
					consoleX.WriteLine("Searching for other brothers with same Last name...");
					table = Volunteers.GetByLastName(volunteer.LastName, volunteer.Gender);
				}
				else
				{
					consoleX.WriteLine("Searching for other sisters with same First OR Last name...");
					table = Volunteers.GetByEitherName(volunteer.FirstName, volunteer.LastName, volunteer.Gender);
				}
			}
			
			if(table.Rows.Count > 0)
			{
				consoleX.WriteLine(table.Rows.Count > 1 ? "The following matches where found:" : "The following match was found");
				consoleX.WriteDataTable(table, 15);
			}
			else
			{
				matchesFound = false;
				consoleX.WriteLine("No matches found!");
			}
			return matchesFound;
		}
Example #3
0
		private void ProcessVolunteer()
		{
			this.CurrentVolunteer = new Volunteer();
			this.CurrentVolunteer.CongregationID = this.currentCongregationID;
			
			ConsoleX.WriteLine("I'll open the file for you to check the data as we go.");
			
			this.OpenFileInNewProcess();
			
			#region Step #1 Get name and gender
			
			ConsoleX.WriteLine("Step #1 Get name and gender", ConsoleColor.Green);
			
			this.Step1_NameAndGender();
			
			#endregion
			
			#region Step #2 Search for existing records (use existing or create new)
			
			if(!this.skipFile)
			{
				
				ConsoleX.WriteLine("Step #2 Search for existing records", ConsoleColor.Green);
				
				this.Step2_SelectRecord();
				
			}
			
			#endregion
			
			if(!this.skipFile)
			{
				
				#region Step #3 Read the rest of the form
				
				ConsoleX.WriteLine("Step #3 Read the rest of the file", ConsoleColor.Green);
				
				this.Step3_ReadFileData();
				
				#endregion
				
				#region Step #4 Display details and confirm
				
				ConsoleX.WriteLine("Step #4 Display collected details and confirm save", ConsoleColor.Green);
				
				this.Step4_DisplayDetails();
				
				this.Step4_Save();
				
				#endregion
				
			}
			
			this.CloseFileIfProcessOpen();
			
			this.CurrentVolunteer = null;
		}