public UserModel GetUser(int userId) { UserModel model = new UserModel(); User user = session.Load<User>(userId); return model.FilledBy(user); }
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); } }
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; }
public EditModel GetEdit(int taskId, UserModel currentUser) { throw new NotImplementedException(); }
private void setAccepter(Task task, UserModel accepter) { if (accepter.Id.HasValue) { task.Accepter = session.Load<User>(accepter.Id.Value); } else { task.Accepter = task.Publisher; } }
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; }