public override User GetModel(User currentUser)
        {
            var user = base.GetModel(currentUser);

            user.HashedPassword = Security.GetSwcSH1(Password);

            return user;
        }
Пример #2
0
 public void DeleteUser(User user)
 {
     _context.DeleteEntity(user);
 }
Пример #3
0
 public void SaveUser(User user)
 {
     _context.SaveEntity(user);
 }
Пример #4
0
        public void SaveTimeEntry(TimeEntry timeEntry, User user)
        {
            // if the user is using the stopwatch approach to time entry...
            if (user.UseStopwatchApproachToTimeEntry)
            {
                // if there's a time entry that doesn't have a time out value
                // then update it to the new time entry's time in value
                var lastTimeEntry = (from te in _context.TimeEntries
                                     where te.UserId == user.UserId && 
                                        te.TimeEntryId != timeEntry.TimeEntryId && 
                                        te.TimeOutUtc == null &&
                                        te.TimeInUtc < timeEntry.TimeInUtc
                                     orderby te.TimeInUtc descending
                                     select te).FirstOrDefault();
                if (lastTimeEntry != null)
                    lastTimeEntry.TimeOutUtc = timeEntry.TimeInUtc;
            }

            _context.SaveEntity(timeEntry);
        }
Пример #5
0
        public List<TimeEntry> GetTimeEntries(DateTime date, User user)
        {
            var dateUtcStart = user.ConvertLocalTimeToUtc(date);
            var dateUtcEnd = dateUtcStart.AddDays(1);

            return _context.TimeEntries
                .Include(te => te.User)
                .Include(te => te.ProjectRole)
                .Include(te => te.ProjectRole.Project)
                .Include(te => te.ProjectTask)
                .Include(te => te.ProjectTask.Project)
                .Where(te => te.UserId == user.UserId &&
                    te.TimeInUtc >= dateUtcStart && te.TimeInUtc < dateUtcEnd)
                .OrderBy(te => te.TimeInUtc)
                .ToList();
        }
 public override ProjectRole GetModel(User currentUser)
 {
     var projectRole = base.GetModel(currentUser);
     projectRole.ProjectId = ProjectId.Value;
     return projectRole;
 }
Пример #7
0
 public UserIdentity(User user) : base(user.UserName)
 {
     User = user;
 }
 public override ProjectTask GetModel(User currentUser)
 {
     var projectTask = base.GetModel(currentUser);
     projectTask.ProjectId = ProjectId.Value;
     return projectTask;
 }
        public override void UpdateModel(User model, User currentUser)
        {
            base.UpdateModel(model, currentUser);

            model.HashedPassword = Security.GetSwcSH1(Password);
        }