/// <summary> /// Create an NHibernate configuration class. /// </summary> /// <param name="options">Configuration options.</param> /// <returns>The configuration.</returns> public NHibernate.Cfg.Configuration CreateNHibernateConfiguration(ConfigurationFlags options) { var configuration = new NHibernate.Cfg.Configuration(); if ((options & ConfigurationFlags.Settings) == ConfigurationFlags.Settings) { configuration.SetProperty("hibernate.connection.connection_string", ConnectionConnectionString); configuration.SetProperty("hibernate.connection.provider", ConnectionProvider); configuration.SetProperty("hibernate.connection.driver_class", ConnectionDriverClass); configuration.SetProperty("hibernate.show_sql", ShowSql.ToString(CultureInfo.InvariantCulture).ToUpper( CultureInfo.InvariantCulture)); configuration.SetProperty("hibernate.dialect", Dialect); } if ((options & ConfigurationFlags.Mappings) == ConfigurationFlags.Mappings) { foreach (Assembly assembly in MappingAssemblies) { configuration.AddAssembly(assembly); } } if ((options & ConfigurationFlags.Interceptor) == ConfigurationFlags.Interceptor) { configuration.SetInterceptor(Interceptor); } return(configuration); }
private void BindList() { pnlResults.Visible = true; pnlEdit.Visible = false; ConfigurationFlags configFlags = chkShowInactive.Checked ? ConfigurationFlags.None : ConfigurationFlags.IsActive; IPagedCollection <Blog> blogs = Blog.GetBlogs(_pageIndex, resultsPager.PageSize, configFlags); if (blogs.Count > 0) { resultsPager.Visible = true; resultsPager.ItemCount = blogs.MaxItems; rprBlogsList.Visible = true; rprBlogsList.DataSource = blogs; rprBlogsList.DataBind(); lblNoMessages.Visible = false; } else { resultsPager.Visible = false; rprBlogsList.Visible = false; resultsPager.Visible = false; lblNoMessages.Visible = true; } CurrentBlogCount = blogs.MaxItems; }
static IntPtr Create(ConfigurationFlags flags) { var handle = new IntPtr(); int res = Api.YOGI_ConfigurationCreate(ref handle, flags); CheckErrorCode(res); return(handle); }
/////////////////////////////////////////////////////////////////////// public static bool DoesValueExist( string variable, ConfigurationFlags flags ) /* THREAD-SAFE */ { string value = GetValue(variable, flags); return(value != null); }
/// <summary> /// Gets the active blog count by host. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> /// <param name="pageIndex">Zero based index of the page to retrieve.</param> /// <param name="pageSize">Number of records to display on the page.</param> /// <param name="flags">Configuration flags to filter blogs retrieved.</param> public static IPagedCollection <Blog> GetBlogsByHost(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { if (String.IsNullOrEmpty(host)) { throw new ArgumentNullException("host"); } return(ObjectProvider.Instance().GetPagedBlogs(host, pageIndex, pageSize, flags)); }
/// <summary> /// Gets the active blog count by host. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> /// <param name="pageIndex">Zero based index of the page to retrieve.</param> /// <param name="pageSize">Number of records to display on the page.</param> /// <param name="flags">Configuration flags to filter blogs retrieved.</param> public static IPagedCollection <Blog> GetBlogsByHost(this ObjectRepository repository, string host, int pageIndex, int pageSize, ConfigurationFlags flags) { if (String.IsNullOrEmpty(host)) { throw new ArgumentNullException("host"); } return(repository.GetPagedBlogs(host, pageIndex, pageSize, flags)); }
/// <summary> /// Gets the active blog count by host. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> /// <param name="pageIndex">Zero based index of the page to retrieve.</param> /// <param name="pageSize">Number of records to display on the page.</param> /// <param name="flags">Configuration flags to filter blogs retrieved.</param> public static IPagedCollection<Blog> GetBlogsByHost(this ObjectRepository repository, string host, int pageIndex, int pageSize, ConfigurationFlags flags) { if (String.IsNullOrEmpty(host)) { throw new ArgumentNullException("host"); } return repository.GetPagedBlogs(host, pageIndex, pageSize, flags); }
/// <summary> /// Adds or removes a <see cref="ConfigurationFlags"/> to the /// flags set for this blog via bitmask operations. /// </summary> /// <param name="cf">Cf.</param> /// <param name="select">Select.</param> protected void FlagSetter(ConfigurationFlags cf, bool select) { if (select) { Flag = Flag | cf; } else { Flag = Flag & ~cf; } }
/////////////////////////////////////////////////////////////////////// #region Configuration Value Management Methods public static ConfigurationFlags GetFlags( ConfigurationFlags flags, bool verbose ) /* THREAD-SAFE */ { ConfigurationFlags result = flags; if (verbose) { result |= ConfigurationFlags.Verbose; } return(result); }
/// <summary> /// Adds the initial blog configuration. This is a convenience method for /// allowing a user with a freshly installed blog to immediately gain access /// to the admin section to edit the blog. /// </summary> /// <param name="title"></param> /// <param name="userName">Name of the user.</param> /// <param name="password">Password.</param> /// <param name="host"></param> /// <param name="subfolder"></param> /// <param name="blogGroupId"></param> /// <returns></returns> public override int CreateBlog(string title, string userName, string password, string host, string subfolder, int blogGroupId) { const ConfigurationFlags flag = ConfigurationFlags.IsActive | ConfigurationFlags.CommentsEnabled | ConfigurationFlags.CompressSyndicatedFeed | ConfigurationFlags.IsAggregated | ConfigurationFlags.IsPasswordHashed | ConfigurationFlags.AutoFriendlyUrlEnabled | ConfigurationFlags.CommentNotificationEnabled | ConfigurationFlags.RFC3229DeltaEncodingEnabled | ConfigurationFlags.CaptchaEnabled; return(_procedures.UTILITYAddBlog(title, userName, password, string.Empty, host, subfolder ?? string.Empty, (int)flag, blogGroupId)); }
/////////////////////////////////////////////////////////////////////// public static bool HasFlags( ConfigurationFlags flags, ConfigurationFlags hasFlags, bool all ) { if (all) { return((flags & hasFlags) == hasFlags); } else { return((flags & hasFlags) != ConfigurationFlags.None); } }
public TfsConfiguration(IDispatcher uiDispatcher, ConfigurationFlags flags = ConfigurationFlags.None) : base(uiDispatcher) { Localizer = new TfsLocalizer(); _url = new TextOption(string.Empty, TextIds.UrlName, TextIds.UrlDescription); _collectionName = new TextOption(string.Empty, TextIds.CollectionNameName, TextIds.CollectionNameDescription); _project = new ProjectOption(); _repository = new RepositoryOption(); _authenticationType = new EnumOption <AuthenticationType>(AuthenticationType.Windows, TextIds.AuthenticationTypeName, TextIds.AuthenticationTypeDescription); _userName = new TextOption(string.Empty, TextIds.UserNameName, TextIds.UserNameDescription); _password = new EncryptedTextOption(string.Empty, TextIds.PasswordName, TextIds.PasswordDescription); _token = new EncryptedTextOption(string.Empty, TextIds.TokenName, TextIds.TokenDescription); UpdateAuthenticationFieldsVisibility(_authenticationType.Value); _authenticationType.ValueChanged += AuthenticationType_ValueChanged; if (flags.HasFlag(ConfigurationFlags.HideRepository)) { _repository.IsVisible = false; } var projectValueCalculator = CreateCalculator(FetchProjectsAsync, OnProjectsFetched); projectValueCalculator.Attach(_url, _collectionName); projectValueCalculator.Attach(_authenticationType, _token, _password, _userName); projectValueCalculator.Affect(_project); if (!flags.HasFlag(ConfigurationFlags.HideRepository)) { var repositoryValueCalculator = CreateCalculator(FetchRepositoriesAsync, OnRepositoriesFetched); repositoryValueCalculator.Attach(_url, _collectionName); repositoryValueCalculator.Attach(_project); repositoryValueCalculator.Attach(_authenticationType, _token, _password, _userName); repositoryValueCalculator.Affect(_repository); } }
/// <summary> /// Adds or removes a <see cref="ConfigurationFlags"/> to the /// flags set for this blog via bitmask operations. /// </summary> /// <param name="cf">Cf.</param> /// <param name="select">Select.</param> protected void FlagSetter(ConfigurationFlags cf, bool select) { if(select) { Flag = Flag | cf; } else { Flag = Flag & ~cf; } }
/// <summary> /// Checks to see if the specified <see cref="ConfigurationFlags"/> /// matches a flag set for this blog. /// </summary> /// <param name="cf">Cf.</param> /// <returns></returns> protected bool FlagPropertyCheck(ConfigurationFlags cf) { return (Flag & cf) == cf; }
/// <summary> /// Gets the active blog count by host. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> /// <param name="pageIndex">Zero based index of the page to retrieve.</param> /// <param name="pageSize">Number of records to display on the page.</param> /// <param name="flags">Configuration flags to filter blogs retrieved.</param> public static IPagedCollection<Blog> GetBlogsByHost(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { if(String.IsNullOrEmpty(host)) { throw new ArgumentNullException("host"); } return ObjectProvider.Instance().GetPagedBlogs(host, pageIndex, pageSize, flags); }
/// <summary> /// Returns a <see cref="IList{T}"/> containing ACTIVE the <see cref="Blog"/> /// instances within the specified range. /// </summary> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags"></param> /// <returns></returns> public static IPagedCollection <Blog> GetBlogs(this ObjectRepository repository, int pageIndex, int pageSize, ConfigurationFlags flags) { return(repository.GetPagedBlogs(null, pageIndex, pageSize, flags)); }
/// <summary> /// Constructor. /// </summary> /// <param name="flags">Flags for behaviour adjustments.</param> public Configuration(ConfigurationFlags flags = ConfigurationFlags.None) : base(Create(flags)) { Flags = flags; }
/// <summary> /// Returns a <see cref="IList{T}"/> containing ACTIVE the <see cref="Blog"/> /// instances within the specified range. /// </summary> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags"></param> /// <returns></returns> public static IPagedCollection<Blog> GetBlogs(this ObjectRepository repository, int pageIndex, int pageSize, ConfigurationFlags flags) { return repository.GetPagedBlogs(null, pageIndex, pageSize, flags); }
/// <summary> /// Create an NHibernate configuration class /// </summary> /// <returns></returns> public NHibernate.Cfg.Configuration CreateNHibernateConfiguration(ConfigurationFlags options, IInterceptor interceptor) { var configuration = new NHibernate.Cfg.Configuration(); if ((options & ConfigurationFlags.Settings) == ConfigurationFlags.Settings) { configuration.SetProperty("connection.connection_string", Connection_ConnectionString); configuration.SetProperty("connection.provider", Connection_Provider); configuration.SetProperty("connection.driver_class", Connection_DriverClass); configuration.SetProperty("dialect", Dialect); configuration.SetProperty("show_sql", ShowSql.ToString(CultureInfo.InvariantCulture).ToLower()); configuration.SetProperty("proxyfactory.factory_class", ProxyFactoryClass); //Include The TablePrefix Property For the Table Mappings ... RRRM : 23/09/2007 if (!String.IsNullOrEmpty(TablePrefix)) { var ns = (NamingStrategy)NamingStrategy.Instance; ns.Prefix = TablePrefix; configuration.SetNamingStrategy(NamingStrategy.Instance); } } if ((options & ConfigurationFlags.Mappings) == ConfigurationFlags.Mappings) { foreach (var assembly in MappingAssemblies) configuration.AddAssembly(assembly); } if ((options & ConfigurationFlags.Interceptor) == ConfigurationFlags.Interceptor) { if (interceptor != null) configuration.SetInterceptor(interceptor); } if ((options & ConfigurationFlags.MappingsToExport) == ConfigurationFlags.MappingsToExport) { foreach (var assembly in MappingAssembliesToExport) configuration.AddAssembly(assembly); } return configuration; }
/// <summary> /// Gets a pageable Collection of <see cref="Blog"/> instances. /// </summary> /// <param name="host">The host filter. Set to null to return all blogs.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> /// <param name="flags"></param> public override IPagedCollection<Blog> GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { using (IDataReader reader = _procedures.GetPagedBlogs(host, pageIndex, pageSize, flags)) { return reader.ReadPagedCollection(r => r.ReadBlog()); } }
/// <summary> /// Gets a pageable <see cref="ICollection"/> of <see cref="Blog"/> instances. /// </summary> /// <param name="host">The host to filter by.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> /// <param name="flags"></param> public abstract IPagedCollection <Blog> GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags);
/// <summary> /// Gets a pageable Collection of <see cref="Blog"/> instances. /// </summary> /// <param name="host">The host filter. Set to null to return all blogs.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> /// <param name="flags"></param> public override IPagedCollection <Blog> GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { using (IDataReader reader = _procedures.GetPagedBlogs(host, pageIndex, pageSize, flags)) { return(reader.ReadPagedCollection(r => r.ReadBlog())); } }
/// <summary> /// Gets a pageable <see cref="ICollection"/> of <see cref="Blog"/> instances. /// </summary> /// <param name="host">The host to filter by.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> /// <param name="flags"></param> public abstract IPagedCollection<Blog> GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags);
/// <summary> /// Returns a <see cref="IList{T}"/> containing ACTIVE the <see cref="Blog"/> /// instances within the specified range. /// </summary> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags"></param> /// <returns></returns> public static IPagedCollection <Blog> GetBlogs(int pageIndex, int pageSize, ConfigurationFlags flags) { return(ObjectProvider.Instance().GetPagedBlogs(null, pageIndex, pageSize, flags)); }
/// <summary> /// Create an NHibernate configuration class /// </summary> /// <returns></returns> public NHibernate.Cfg.Configuration CreateNHibernateConfiguration(ConfigurationFlags options) { return CreateNHibernateConfiguration(options, null); }
/////////////////////////////////////////////////////////////////////// public static void UnsetValue( string variable, ConfigurationFlags flags ) /* THREAD-SAFE */ { string prefixedVariable = null; // // NOTE: If the variable name is null or empty, do nothing. // if (String.IsNullOrEmpty(variable)) { goto done; } // // NOTE: Try to set the variable name without the package name // prefix? // bool unprefixed = FlagOps.HasFlags( flags, ConfigurationFlags.Unprefixed, true); // // NOTE: Set the variable name prefixed by package name instead? // if (FlagOps.HasFlags(flags, ConfigurationFlags.Prefixed, true)) { prefixedVariable = String.Format( EnvVarFormat, EnvVarPrefix, variable); } #if CONFIGURATION // // NOTE: Does the caller want to remove the loaded AppSettings? // if (FlagOps.HasFlags(flags, ConfigurationFlags.AppSettings, true)) { // // NOTE: Try to unset the requested AppSettings value(s). // if (unprefixed) { ConfigurationOps.UnsetAppSetting(variable); } if (prefixedVariable != null) { ConfigurationOps.UnsetAppSetting(prefixedVariable); } } #endif // // NOTE: Does the caller want to remove the environment variables? // if (FlagOps.HasFlags(flags, ConfigurationFlags.Environment, true)) { // // NOTE: Try to unset the requested environment variable(s). // if (unprefixed) { CommonOps.Environment.UnsetVariable(variable); } if (prefixedVariable != null) { CommonOps.Environment.UnsetVariable(prefixedVariable); } } done: // // NOTE: Output diagnostic message about the configuration value // request. // if (DefaultVerbose || FlagOps.HasFlags(flags, ConfigurationFlags.Verbose, true)) { TraceOps.DebugTrace(String.Format( "UnsetValue: variable = {0}, prefixedVariable = {1}, " + "defaultVerbose = {2}, flags = {3}", FormatOps.WrapOrNull(variable), FormatOps.WrapOrNull(prefixedVariable), DefaultVerbose, FormatOps.WrapOrNull(flags)), typeof(GlobalConfiguration).Name, TracePriority.StartupDebug); } }
/// <summary> /// Returns a list of all the blogs within the specified range. /// </summary> /// <param name="host">The hostname for this blog.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags">Flags for type of retrieval.</param> /// <returns></returns> public virtual IDataReader GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { try { return(GetPageableBlogs(pageIndex, pageSize, host, (int)flags)); } catch (SqlException) { SqlParameter[] p = { DataHelper.MakeInParam("@PageIndex", pageIndex), DataHelper.MakeInParam("@PageSize", pageSize), DataHelper.MakeInParam("@SortDesc", 0), }; return(GetReader("subtext_GetPageableBlogs", p)); } }
/// <summary> /// Checks to see if the specified <see cref="ConfigurationFlags"/> /// matches a flag set for this blog. /// </summary> /// <param name="cf">Cf.</param> /// <returns></returns> protected bool FlagPropertyCheck(ConfigurationFlags cf) { return((Flag & cf) == cf); }
/////////////////////////////////////////////////////////////////////// public static string GetValue( string variable, ConfigurationFlags flags ) /* THREAD-SAFE */ { string prefixedVariable = null; // // NOTE: The default return value is null, which means that the // value is not available and/or not set. // string value = null; // // NOTE: If the variable name is null or empty, return the default // value (null) instead of potentially throwing an exception // later. // if (String.IsNullOrEmpty(variable)) { goto done; } // // NOTE: Try to get the variable name without the package name // prefix? // bool unprefixed = FlagOps.HasFlags( flags, ConfigurationFlags.Unprefixed, true); // // NOTE: Try to get the variable name prefixed by package name // first? // if (FlagOps.HasFlags(flags, ConfigurationFlags.Prefixed, true)) { prefixedVariable = String.Format( EnvVarFormat, EnvVarPrefix, variable); } // // NOTE: Does the caller want to check the environment variables? // if (FlagOps.HasFlags(flags, ConfigurationFlags.Environment, true)) { // // NOTE: Try the variable name prefixed by our package name // first? // if ((prefixedVariable != null) && (value == null)) { value = CommonOps.Environment.GetVariable(prefixedVariable); } // // NOTE: Failing that, just try for the variable name? // if (unprefixed && (value == null)) { value = CommonOps.Environment.GetVariable(variable); } } #if CONFIGURATION // // NOTE: Does the caller want to check the loaded AppSettings? // if (FlagOps.HasFlags(flags, ConfigurationFlags.AppSettings, true)) { // // NOTE: Try the variable name prefixed by our package name // first? // if ((prefixedVariable != null) && (value == null)) { value = ConfigurationOps.GetAppSetting(prefixedVariable); } // // NOTE: Failing that, just try for the variable name? // if (unprefixed && (value == null)) { value = ConfigurationOps.GetAppSetting(variable); } } #endif // // NOTE: If necessary, expand any contained environment variables. // if (!String.IsNullOrEmpty(value) && FlagOps.HasFlags(flags, ConfigurationFlags.Expand, true)) { value = CommonOps.Environment.ExpandVariables(value); } done: // // NOTE: Output diagnostic message about the configuration value // request. // if (DefaultVerbose || FlagOps.HasFlags(flags, ConfigurationFlags.Verbose, true)) { TraceOps.DebugTrace(String.Format( "GetValue: variable = {0}, prefixedVariable = {1}, " + "value = {2}, defaultVerbose = {3}, flags = {4}", FormatOps.WrapOrNull(variable), FormatOps.WrapOrNull(prefixedVariable), FormatOps.WrapOrNull(value), DefaultVerbose, FormatOps.WrapOrNull(flags)), typeof(GlobalConfiguration).Name, TracePriority.StartupDebug); } return(value); }
/// <summary> /// Returns a <see cref="IList{T}"/> containing ACTIVE the <see cref="Blog"/> /// instances within the specified range. /// </summary> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags"></param> /// <returns></returns> public static IPagedCollection<Blog> GetBlogs(int pageIndex, int pageSize, ConfigurationFlags flags) { return ObjectProvider.Instance().GetPagedBlogs(null, pageIndex, pageSize, flags); }
/// <summary> /// Returns a list of all the blogs within the specified range. /// </summary> /// <param name="host">Hostname for the blogs to grab</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="flags">Filter blogs retrieved.</param> /// <returns></returns> public abstract IDataReader GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags);
/// <summary> /// Gets a pageable <see cref="IList"/> of <see cref="BlogInfo"/> instances. /// </summary> /// <param name="host">The host filter. Set to null to return all blogs.</param> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> /// <param name="flags"></param> public override PagedCollection<BlogInfo> GetPagedBlogs(string host, int pageIndex, int pageSize, ConfigurationFlags flags) { using(IDataReader reader = DbProvider.Instance().GetPagedBlogs(host, pageIndex, pageSize, flags)) { PagedCollection<BlogInfo> pec = new PagedCollection<BlogInfo>(); while(reader.Read()) { pec.Add(DataHelper.LoadConfigData(reader)); } reader.NextResult(); pec.MaxItems = DataHelper.GetMaxItems(reader); return pec; } }