public virtual void MarkSeenBy(User user) { if (!MessageStatusForUsers.Any(x => x.User == user)) { var status = new MessageStatus { Message = this, User = user, SeenAtDate = DateTime.UtcNow, }; MessageStatusForUsers.Add(status); } }
public static string GetStatus(User user) { if (user.Person == null) return "Personnel record not started"; else if (user.Person.SocialSecurityLastFour == null) return "Missing SSN"; else if (user.Person.DateOfBirth == null) return "Missing DoB"; else if (user.Person.PrimaryPhoneNumber == null || user.Person.EmergencyContactName == null || user.Person.EmergencyContactPhoneNumber == null || user.Person.Address == null) return "Missing Contact Info"; else return string.Empty; }
public User CreateUser(string username, string firstname, string lastname, string displayname, string title, int rateGroup, string passwordHash, string email = null) { var next_identity = this.UnitOfWork.Session.CreateSQLQuery("SELECT max([identity]) FROM Users").List<int>().Single(); var user = new User { Username = username, FirstName = firstname, LastName = lastname, DisplayName = displayname, Title = title, RateGroup = rateGroup, Disabled = false, Identity = next_identity + 1, PasswordHash = passwordHash, }; if (string.IsNullOrEmpty(email) || ! email.IsValidEmail()) { user.SetDefaultEmailAddress(username); } else { user.Email = email; } user.Validate(); return Persist<User>(user); }
public Person CreatePersonFor(User user) { if (user.Person != null) throw new InvalidOperationException("User already has a Person object attached"); var person = new Person { User = user, }; user.Person = person; user.Validate(); return person; }