コード例 #1
0
 /// <summary>
 /// Determines which kind of contact is selected.
 /// </summary>
 /// <param name="previousContactData">Contact data collection</param>
 private void SetSelectedCustomerType(IContactDataCollection previousContactData)
 {
     ViewBag.SelectedOrderAccounType = CustomerOrderAccounType.New;
     if (previousContactData != null && previousContactData.GetType() == typeof(ExistingCustomerContactModel))
     {
         ViewBag.SelectedOrderAccounType = CustomerOrderAccounType.Existing;
     }
 }
コード例 #2
0
        public void SaveContactData(IContactDataCollection contactData)
        {
            var contactDataType = contactData.GetType();

            if (contactDataType == typeof(ExistingCustomerContactModel))
            {
                newCustomerProvider.ClearContactData();
                existingCustomerProvider.SaveContactData(contactData);
            }
            else if (contactDataType.IsSubclassOf(typeof(AccountViewModel)))
            {
                existingCustomerProvider.ClearContactData();
                newCustomerProvider.SaveContactData(contactData);
            }
            else
            {
                throw new InvalidOperationException("Cannot save contact data of type " + contactDataType + ".");
            }
        }