public EntityContactInformation CurrentContactInformation(Enumerations.EntityContactType forContactType) { EntityContactInformation contactInformation = null; foreach (EntityContactInformation currentContactInformation in ContactInformations) { if (currentContactInformation.ContactType == forContactType) { if ((DateTime.Today >= currentContactInformation.EffectiveDate) && (DateTime.Today <= currentContactInformation.TerminationDate)) { contactInformation = currentContactInformation; break; } } } return(contactInformation); }
override public String EvaluateDataBinding(String bindingContext) { String dataValue = String.Empty; String bindingContextPart = bindingContext.Split('.')[0]; EntityAddress address = null; switch (bindingContextPart) { case "Id": dataValue = Id.ToString(); break; case "EntityType": dataValue = ((Int32)entityType).ToString(); break; case "EntityTypeDescription": dataValue = entityType.ToString(); break; case "Name": dataValue = name; break; case "NameLast": dataValue = nameLast; break; case "NameFirst": dataValue = nameFirst; break; case "NameMiddle": dataValue = nameMiddle; break; case "NamePrefix": dataValue = namePrefix; break; case "NameSuffix": dataValue = nameSuffix; break; case "FederalTaxId": dataValue = federalTaxId; break; case "IdCodeQualifier": dataValue = idCodeQualifier; break; case "UniqueId": dataValue = uniqueId; break; case "CurrentResidentialAddress": case "CurrentPhysicalAddress": case "CurrentMailingAddress": #region Current Address switch (bindingContextPart) { case "CurrentResidentialAddress": address = CurrentPhysicalAddress; break; // BACKWARDS COMPATIBILITY case "CurrentPhysicalAddress": address = CurrentPhysicalAddress; break; case "CurrentMailingAddress": address = CurrentMailingAddress; break; default: address = null; break; } if (address != null) { dataValue = address.EvaluateDataBinding(bindingContext.Replace(bindingContextPart + ".", "")); } else { dataValue = String.Empty; } #endregion break; case "CurrentContactTelephone": case "CurrentContactFacsimile": case "CurrentContactEmail": case "CurrentContactEmergencyPhone": case "CurrentContactCellPhone": // BACKWARDS COMPATIBILITY case "CurrentContactMobilePhone": case "CurrentContactPager": #region Current Contact EntityContactInformation contact = null; switch (bindingContextPart) { case "CurrentContactTelephone": contact = CurrentContactInformation(Enumerations.EntityContactType.Telephone); break; case "CurrentContactFacsimile": contact = CurrentContactInformation(Enumerations.EntityContactType.Facsimile); break; //case "CurrentContactEmail": contact = CurrentContactEmail; break; //case "CurrentContactEmergencyPhone": contact = CurrentContactEmergencyPhone; break; //case "CurrentContactCellPhone": contact = CurrentContactCellPhone; break; // BACKWARDS COMPATIBILITY //case "CurrentContactMobilePhone": contact = CurrentContactCellPhone; break; //case "CurrentContactPager": contact = CurrentContactPager; break; default: contact = null; break; } if (contact != null) { dataValue = contact.EvaluateDataBinding(bindingContext.Replace(bindingContextPart + ".", "")); } else { dataValue = String.Empty; } #endregion break; case "EntityAddresses": #region All Entity Addresses dataValue = "EntityAddress"; foreach (EntityAddress currentAddress in base.application.EntityAddressesGet(Id)) { dataValue = dataValue + "|" + currentAddress.Id.ToString(); } #endregion break; case "EntityContactInformation": #region All Entity Contacts dataValue = "EntityContactInformation"; foreach (EntityContactInformation currentContactInformation in base.application.EntityContactInformationsGet(Id)) { dataValue = dataValue + "|" + currentContactInformation.Id.ToString(); } #endregion break; default: dataValue = "!Error"; break; } return(dataValue); }