///<summary>Returns a list of the primary keys from the sheets passed in with the matching last name, first name, birthdate, email, ///and phone numbers attached to the sheetToMatch.</summary> public static List <long> FindSheetsForPat(WebForms_Sheet sheetToMatch, List <WebForms_Sheet> listSheets, string webFormPrefCulture) { string lName; string fName; DateTime birthdate; List <string> listPhoneNumbers; string email; ParseWebFormSheet(sheetToMatch, webFormPrefCulture, out lName, out fName, out birthdate, out listPhoneNumbers, out email); List <long> listSheetIdMatch = new List <long>(); foreach (WebForms_Sheet sheet in listSheets) { string lNameSheet = ""; string fNameSheet = ""; DateTime birthdateSheet = new DateTime(); List <string> listPhoneNumbersSheet = new List <string>(); string emailSheet = ""; ParseWebFormSheet(sheet, webFormPrefCulture, out lNameSheet, out fNameSheet, out birthdateSheet, out listPhoneNumbersSheet, out emailSheet); if (lName == lNameSheet && fName == fNameSheet && birthdate == birthdateSheet && email == emailSheet && //All phone numbers must match in both. listPhoneNumbers.Except(listPhoneNumbersSheet).Count() == 0 && listPhoneNumbersSheet.Except(listPhoneNumbers).Count() == 0) { listSheetIdMatch.Add(sheet.SheetID); } } return(listSheetIdMatch); }
///<summary>Takes in a webform_sheet and the culture preference. Trys to extract these fields off of the Sheet fields.</summary> public static void ParseWebFormSheet(WebForms_Sheet sheet, string webFormPrefCulture, out string lName, out string fName, out DateTime birthdate, out List <string> listPhoneNumbers, out string email) { lName = ""; fName = ""; birthdate = new DateTime(); listPhoneNumbers = new List <string>(); email = ""; foreach (WebForms_SheetField field in sheet.SheetFields) //Loop through each field. { switch (field.FieldName.ToLower()) { case "lname": case "lastname": lName = field.FieldValue; break; case "fname": case "firstname": fName = field.FieldValue; break; case "bdate": case "birthdate": birthdate = ParseDateWebForms(field.FieldValue, webFormPrefCulture); break; case "hmphone": case "wkphone": case "wirelessphone": if (field.FieldValue != "") { listPhoneNumbers.Add(field.FieldValue); } break; case "email": email = field.FieldValue; break; } } }