void LazyLoadHandlers(LoadContentContext context, AdSettingsPart part)
        {
            part.PasswordField.Getter(() =>
            {
                try
                {
                    return string.IsNullOrWhiteSpace(part.Record.Password) ? string.Empty : Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(part.Record.Password)));
                }
                catch
                {
                    Logger.Error("The Ad Settings password could not be decrypted. It might be corrupted, try to reset it.");
                    return null;
                }
            });

            part.PasswordField.Setter(value => part.Record.Password = string.IsNullOrWhiteSpace(value) ? string.Empty : Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(value))));
        }
        void LazyLoadHandlers(LoadContentContext context, AdSettingsPart part)
        {
            part.PasswordField.Getter(() =>
            {
                try
                {
                    return(string.IsNullOrWhiteSpace(part.Record.Password) ? string.Empty : Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(part.Record.Password))));
                }
                catch
                {
                    Logger.Error("The Ad Settings password could not be decrypted. It might be corrupted, try to reset it.");
                    return(null);
                }
            });

            part.PasswordField.Setter(value => part.Record.Password = string.IsNullOrWhiteSpace(value) ? string.Empty : Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(value))));
        }
 public ActiveDirectoryContactLookupService(IOrchardServices orchardServices)
 {
     _adSettings = orchardServices.WorkContext.CurrentSite.As<AdSettingsPart>();
 }
 public ActiveDirectoryContactLookupService(IOrchardServices orchardServices)
 {
     _adSettings = orchardServices.WorkContext.CurrentSite.As <AdSettingsPart>();
 }