private static void OperChangePass(user user, string newPass)
        {
            bool result = (user != null) && (!string.IsNullOrEmpty(newPass));

            if (!result)
            {
                throw new ServiceUserException("ChangePass");
            }
            try
            {
                using (var servicios = new FrameworkServiceFactory())
                {
                    user      = servicios.ServiceUser.Find(user.Id);
                    user.Pass = MyCryptography.EncryptPass(newPass);
                    user.DateLastPassChange    = DateTime.Now;
                    user.CountAfterPassAttempt = 0;
                    using (var transaction = new TransactionScope())
                    {
                        servicios.ServiceUser.GetOwnDataService.Update(user);
                        transaction.Complete();
                    }
                }
            }
            catch (ApplicationException e)
            {
                throw new ServiceUserException("ChangePass: " + e.Message);
            }
        }
        public static void ChangePass(user user, string oldPass, string newPass)
        {
            var result = (user != null) &&
                         (!string.IsNullOrEmpty(oldPass)) &&
                         (!string.IsNullOrEmpty(newPass)) &&
                         (user.Pass.Equals(MyCryptography.EncryptPass(oldPass), StringComparison.OrdinalIgnoreCase));

            if (!result)
            {
                throw new ServiceUserException("ChangePass");
            }
            OperChangePass(user, newPass);
        }
 protected void Fill(user user, string name, string lastname, string pass, string email, string phone, int idPais, int idUserCreated)
 {
     user.Name     = name;
     user.LastName = lastname;
     user.Pass     = MyCryptography.EncryptPass(pass);
     user.Email    = email.ToLower();
     user.Phone    = phone;
     user.IsActive = true;
     user.IsLocked = false;
     if (idUserCreated > 0)
     {
         user.UserCreated = idUserCreated;
     }
     user.DateCreated = DateTime.Now;
 }
        private void ChangePass(user user, string newPass)
        {
            bool result = (user != null) && (!string.IsNullOrEmpty(newPass));

            if (!result)
            {
                throw new ServiceUserException("ChangePass");
            }
            try
            {
                user.Pass = MyCryptography.EncryptPass(newPass);
                user.DateLastPassChange    = DateTime.Now;
                user.CountAfterPassAttempt = 0;
                GetOwnDataService.Update(user);
            }
            catch (ApplicationException e)
            {
                throw new ServiceUserException("ChangePass: " + e.Message);
            }
        }
        public MyConstant.EnumLoginError Authenticate(user user, string pass)
        {
            var result = MyConstant.EnumLoginError.NoError;

            if (user == null)
            {
                return(MyConstant.EnumLoginError.NoUserRegistered);
            }
            if (user.IsConnected)
            {
                result = MyConstant.EnumLoginError.NoError;                   //myConstant.enumLoginError.UserConnected;
            }
            else if (user.IsLocked)
            {
                result = MyConstant.EnumLoginError.UserLocked;
            }
            if ((result == MyConstant.EnumLoginError.NoError) && (user.Pass != MyCryptography.EncryptPass(pass)))
            {
                result = MyConstant.EnumLoginError.IncorrectPassword;
            }
            return(result);
        }