public EventViewModel(EventDisplayModel displayModel)
 {
     Id          = displayModel.Id;
     Description = displayModel.Description;
     Date        = displayModel.Date;
     State       = new EnumViewModel <EventState>(displayModel.State);
 }
 public AutofillViewModel(Autofill autofill)
 {
     Id            = autofill.Id;
     Name          = autofill.Name;
     Description   = autofill.Description;
     WorkItemType  = autofill.WorkItemType;
     TypeViewModel = new EnumViewModel <WorkItemType>(WorkItemType);
 }
 public WorkItemNotificationViewModel(WorkItem workItem, ApplicationUser user)
 {
     Id     = workItem.Id;
     Name   = workItem.Name;
     User   = user.ToString();
     UserId = user.Id;
     Type   = new EnumViewModel <WorkItemType>(workItem.Type);
 }
Example #4
0
 public WorkItemTileViewModel(WorkItem workItem)
 {
     Id             = workItem.Id;
     Name           = workItem.Name;
     Type           = workItem.Type;
     State          = new EnumViewModel <WorkItemState>(workItem.State);
     FinishDate     = workItem.FinishDate?.ToString(Constants.DateTimeFormat);
     DeadLine       = workItem.DeadLine.ToString(Constants.DateTimeFormat);
     Description    = workItem.Description;
     Executor       = workItem.Executor != null ? new UserInfoViewModel(workItem.Executor) : null;
     IsDeadLineSoon = workItem.IsAtWork() && FinishDate == null && workItem.DeadLine > DateTime.Now && (workItem.DeadLine - DateTime.Now).TotalHours < 48;
     IsOverdue      = workItem.IsAtWork() && FinishDate == null && workItem.DeadLine < DateTime.Now;
 }
Example #5
0
 /// <summary>
 /// Конструктор по рабочему элементу. Должны быть загружены родители!
 /// </summary>
 /// <param name="workItem"></param>
 public WorkItemViewModel(WorkItem workItem)
 {
     Type           = workItem.Type;
     TypeViewModel  = new EnumViewModel <WorkItemType>(workItem.Type);
     DeadLine       = workItem.DeadLine;
     State          = workItem.State;
     StateViewModel = new EnumViewModel <WorkItemState>(workItem.State);
     ExecutorId     = workItem.ExecutorId;
     Description    = workItem.Description;
     Id             = workItem.Id;
     Name           = workItem.Name;
     if (workItem.Executor != null)
     {
         Executor = new UserViewModel(workItem.Executor);
     }
     FillParentIds(workItem);
 }