Example #1
0
 public AbstractWorkViewModel(AbstractWork abstractWork)
 {
     if (abstractWork == null)
     {
         throw new ArgumentNullException("abstractWork");
     }
     if (abstractWork.Reviewer == null)
     {
         abstractWork.Reviewer = DefaultManager.Instance.DefaultResponsiblePerson;
     }
     if (abstractWork.AbstractStatus == null)
     {
         abstractWork.AbstractStatus = DefaultManager.Instance.DefaultAbstractStatus;
     }
     AbstractStatusLookup = new ObservableCollection<AbstractStatusViewModel>();
     foreach (var abstractStatus in DataManager.Instance.GetAllAbstractStatuses())
     {
         AbstractStatusLookup.Add(new AbstractStatusViewModel(abstractStatus));
     }
     AbstractStatusLookup.CollectionChanged += (sender, e) =>
     {
         if (e.OldItems != null && e.OldItems.Contains(this.AbstractStatus))
         {
             this.abstractStatus = new AbstractStatusViewModel(DefaultManager.Instance.DefaultAbstractStatus);
         }
     };
     ReviewersLookup = new ObservableCollection<UserViewModel>();
     foreach (var user in DataManager.Instance.GetAllUsers())
     {
         ReviewersLookup.Add(new UserViewModel(user));
     }
     ReviewersLookup.CollectionChanged += (sender, e) =>
     {
         if (e.OldItems != null && e.OldItems.Contains(this.Reviewer))
         {
             this.reviewer = new UserViewModel(DefaultManager.Instance.DefaultResponsiblePerson);
         }
     };
     this.Model = abstractWork;
 }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the AbstractWorks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAbstractWorks(AbstractWork abstractWork)
 {
     base.AddObject("AbstractWorks", abstractWork);
 }
Example #3
0
 /// <summary>
 /// Create a new AbstractWork object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="abstractId">Initial value of the AbstractId property.</param>
 /// <param name="abstractStatusId">Initial value of the AbstractStatusId property.</param>
 /// <param name="abstractResponsiblePersonId">Initial value of the AbstractResponsiblePersonId property.</param>
 /// <param name="isSentByEmail">Initial value of the IsSentByEmail property.</param>
 /// <param name="dateWork">Initial value of the DateWork property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 /// <param name="reviewerId">Initial value of the ReviewerId property.</param>
 public static AbstractWork CreateAbstractWork(global::System.Guid id, global::System.Guid abstractId, global::System.Guid abstractStatusId, global::System.Guid abstractResponsiblePersonId, global::System.Boolean isSentByEmail, global::System.DateTime dateWork, global::System.Int32 sourceId, global::System.Guid reviewerId)
 {
     AbstractWork abstractWork = new AbstractWork();
     abstractWork.Id = id;
     abstractWork.AbstractId = abstractId;
     abstractWork.AbstractStatusId = abstractStatusId;
     abstractWork.AbstractResponsiblePersonId = abstractResponsiblePersonId;
     abstractWork.IsSentByEmail = isSentByEmail;
     abstractWork.DateWork = dateWork;
     abstractWork.SourceId = sourceId;
     abstractWork.ReviewerId = reviewerId;
     return abstractWork;
 }