/// <summary> /// remove the initial row used to enter the 'candidate' SSN etc which lead to choosing someone from the existing customer list and is now getting added (and therefore takes the place of this temporary row) /// </summary> /// <returns></returns> private bool DropInMemAddMember() { var simpleDrop = HouseMembers.Cast <DataRowView>().FirstOrDefault(r => r.Row.RowState == DataRowState.Added); if (simpleDrop == null) { return(false); } simpleDrop.DetachRow(); return(true); }
protected override bool SaveSubClass() { //validate everything first so we see all the red boxes at once... var isValid = true; ValidateGeneric(ref isValid, "Rank"); ValidateGeneric(ref isValid, "DEROS"); ValidateGeneric(ref isValid, "DutyLocation"); ValidateGeneric(ref isValid, "DutyPhoneDSN1", "'?'.Length == 3", "Enter 3 Digits"); ValidateGeneric(ref isValid, "DutyPhoneDSN2", "'?'.Length == 4", "Enter 4 Digits"); ValidateGeneric(ref isValid, "OfficialMailCMR"); ValidateGeneric(ref isValid, "OfficialMailBox"); ValidateGeneric(ref isValid, "OfficialMailCity"); ValidateGeneric(ref isValid, "OfficialMailState"); ValidateGeneric(ref isValid, "OfficialMailZip", "'?'.Length == 5", "Enter 5 Digits"); ValidateGeneric(ref isValid, "HomePhoneCountry"); ValidateGeneric(ref isValid, "HomePhone"); var validateUTAP = Fields.Field <bool>("IsUTAPActive"); ValidateGeneric(Fields, ref isValid, "HomeStreet,IsUTAPActive", validateUTAP); ValidateGeneric(Fields, ref isValid, "HomeStreetNumber,IsUTAPActive", validateUTAP); ValidateGeneric(Fields, ref isValid, "HomeCity,IsUTAPActive", validateUTAP); ValidateGeneric(Fields, ref isValid, "HomePostal,IsUTAPActive", validateUTAP); foreach (DataRowView member in HouseMembers) { ValidateGeneric(member, ref isValid, "SSN1", true, "'?'.Length == 3", "Enter 3 Digits"); ValidateGeneric(member, ref isValid, "SSN2", true, "'?'.Length == 2", "Enter 2 Digits"); ValidateGeneric(member, ref isValid, "SSN3", true, "'?'.Length == 4", "Enter 4 Digits"); if (ValidateGeneric(member, ref isValid, "FName")) { ValidateGeneric(member, ref isValid, "FName", true, "'?' != '?'.toUpperCase()", "Use proper uppper/lower casing for all names.\nForms will automatically print in all upper case."); } if (ValidateGeneric(member, ref isValid, "LName")) { ValidateGeneric(member, ref isValid, "LName", true, "'?' != '?'.toUpperCase()", "Use proper uppper/lower casing for all names.\nForms will automatically print in all upper case."); } } if (!isValid) { ShowUserMessage("Please correct all highlighted fields before saving."); return(false); } //then save attempt to save everything if we made it through all the validation... if (Fields.IsDirty()) { if (!SaveJustSponsorRecord()) { return(false); } } foreach (var member in HouseMembers.Cast <DataRowView>().Where(member => member.IsDirty())) { // ReSharper disable InconsistentNaming using (Proc Client_u = new iTRAACProc("Client_u")) // ReSharper restore InconsistentNaming { Client_u.AssignValues(member); if (!Client_u.ExecuteDataSet(UserMessagePrefix)) { return(false); } member.AcceptChanges(); CacheTables(Client_u); } } RemarkModel.SaveRemarks("SponsorGUID", GUID, UserMessagePrefix, SponsorRemarks); return(true); }