/// <summary> /// Объявляет список трансплантантов. /// </summary> private void SetTransplantantList() { if (donor.Number == 0 || donor == null) return; list.Clear(); TransplantantPanel.Children.Clear(); foreach (string Type in TypeTransplantant) { Transplantant transplantant = new Transplantant(); transplantant.Type = Type; transplantant.IdDonor = donor.Id; transplantant.StorageTime = DateTime.Now; Expander expander = new Expander(); expander.Content = transplantant; expander.Header = transplantant; expander.HeaderTemplate = LayoutRoot.Resources.ElementAt(0).Value as DataTemplate; expander.ContentTemplate = LayoutRoot.Resources.ElementAt(1).Value as DataTemplate; expander.ExpandDirection = ExpandDirection.Down; expander.HorizontalAlignment = HorizontalAlignment.Left; expander.VerticalAlignment = VerticalAlignment.Top; expander.Width = 212; expander.IsExpanded = false; expander.DataContext = transplantant; TransplantantPanel.Children.Add(expander); list.Add(transplantant); } }
/// <summary> /// Устаревший метод для добавления новых объектов в набор EntitySet Transplantant. Взамен можно использовать метод .Add связанного свойства ObjectSet<T>. /// </summary> public void AddToTransplantant(Transplantant transplantant) { base.AddObject("Transplantant", transplantant); }
/// <summary> /// Создание нового объекта Transplantant. /// </summary> /// <param name="id">Исходное значение свойства Id.</param> /// <param name="type">Исходное значение свойства Type.</param> /// <param name="idDonor">Исходное значение свойства IdDonor.</param> /// <param name="factor1">Исходное значение свойства Factor1.</param> /// <param name="factor2">Исходное значение свойства Factor2.</param> /// <param name="factor3">Исходное значение свойства Factor3.</param> /// <param name="factor4">Исходное значение свойства Factor4.</param> /// <param name="factor5">Исходное значение свойства Factor5.</param> /// <param name="factor6">Исходное значение свойства Factor6.</param> /// <param name="storageTime">Исходное значение свойства StorageTime.</param> public static Transplantant CreateTransplantant(global::System.Int32 id, global::System.String type, global::System.Int32 idDonor, global::System.String factor1, global::System.String factor2, global::System.String factor3, global::System.String factor4, global::System.String factor5, global::System.String factor6, global::System.DateTime storageTime) { Transplantant transplantant = new Transplantant(); transplantant.Id = id; transplantant.Type = type; transplantant.IdDonor = idDonor; transplantant.Factor1 = factor1; transplantant.Factor2 = factor2; transplantant.Factor3 = factor3; transplantant.Factor4 = factor4; transplantant.Factor5 = factor5; transplantant.Factor6 = factor6; transplantant.StorageTime = storageTime; return transplantant; }
private bool FilterTransplantant(Transplantant entity) { return (entity.IdDonor == this.Id); }
private void DetachTransplantant(Transplantant entity) { entity.Donor = null; }
private void AttachTransplantant(Transplantant entity) { entity.Donor = this; }