public ContactsFormatterCompany(IContactsNAW contactsNAW) : base(contactsNAW) { IContactPerson secondContact = RetrieveSecondContact(contactsNAW.Contact); if (secondContact != null) SecondContactsNAW = secondContact.CurrentNAW; }
protected Nota(ICustomerAccount account) { this.creationDate = DateTime.Now; this.printCount = 0; this.formatter = ContactsFormatter.CreateContactsFormatter(account); this.contactsNAW = this.formatter.ContactsNAW; this.secondContactsNAW = this.formatter.SecondContactsNAW; }
// Constructor protected ContactsFormatter(ICustomerAccount account) { this.account = account; try { IContact firstContact = Account.AccountHolders.PrimaryAccountHolder.Contact; IContactPerson secondContact = RetrieveSecondContact(firstContact); this.contactsNAW = firstContact.CurrentNAW; if (secondContact != null) this.secondContactsNAW = secondContact.CurrentNAW; } catch (NullReferenceException) { throw new ApplicationException( string.Format("Could not retrieve account holder information for account {0} - {1}.", account.Key, account.DisplayNumberWithName)); } }
private static ContactTypeEnum getContactType(IContactsNAW contactsNAW) { try { return contactsNAW.Contact.ContactType; } catch (NullReferenceException) { throw new ApplicationException( string.Format("Could not retrieve contact for contact NAW {0} - {1}.", contactsNAW.Key, contactsNAW.Name)); } }
protected static string GetShortPoliteForm(IContactsNAW contactsNAW) { if (contactsNAW != null) { IContactPerson contact = (IContactPerson)contactsNAW.Contact; return GetShortPoliteForm(contact.Gender, contact.MiddleName, contactsNAW.Name); } else return "heer/mevrouw"; }
protected static string GetFullPoliteForm(IContactsNAW contactsNAW) { if (contactsNAW != null) { if (contactsNAW.Contact != null && contactsNAW.Contact.ContactType == ContactTypeEnum.Person) { IContactPerson contact = (IContactPerson)contactsNAW.Contact; return GetFullPoliteForm(contact.Gender, contact.FirstName, contact.MiddleName, contactsNAW.Name); } else return contactsNAW.Name; } else return string.Empty; }
protected static string GetDearSirForm(IContactsNAW contactsNAW) { return "Geachte " + GetShortPoliteForm(contactsNAW); }
protected static string GetAttentionOfForm(IContactsNAW contactsNAW, Func<string, string> addCustomPrefix) { if (contactsNAW != null) { IContactPerson contact = (IContactPerson)contactsNAW.Contact; return GetAttentionOfForm(contact.Gender, contact.FirstName, contact.MiddleName, contactsNAW.Name, addCustomPrefix); } else return ""; }
public ContactsFormatterDelegate(IContactsNAW contactsNAW) : base(contactsNAW) { }
/// <summary> /// Static method used by Contacts (e.g. when sending 'New user name' letters, /// 'New/Changed password' emails, or 'New notas/financial reports created' emails). /// </summary> public static ContactsFormatter CreateContactsFormatter(IContactsNAW contactsNAW) { switch (getContactType(contactsNAW)) { case ContactTypeEnum.Company: return new ContactsFormatterCompany(contactsNAW); case ContactTypeEnum.Delegate: return new ContactsFormatterDelegate(contactsNAW); default: return new ContactsFormatterPerson(contactsNAW); } }
/// <summary> /// Static method used by Notas when printed. It uses the (one or two) ContactsNAWs stored on the Nota at creation time. /// </summary> public static ContactsFormatter CreateContactsFormatter(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW) { switch (getContactType(contactsNAW)) { case ContactTypeEnum.Company: return new ContactsFormatterCompany(account, contactsNAW, secondContactsNAW); case ContactTypeEnum.Delegate: return new ContactsFormatterDelegate(account, contactsNAW, secondContactsNAW); default: return new ContactsFormatterPerson(account, contactsNAW, secondContactsNAW); } }
public ContactsFormatterCompany(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW) : base(account, contactsNAW, secondContactsNAW) { }
public void SetContactsNAW(ICustomerAccount account) { ContactsFormatter formatter = ContactsFormatter.CreateContactsFormatter(account); ContactsNAW = formatter.ContactsNAW; SecondContactsNAW = formatter.SecondContactsNAW; }
public ContactsFormatterPerson(IContactsNAW contactsNAW) : base(contactsNAW) { }
// Constructor protected ContactsFormatter(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW) { this.account = account; this.contactsNAW = contactsNAW; this.secondContactsNAW = secondContactsNAW; }
protected static string GetAttentionOfForm(IContactsNAW contactsNAW) { return GetAttentionOfForm(contactsNAW, null); }
// Constructor protected ContactsFormatter(IContactsNAW contactsNAW) { this.contactsNAW = contactsNAW; }
public ContactsFormatterDelegate(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW) : base(account, contactsNAW, secondContactsNAW) { }