Пример #1
0
        /// <exception cref="DuplicateInstanceException"/>
        public long RegisterUser(string loginName, string clearPassword,
                                 UserProfileDetails userProfileDetails)
        {
            try
            {
                UserProfileDao.FindByLoginName(loginName);

                throw new DuplicateInstanceException(loginName,
                                                     typeof(UserProfile).FullName);
            }
            catch (InstanceNotFoundException)
            {
                String encryptedPassword = PasswordEncrypter.Crypt(clearPassword);

                UserProfile userProfile =
                    UserProfile.CreateUserProfile(0, loginName, encryptedPassword,
                                                  userProfileDetails.FirstName, userProfileDetails.Lastname,
                                                  userProfileDetails.Email, userProfileDetails.Language,
                                                  userProfileDetails.Country);

                UserProfileDao.Create(userProfile);

                return(userProfile.usrId);
            }
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            UserProfileDetails target = (UserProfileDetails)obj;

            return((this.FirstName == target.FirstName) &&
                   (this.Lastname == target.Lastname) &&
                   (this.Email == target.Email) &&
                   (this.Language == target.Language) &&
                   (this.Country == target.Country));
        }
Пример #3
0
        /// <exception cref="InstanceNotFoundException"/>
        public UserProfileDetails FindUserProfileDetails(long userProfileId)
        {
            UserProfile userProfile = UserProfileDao.Find(userProfileId);

            UserProfileDetails userProfileDetails =
                new UserProfileDetails(userProfile.firstName,
                                       userProfile.lastName, userProfile.email,
                                       userProfile.language, userProfile.country);

            return(userProfileDetails);
        }
Пример #4
0
        /// <exception cref="InstanceNotFoundException"/>
        public void UpdateUserProfileDetails(long userProfileId,
                                             UserProfileDetails userProfileDetails)
        {
            UserProfile userProfile =
                UserProfileDao.Find(userProfileId);

            userProfile.firstName = userProfileDetails.FirstName;
            userProfile.lastName  = userProfileDetails.Lastname;
            userProfile.email     = userProfileDetails.Email;
            userProfile.language  = userProfileDetails.Language;
            userProfile.country   = userProfileDetails.Country;
            UserProfileDao.Update(userProfile);
        }