Ejemplo n.º 1
0
        public PhoneViewModel(Phone phone)
        {
            if (phone == null)
            {
                throw new ArgumentNullException("phone");
            }
            if (phone.ContactType == null)
            {
                phone.ContactType = DefaultManager.Instance.DefaultContactType;
            }
            this.Model = phone;

            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);
                }
            };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Phone object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="contactTypeId">Initial value of the ContactTypeId property.</param>
 /// <param name="number">Initial value of the Number property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 public static Phone CreatePhone(global::System.Guid id, global::System.Guid contactTypeId, global::System.String number, global::System.Int32 sourceId, global::System.Guid personId)
 {
     Phone phone = new Phone();
     phone.Id = id;
     phone.ContactTypeId = contactTypeId;
     phone.Number = number;
     phone.SourceId = sourceId;
     phone.PersonId = personId;
     return phone;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Phones EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPhones(Phone phone)
 {
     base.AddObject("Phones", phone);
 }