Example #1
0
        public UserModel GetUser(int userId)
        {
            UserModel model = new UserModel();

            User user = session.Load<User>(userId);
            return model.FilledBy(user);
        }
Example #2
0
 public static void FilledBy(this IList<UserModel> model, IList<User> users)
 {
     foreach (User user in users)
     {
         UserModel item = new UserModel();
         item.FilledBy(user);
         model.Add(item);
     }
 }
Example #3
0
        public UserModel GetUser(int userId)
        {
            UserModel model = new UserModel();

            model.Id = userId;
            model.Name = ((FakeUsers)userId).ToString();
            model.HasLogon = true;

            return model;
        }
        public static void FilledBy(this AuthorizationModel model, Authorization authorization)
        {
            model.Id = authorization.Id;
            model.CanAdmin = authorization.IsAdmin;
            model.CanOwn = authorization.IsOwner;
            model.CanPublish = authorization.IsPublisher;

            UserModel user = new UserModel();
            user.FilledBy(authorization.User);
            model.User = user;
        }
        public static TaskHistoryItemModel FilledBy(this TaskHistoryItemModel model, HistoryItem item)
        {
            model.CreateTime = item.CreateTime;

            UserModel executor = new UserModel();
            executor.FilledBy(item.Executor);
            model.Executor = executor;
            model.Comment = item.Comment;
            model.Description = item.Description;

            return model;
        }
Example #6
0
 public EditModel GetEdit(int taskId, UserModel currentUser)
 {
     throw new NotImplementedException();
 }
Example #7
0
 private void setAccepter(Task task, UserModel accepter)
 {
     if (accepter.Id.HasValue)
     {
         task.Accepter = session.Load<User>(accepter.Id.Value);
     }
     else
     {
         task.Accepter = task.Publisher;
     }
 }
Example #8
0
        public EditModel GetEdit(int taskId, UserModel currentUser)
        {
            Task task = session.Load<Task>(taskId);

            EditModel model = new EditModel();
            model.FilledBy(task);

            model.CurrentUser = currentUser;
            model.QualifiedStatus = getQualifiedStatus(task.CurrentStatus, task);

            #region Depend on services and project id

            int projectId = task.Project.Id;
            int currentUserId = currentUser.Id.Value;

            model.CanOwn = _authService.GetTokens(currentUserId, projectId).Contains(Token.Owner);
            model.Owners = _userService.GetOwners(projectId);
            model.Accepters = _userService.GetAccepters(projectId);
            model.AllDifficulties = _projectConfigService.GetDifficulties(projectId);
            model.AllPriorities = _projectConfigService.GetPriorities(projectId);
            model.AllQualities = _projectConfigService.GetQualities(projectId);
            model.CurrentProject = _projectService.GetDropdownlistLink(currentUser.Id.Value, projectId);

            model.CanAutoCompleteParent = CanAutoComplete(taskId);
            model.CanAutoAccepterParent = CanAutoAccept(taskId);

            #endregion

            model.Attachments = new List<AttachmentModel>();
            foreach (Attachment attachment in task.Attachments)
            {
                AttachmentModel item = new AttachmentModel();
                item.FilledBy(attachment);
                model.Attachments.Add(item);
            }

            return model;
        }