public ContactsFormatterCompany(IContactsNAW contactsNAW)
     : base(contactsNAW)
 {
     IContactPerson secondContact = RetrieveSecondContact(contactsNAW.Contact);
     if (secondContact != null)
         SecondContactsNAW = secondContact.CurrentNAW;
 }
Exemple #2
0
        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;
        }
Exemple #3
0
        // 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));
            }
        }
Exemple #4
0
 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));
     }
 }
Exemple #5
0
 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";
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 protected static string GetDearSirForm(IContactsNAW contactsNAW)
 {
     return "Geachte " + GetShortPoliteForm(contactsNAW);
 }
Exemple #8
0
 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)
 {
 }
Exemple #10
0
 /// <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);
     }
 }
Exemple #11
0
 /// <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)
 {
 }
Exemple #13
0
 public void SetContactsNAW(ICustomerAccount account)
 {
     ContactsFormatter formatter = ContactsFormatter.CreateContactsFormatter(account);
     ContactsNAW = formatter.ContactsNAW;
     SecondContactsNAW = formatter.SecondContactsNAW;
 }
 public ContactsFormatterPerson(IContactsNAW contactsNAW)
     : base(contactsNAW)
 {
 }
Exemple #15
0
 // Constructor
 protected ContactsFormatter(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
 {
     this.account = account;
     this.contactsNAW = contactsNAW;
     this.secondContactsNAW = secondContactsNAW;
 }
Exemple #16
0
 protected static string GetAttentionOfForm(IContactsNAW contactsNAW)
 {
     return GetAttentionOfForm(contactsNAW, null);
 }
Exemple #17
0
 // Constructor
 protected ContactsFormatter(IContactsNAW contactsNAW)
 {
     this.contactsNAW = contactsNAW;
 }
 public ContactsFormatterDelegate(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
     : base(account, contactsNAW, secondContactsNAW)
 {
 }