Пример #1
0
        public EmailViewModel(Email email)
        {
            if (email == null)
            {
                throw  new ArgumentException("email");
            }
            if (email.ContactType == null)
            {
                email.ContactType = DefaultManager.Instance.DefaultContactType;
            }
            this.Model = email;

            ContactTypeLookup = new ObservableCollection<ContactTypeViewModel>();
            foreach (var contactType in DataManager.Instance.GetAllContactTypes())
            {
                ContactTypeLookup.Add(new ContactTypeViewModel(contactType));
            }
            ContactTypeLookup.CollectionChanged += (sender, e) =>
            {
                if (e.OldItems != null && e.OldItems.Contains(this.ContactType))
                {
                    this.ContactType = new ContactTypeViewModel(DefaultManager.Instance.DefaultContactType);
                }
            };
        }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Emails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmails(Email email)
 {
     base.AddObject("Emails", email);
 }
Пример #3
0
 /// <summary>
 /// Create a new Email object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="contactTypeId">Initial value of the ContactTypeId property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 public static Email CreateEmail(global::System.Guid id, global::System.Guid contactTypeId, global::System.Guid personId, global::System.String name, global::System.Int32 sourceId)
 {
     Email email = new Email();
     email.Id = id;
     email.ContactTypeId = contactTypeId;
     email.PersonId = personId;
     email.Name = name;
     email.SourceId = sourceId;
     return email;
 }