예제 #1
0
        public static int AddUser(Domain.User dto)
        {
            using (EvaluationDBDataContext db = new EvaluationDBDataContext())
            {
                DateTime CurrentTime = DateTime.Now;

                User User = new User
                {
                    Name = dto.Name,
                    EmailAddress = dto.EmailAddress,
                    Password = dto.Password,
                    Title = dto.Title,
                    Organization = dto.Organization,
                    RoleID = dto.RoleID,
                    TimeZoneID = dto.TimeZoneID,
                    DateCreated = CurrentTime,
                    DateModified = CurrentTime
                };

                db.Users.InsertOnSubmit(User);
                db.SubmitChanges();
                dto.ID = User.UserID;

                UpdateUserLastLogin(dto.ID, CurrentTime);
                UserLoginHistory.AddUserLoginHistory(new Domain.UserLoginHistory(dto.ID, CurrentTime));
                return dto.ID;
            }
        }
		private void detach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Role = null;
		}
		private void attach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Role = this;
		}
 partial void DeleteUser(User instance);
 partial void UpdateUser(User instance);
 partial void InsertUser(User instance);