예제 #1
0
        /// <summary>
        /// Coloca los controles a su estado original.
        /// </summary>
        private void ClearControls()
        {
            mLonId                   = 0;
            txtCommission.Text       = ConfigurationUtility.GetValue <string>("Comission").ToString();
            dpDate.SelectedDate      = DateTime.Now;
            cbType.SelectedValue     = null;
            cbCategory.SelectedValue = null;
            cbType.Text              = "Seleccionar";
            cbCategory.Text          = "Seleccionar";

            List <Control> lLstControls = new List <Control>();

            lLstControls.Add(txtCommission);
            lLstControls.Add(dpDate);
            lLstControls.Add(cbType);
            lLstControls.Add(cbCategory);
            this.ModifyControlColorBlack(lLstControls);

            lblMessage.Visibility = Visibility.Collapsed;
            btnSave.Content       = "Guardar";
            lbltitle.Content      = "Nuevo registro";
            btnDelete.Visibility  = Visibility.Collapsed;
            btnNew.Visibility     = Visibility.Collapsed;
            btnReopen.Visibility  = Visibility.Collapsed;

            txtFolio.Text = GetNextFolio();
            LoadDatagrid();
        }
예제 #2
0
        internal static bool IsDisabledBySetting(string settingName, MethodInfo method, INameResolver nameResolver)
        {
            if (nameResolver != null)
            {
                settingName = nameResolver.ResolveWholeString(settingName);
            }

            BindingTemplate             bindingTemplate = BindingTemplate.FromString(settingName);
            Dictionary <string, string> bindingData     = new Dictionary <string, string>();

            bindingData.Add("MethodName", string.Format(CultureInfo.InvariantCulture, "{0}.{1}", method.DeclaringType.Name, method.Name));
            bindingData.Add("MethodShortName", method.Name);
            settingName = bindingTemplate.Bind(bindingData);

            // check the target setting and return false (disabled) if the value exists
            // and is "falsey"
            string value = ConfigurationUtility.GetSettingFromConfigOrEnvironment(settingName);

            if (!string.IsNullOrEmpty(value) &&
                (string.Compare(value, "1", StringComparison.OrdinalIgnoreCase) == 0 ||
                 string.Compare(value, "true", StringComparison.OrdinalIgnoreCase) == 0))
            {
                return(true);
            }

            return(false);
        }
        public void ConnectionStringProvider_NoDashboardConnectionString_Throws()
        {
            ConfigurationUtility.Reset();

            const string DashboardConnectionEnvironmentVariable = "AzureWebJobsDashboard";
            string       previousConnectionString = Environment.GetEnvironmentVariable(DashboardConnectionEnvironmentVariable);

            try
            {
                Environment.SetEnvironmentVariable(DashboardConnectionEnvironmentVariable, null);

                Mock <IServiceProvider> mockServices = new Mock <IServiceProvider>(MockBehavior.Strict);
                IStorageAccountProvider product      = new DefaultStorageAccountProvider(mockServices.Object)
                {
                    StorageConnectionString = new CloudStorageAccount(new StorageCredentials("Test", string.Empty, "key"), true).ToString(exportSecrets: true)
                };

                // Act & Assert
                ExceptionAssert.ThrowsInvalidOperation(() =>
                                                       product.GetDashboardAccountAsync(CancellationToken.None).GetAwaiter().GetResult(),
                                                       "Microsoft Azure WebJobs SDK 'Dashboard' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways:" + Environment.NewLine +
                                                       "1. Set the connection string named 'AzureWebJobsDashboard' in the connectionStrings section of the .config file in the following format " +
                                                       "<add name=\"AzureWebJobsDashboard\" connectionString=\"DefaultEndpointsProtocol=http|https;AccountName=NAME;AccountKey=KEY\" />, or" + Environment.NewLine +
                                                       "2. Set the environment variable named 'AzureWebJobsDashboard', or" + Environment.NewLine +
                                                       "3. Set corresponding property of JobHostConfiguration.");
            }
            finally
            {
                Environment.SetEnvironmentVariable(DashboardConnectionEnvironmentVariable, previousConnectionString);
            }
        }
예제 #4
0
        private static string getHL7ValueSEL(HL7Message message,
                                             List <MessageGroupInstance> messageGroupInstances,
                                             List <MessageGroup> messageGroups,
                                             WebservicePropertySet wsProperty
                                             )
        {
            // get the ms groups
            List <MessageGroup> msGroups
                = ConfigurationUtility.GetIncomingWebserviceMessageGroup(wsProperty, messageGroups);

            // get segment string type
            MessageGroupInstance messageGroupInstance
                = messageGroupInstances.Find(i => i.id == msGroups[ZERO].messageGroupInstanceId);

            // get the message position for this specific column
            List <Configuration> configMessagePoisition
                = ConfigurationDAO.GetMessagePosition(messageGroupInstance);

            // get the coordinates for the message item
            string messageCoordinates = HL7MessageUtility.getItemCoordinates(configMessagePoisition);

            // get segment string type
            string segmentType = configMessagePoisition[ZERO_ELEMENT].segmentType.name;

            // get the value for the database inside of the value position
            string hl7Value = HL7MessageUtility.getValueByPosition(
                message,
                HL7MessageUtility.getSegmentType(segmentType),
                messageCoordinates);

            return(hl7Value);
        }
예제 #5
0
 /// <summary>
 /// Loads the syntax and refreshes scintilla settings.
 /// </summary>
 public static void LoadConfiguration()
 {
     SciConfigUtil = new ConfigurationUtility(Assembly.GetExecutingAssembly());
     SciConfig     = (Scintilla)SciConfigUtil.LoadConfiguration(typeof(Scintilla), FileNameHelper.Scintilla);
     ScintillaControl.Configuration = SciConfig;
     MainForm.Instance.ApplyAllSettings();
 }
예제 #6
0
        public bool TestIsValidConfiguration(string filePath)
        {
            try
            {
                BuildConfigurationType buildConfig = DeserializeBuildConfigInternal(filePath);
                if (buildConfig == null)
                {
                    _logger?.LogError($"The provided configuration {filePath} is empty.");
                    return(false);
                }

                string versionMatch = ConfigurationUtility.IsVersionMatch(buildConfig.ConfigVersion, Version)
                    ? "[MATCH]"
                    : "[MISSMATCH]";
                string msg = $"{versionMatch} The provided configuration {filePath} is a valid configuration file." +
                             $"\n\tConfiguration version:\t{buildConfig.ConfigVersion}" +
                             $"\n\tParser version:       \t{Version}";
                // [gruenwaldlu, 2020-07-14-14:14:39+2]: Required for user feedback. Depending on the configuration, the logger may not print to the console out.
                Console.Out.Write(msg);
                _logger?.LogInformation(msg);
                return(true);
            }
            catch (Exception e)
            {
                StringBuilder builder = new StringBuilder();
                string        msg     = BuildErrorMessage(builder, e);
                // [gruenwaldlu, 2020-07-27-13:45:55+2]: Required for user feedback. Depending on the configuration, the logger may not print to the console out.
                Console.Out.Write(msg);
                _logger?.LogWarning(msg);
                return(false);
            }
        }
예제 #7
0
        protected static async Task ExecuteBeerIdentityContextAwareTest(Func <DbContextOptionsBuilder <BeerIdentityContext>, BeerIdentityContext, Task> executor)
        {
            Random random1 = new Random();

            var config = ConfigurationUtility.GetConfig();

            String connectionString = $"{ConfigurationUtility.GetConnectionString("PostgresTest")};Database={random1.GetAlphanumericString()};";

            DbContextOptionsBuilder <BeerIdentityContext> dbContextOptionsBuilder = new();

            dbContextOptionsBuilder.UseNpgsql(connectionString, (ib) => ib.MigrationsAssembly(typeof(BeerIdentityContext).Assembly.FullName));
            DbContextOptions <BeerIdentityContext> contextOptions = dbContextOptionsBuilder.Options;

            BeerIdentityContext context = new BeerIdentityContext(contextOptions);

            try
            {
                await context.Database.MigrateAsync();
                await executor(dbContextOptionsBuilder, context);
            }
            finally
            {
                await context.Database.EnsureDeletedAsync();
            }
        }
예제 #8
0
 /// <summary>
 /// Initialize.
 /// </summary>
 public static void Initialize()
 {
     ConnectionString
            = ConfigurationUtility.RequireString("connectionString");
     Prefix = ConfigurationUtility.RequireString("prefix");
     Format = ConfigurationUtility.RequireString("format");
 }
예제 #9
0
        static MailSettings()
        {
            try
            {
                var emailEnabled = ConfigurationUtility.GetStringValue("EmailEnabled");
                var toEmails     = ConfigurationUtility.GetStringValue("AppExceptionAlert_To");
                var ccEmails     = ConfigurationUtility.GetStringValue("AppExceptionAlert_Cc");
                var bccEmails    = ConfigurationUtility.GetStringValue("AppExceptionAlert_Bcc");
                var overrideTo   = ConfigurationUtility.GetStringValue("EmailOverrideTo");
                var emailSubject = ConfigurationUtility.GetStringValue("EmailSubject");


                EmailEnabled           = emailEnabled != null && emailEnabled.ToBool().GetValueOrDefault();
                ExceptionAlertToEmails = toEmails == null?Enumerable.Empty <string>() : toEmails.ToEnumerable <string>(";");

                ExceptionAlertCcEmails = ccEmails == null?Enumerable.Empty <string>() : ccEmails.ToEnumerable <string>(";");

                ExceptionAlertBccEmails = ccEmails == null?Enumerable.Empty <string>() : bccEmails.ToEnumerable <string>(";");

                EmailOverrideTo = overrideTo == null?Enumerable.Empty <string>() : overrideTo.ToEnumerable <string>(";");

                EmailSubject = emailSubject ?? "Email from ACTransit";
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
예제 #10
0
        protected override object OnExecute(CommandContext context)
        {
            var configuration = ConfigurationCommand.GetConfiguration(context.CommandNode);

            if (configuration == null)
            {
                throw new CommandException(string.Format(Properties.Resources.Text_CannotObtainCommandTarget, "Configuration"));
            }

            if (context.Expression.Arguments.Length == 0)
            {
                throw new CommandException(Properties.Resources.Text_Command_MissingArguments);
            }

            if (context.Expression.Arguments.Length == 1)
            {
                var section = configuration.GetSection(ConfigurationUtility.GetConfigurationPath(context.Expression.Arguments[0]));
                ConfigurationCommand.Print(section, context.Output, context.Expression.Options.Contains(KEY_SIMPLIFY_OPTION), 0);
                return(section);
            }

            var sections = new Microsoft.Extensions.Configuration.IConfigurationSection[context.Expression.Arguments.Length];

            for (int i = 0; i < context.Expression.Arguments.Length; i++)
            {
                sections[i] = configuration.GetSection(ConfigurationUtility.GetConfigurationPath(context.Expression.Arguments[i]));
                ConfigurationCommand.Print(sections[i], context.Output, context.Expression.Options.Contains(KEY_SIMPLIFY_OPTION), 0);
            }

            return(sections);
        }
        public ActionResult <IEnumerable <string> > Get()
        {
            ConnectionStrings connectionStrings        = ConfigurationUtility.GetConnectionStrings();
            string            databaseConnectionString = connectionStrings.PrimaryDatabaseConnectionString;

            return(new string[] { databaseConnectionString });
        }
예제 #12
0
        public static Credentials GetCredentials()
        {
            string LicenseServer = ConfigurationUtility.GetValue <string>("LicenseServer");
            string UserName      = ConfigurationUtility.GetValue <string>("UserName");
            string Password      = ConfigurationUtility.GetValue <string>("Password");
            string DbServerType  = ConfigurationUtility.GetValue <SAPbobsCOM.BoDataServerTypes>("DbServerType").ToString();
            string SQLServer     = ConfigurationUtility.GetValue <string>("SQLServer");
            string SQLUserName   = ConfigurationUtility.GetValue <string>("SQLUserName");
            string SQLPassword   = ConfigurationUtility.GetValue <string>("SQLPassword");
            string DataBaseName  = ConfigurationUtility.GetValue <string>("DataBaseName");
            string Language      = ConfigurationUtility.GetValue <SAPbobsCOM.BoSuppLangs>("Language").ToString();

            return(new Credentials()
            {
                LicenseServer = ConfigurationUtility.GetValue <string>("LicenseServer"),
                UserName = ConfigurationUtility.GetValue <string>("UserName"),
                Password = ConfigurationUtility.GetValue <string>("Password"),
                DbServerType = ConfigurationUtility.GetValue <SAPbobsCOM.BoDataServerTypes>("DbServerType"),
                SQLServer = ConfigurationUtility.GetValue <string>("SQLServer"),
                SQLUserName = ConfigurationUtility.GetValue <string>("SQLUserName"),
                SQLPassword = ConfigurationUtility.GetValue <string>("SQLPassword"),
                DataBaseName = ConfigurationUtility.GetValue <string>("DataBaseName"),
                Language = ConfigurationUtility.GetValue <SAPbobsCOM.BoSuppLangs>("Language"),
            });
        }
예제 #13
0
        public static EfCfExecutionStrategy GetExecutionStrategy(ILogging logger = null)
        {
            EfCfExecutionStrategy efCfExecutionStrategy = null;

            var dbConfigurationDatabaseType = ConfigurationUtility.GetDbConfigurationDatabaseType();

            switch (dbConfigurationDatabaseType)
            {
            case ConfigurationUtility.DbConfigurationDatabaseType.MsSqlServer:
                efCfExecutionStrategy = new MsSqlServerEfCfExecutionStrategy(logger);
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MySql:
                efCfExecutionStrategy = new MySqlEfCfExecutionStrategy(logger);
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MariaDb:
                efCfExecutionStrategy = new MySqlEfCfExecutionStrategy(logger);
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.Sqlite:
                efCfExecutionStrategy = new SqliteEfCfExecutionStrategy(logger);
                break;

            default:
                efCfExecutionStrategy = new MsSqlServerEfCfExecutionStrategy(logger);
                break;
            }

            return(efCfExecutionStrategy);
        }
예제 #14
0
        public static EfCfDbConfiguration GetDbConfiguration()
        {
            EfCfDbConfiguration dbConfiguration = null;

            var dbConfigurationDatabaseType = ConfigurationUtility.GetDbConfigurationDatabaseType();

            switch (dbConfigurationDatabaseType)
            {
            case ConfigurationUtility.DbConfigurationDatabaseType.MsSqlServer:
                dbConfiguration = new MsSqlServerEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MySql:
                dbConfiguration = new MySqlEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MariaDb:
                dbConfiguration = new MySqlEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.Sqlite:
                dbConfiguration = new SqliteEfCfDbConfiguration();
                break;

            default:
                dbConfiguration = new MsSqlServerEfCfDbConfiguration();
                break;
            }

            return(dbConfiguration);
        }
예제 #15
0
        protected BaseResourceCielo(Guid merchantId, string merchantKey, string resourceName, Uri hostUri, NameValueCollection customHeaders)
        {
            if (merchantId == Guid.Empty || merchantKey == string.Empty)
            {
                merchantId  = ConfigurationUtility.GetConfigurationKey("MerchantIdCielo");
                merchantKey = ConfigurationUtility.GetConfigurationId("MerchantKeyCielo");
            }

            this.HttpUtility = new HttpUtility();
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            this.MerchantKey = merchantKey;
            if (hostUri != null)
            {
                this.HostUri = hostUri.ToString();
                this.HostUri = this.HostUri.Remove(this.HostUri.Length - 1);
            }
            else
            {
                this.HostUri = this.GetServiceUri();
            }
            this.ResourceName = resourceName;

            this._customHeader = customHeaders;
        }
예제 #16
0
        internal static object ToJsonModel(Site site, string path)
        {
            var urlSection = GetUrlCompressionSection(site, path);

            // Http Compression section has 'allowDefinition="AppHostOnly"' which means it can only be edited at webserver level
            // We factor this in when displaying the metadata
            var httpSection = GetHttpCompressionSection(site, path);

            bool         isLocal               = urlSection.IsLocallyStored || httpSection.IsLocallyStored;
            bool         isLocked              = urlSection.IsLocked;
            OverrideMode overrideMode          = urlSection.OverrideMode;
            OverrideMode overrideModeEffective = urlSection.OverrideModeEffective;


            CompressionId compressionId = new CompressionId(site?.Id, path, isLocal);

            var obj = new {
                id        = compressionId.Uuid,
                scope     = site == null ? string.Empty : site.Name + path,
                metadata  = ConfigurationUtility.MetadataToJson(isLocal, isLocked, overrideMode, overrideModeEffective),
                directory = httpSection.Directory,
                do_disk_space_limitting = httpSection.DoDiskSpaceLimiting,
                max_disk_space_usage    = httpSection.MaxDiskSpaceUsage,
                min_file_size           = httpSection.MinFileSizeForComp,
                do_dynamic_compression  = urlSection.DoDynamicCompression,
                do_static_compression   = urlSection.DoStaticCompression,
                website = SiteHelper.ToJsonModelRef(site)
            };

            return(Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
        internal static object ToJsonModel(Site site, string path)
        {
            var section = GetRequestFilteringSection(site, path);

            RequestFilteringId reqId = new RequestFilteringId(site?.Id, path, section.IsLocallyStored);

            var verbs = section.Verbs.Select(v => new {
                name    = v.Verb,
                allowed = v.Allowed
            });

            var obj = new {
                id       = reqId.Uuid,
                scope    = site == null ? string.Empty : site.Name + path,
                metadata = ConfigurationUtility.MetadataToJson(section.IsLocallyStored, section.IsLocked, section.OverrideMode, section.OverrideModeEffective),
                allow_unlisted_file_extensions = section.FileExtensions.AllowUnlisted,
                allow_unlisted_verbs           = section.Verbs.AllowUnlisted,
                allow_high_bit_characters      = section.AllowHighBitCharacters,
                allow_double_escaping          = section.AllowDoubleEscaping,
                max_content_length             = section.RequestLimits.MaxAllowedContentLength,
                max_url_length          = section.RequestLimits.MaxUrl,
                max_query_string_length = section.RequestLimits.MaxQueryString,
                verbs   = verbs,
                website = SiteHelper.ToJsonModelRef(site)
            };

            return(Core.Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
        /// <summary>
        /// Gets a configuration value from a scope and name.
        /// </summary>
        /// <typeparam name="T">Type of the returned value.</typeparam>
        /// <param name="configuration">Configuration containing a list of key-value pairs.</param>
        /// <param name="scope">Scope of the configuration.</param>
        /// <param name="name">Name of the scope.</param>
        /// <param name="valueConverter">A <see cref="ISettingValueConverter{T}"/> that converts configuration value literals to the type <typeparamref name="T"/>.</param>
        /// <returns>A configuration value of the type <typeparamref name="T"/></returns>
        public static T GetScopeValue <T>(this IConfiguration configuration, string scope, string name, ISettingValueConverter <T> valueConverter = null)
        {
            string key = ConfigurationUtility.MergeToKey(scope, name);
            T      rtn = GetValue(configuration, key, valueConverter);

            return(rtn);
        }
예제 #19
0
        public DbHelper(string configKey)
        {
            var connSetting = ConfigurationUtility.ConnectionStringSettings(configKey);

            this.DbProviderFactory = DbProviderFactories.GetFactory(connSetting.ProviderName);
            this.connectionString  = connSetting.ConnectionString;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="JobHostConfiguration"/> class, using the
        /// specified connection string for both reading and writing data as well as Dashboard logging.
        /// </summary>
        /// <param name="dashboardAndStorageConnectionString">The Azure Storage connection string to use.
        /// </param>
        public JobHostConfiguration(string dashboardAndStorageConnectionString)
        {
            if (!string.IsNullOrEmpty(dashboardAndStorageConnectionString))
            {
                _storageAccountProvider = new DefaultStorageAccountProvider(this, dashboardAndStorageConnectionString);
            }
            else
            {
                _storageAccountProvider = new DefaultStorageAccountProvider(this);
            }

            Singleton = new SingletonConfiguration();

            // add our built in services here
            IExtensionRegistry extensions  = new DefaultExtensionRegistry();
            ITypeLocator       typeLocator = new DefaultTypeLocator(ConsoleProvider.Out, extensions);

            AddService <IExtensionRegistry>(extensions);
            AddService <StorageClientFactory>(new StorageClientFactory());
            AddService <INameResolver>(new DefaultNameResolver());
            AddService <IJobActivator>(DefaultJobActivator.Instance);
            AddService <ITypeLocator>(typeLocator);

            string value = ConfigurationUtility.GetSettingFromConfigOrEnvironment(Constants.EnvironmentSettingName);

            IsDevelopment = string.Compare(Constants.DevelopmentEnvironmentValue, value, StringComparison.OrdinalIgnoreCase) == 0;
        }
        /// <summary>
        /// Gets a configuration value list from a scope and name. Returns <paramref name="defaultValueList"/> if no key was found.
        /// </summary>
        /// <typeparam name="T">Type of the returned value.</typeparam>
        /// <param name="configuration">Configuration containing a list of key-list of value.</param>
        /// <param name="scope">Scope of the configuration.</param>
        /// <param name="name">Name of the scope.</param>
        /// <param name="defaultValueList">Default value list to return if no key is found.</param>
        /// <param name="valueConverter">A <see cref="ISettingValueConverter{T}"/> that converts configuration value literals to the type <typeparamref name="T"/>.</param>
        /// <returns>A <see cref="IEnumerable{T}"/>.</returns>
        public static IEnumerable <T> GetScopeValueList <T>(this IConfiguration configuration, string scope, string name, IEnumerable <T> defaultValueList, ISettingValueConverter <T> valueConverter = null)
        {
            string          key = ConfigurationUtility.MergeToKey(scope, name);
            IEnumerable <T> rtn = GetValueList(configuration, key, defaultValueList, valueConverter);

            return(rtn);
        }
        internal static object ToJsonModel(Site site, string path)
        {
            HandlersSection section = GetHandlersSection(site, path);

            HandlersId id = new HandlersId(site?.Id, path, section.IsLocallyStored);

            // Access Policy
            HandlerAccessPolicy accessPolicy = section.AccessPolicy;

            Dictionary <string, bool> allowedAccess = new Dictionary <string, bool>();

            allowedAccess.Add("read", accessPolicy.HasFlag(HandlerAccessPolicy.Read));
            allowedAccess.Add("write", accessPolicy.HasFlag(HandlerAccessPolicy.Write));
            allowedAccess.Add("execute", accessPolicy.HasFlag(HandlerAccessPolicy.Execute));
            allowedAccess.Add("source", accessPolicy.HasFlag(HandlerAccessPolicy.Source));
            allowedAccess.Add("script", accessPolicy.HasFlag(HandlerAccessPolicy.Script));

            Dictionary <string, bool> remoteAccessPrevention = new Dictionary <string, bool>();

            remoteAccessPrevention.Add("write", accessPolicy.HasFlag(HandlerAccessPolicy.NoRemoteWrite));
            remoteAccessPrevention.Add("read", accessPolicy.HasFlag(HandlerAccessPolicy.NoRemoteRead));
            remoteAccessPrevention.Add("execute", accessPolicy.HasFlag(HandlerAccessPolicy.NoRemoteExecute));
            remoteAccessPrevention.Add("script", accessPolicy.HasFlag(HandlerAccessPolicy.NoRemoteScript));

            var obj = new {
                id                       = id.Uuid,
                scope                    = site == null ? string.Empty : site.Name + path,
                metadata                 = ConfigurationUtility.MetadataToJson(section.IsLocallyStored, section.IsLocked, section.OverrideMode, section.OverrideModeEffective),
                allowed_access           = allowedAccess,
                remote_access_prevention = remoteAccessPrevention,
                website                  = SiteHelper.ToJsonModelRef(site)
            };

            return(Core.Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
예제 #23
0
        protected override void OnStart(string[] args)
        {
            // log
            ErrorLogger.Log(ErrorLogger.LogType.OUTBOUND_SERVICE_STARTING, DateTime.Now.ToString());

            // get all configuration data
            List <Configuration> configs = ConfigurationDAO.GetApplications();

            // get the master configuration
            Configuration masterConfig = ConfigurationDAO.GetAllConfigurations();

            // gets the outgoing webservice configuration only
            List <Configuration> applications = ConfigurationUtility.GetIncomingWebservice(configs);

            applications.ForEach(delegate(Configuration appConfig) {
                OutboundHandler outboundHandler = new OutboundHandler();
                string appName = appConfig.application.name;

                // set the app name
                outboundHandler.setApplicationName(appName);

                // set the master config
                outboundHandler.setMasterConfiguration(masterConfig);

                // set the static worker
                outboundHandler.setProcessingWorker(OutboundHandlerDAO.handleProcessingForOutboundHandler);

                // add to queue and run
                ThreadPool.QueueUserWorkItem(new WaitCallback(startOutboundProcessing), outboundHandler);
            });
        }
        public WebVirtualDirectory[] GetVirtualDirectories(string siteId)
        {
            if (!SiteExists(siteId))
            {
                return new WebVirtualDirectory[] { }
            }
            ;

            using (var srvman = GetServerManager())
            {
                var vdirs = new List <WebVirtualDirectory>();

                var iisObject = srvman.Sites[siteId];
                //
                foreach (var item in iisObject.Applications)
                {
                    // Skip root application which is web site itself
                    if (item.Path == "/")
                    {
                        continue;
                    }
                    //
                    vdirs.Add(new WebVirtualDirectory
                    {
                        Name        = ConfigurationUtility.GetNonQualifiedVirtualPath(item.Path),
                        ContentPath = item.VirtualDirectories[0].PhysicalPath
                    });
                }
                //
                return(vdirs.ToArray());
            }
        }
예제 #25
0
        internal static object ToJsonModel(Site site, string path)
        {
            var section = GetDirectoryBrowseSection(site, path);

            DirectoryBrowsingId dirbId = new DirectoryBrowsingId(site?.Id, path, section.IsLocallyStored);

            DirectoryBrowseShowFlags showFlags = section.ShowFlags;

            Dictionary <string, bool> showDictionary = new Dictionary <string, bool>();

            showDictionary.Add("date", showFlags.HasFlag(DirectoryBrowseShowFlags.Date));
            showDictionary.Add("time", showFlags.HasFlag(DirectoryBrowseShowFlags.Time));
            showDictionary.Add("size", showFlags.HasFlag(DirectoryBrowseShowFlags.Size));
            showDictionary.Add("extension", showFlags.HasFlag(DirectoryBrowseShowFlags.Extension));
            showDictionary.Add("long_date", showFlags.HasFlag(DirectoryBrowseShowFlags.LongDate));

            var obj = new {
                id                 = dirbId.Uuid,
                scope              = site == null ? string.Empty : site.Name + path,
                metadata           = ConfigurationUtility.MetadataToJson(section.IsLocallyStored, section.IsLocked, section.OverrideMode, section.OverrideModeEffective),
                enabled            = section.Enabled,
                allowed_attributes = showDictionary,
                website            = SiteHelper.ToJsonModelRef(site),
            };

            return(Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
예제 #26
0
        public static void Load(IServiceCollection services, IConfiguration configuration)
        {
            var connectionString = ConfigurationUtility.GetConfiguration(configuration, "SqlConnectionString");

            services.AddDbContext <JobDbContext>(options => options.UseSqlServer(connectionString));
            services.AddScoped <IJobsRepository, JobsRepository>();
        }
예제 #27
0
 /// <summary>
 /// Loads the syntax and refreshes scintilla settings.
 /// </summary>
 public static void LoadConfiguration()
 {
     sciConfigUtil = new ConfigurationUtility(Assembly.GetExecutingAssembly());
     String[] configFiles = Directory.GetFiles(Path.Combine(PathHelper.SettingDir, "Languages"), "*.xml");
     sciConfig = (Scintilla)sciConfigUtil.LoadConfiguration(configFiles);
     ScintillaControl.Configuration = sciConfig;
     ConfigurationLoaded?.Invoke();
 }
        public void GetSettingFromConfigOrEnvironment_ConfigSetting_NoEnvironmentSetting()
        {
            ConfigurationUtility.Reset();

            string value = ConfigurationUtility.GetSetting("DisableSetting0");

            Assert.Equal("0", value);
        }
예제 #29
0
 /// <summary>
 /// Loads the syntax and refreshes scintilla settings.
 /// </summary>
 public static void LoadConfiguration()
 {
     SciConfigUtil = new ConfigurationUtility(Assembly.GetExecutingAssembly());
     String[] configFiles = Directory.GetFiles(Path.Combine(PathHelper.SettingDir, "Languages"), "*.xml");
     SciConfig = (Scintilla)SciConfigUtil.LoadConfiguration(configFiles);
     ScintillaControl.Configuration = SciConfig;
     MainForm.Instance.ApplyAllSettings();
 }
        public void GetSettingFromConfigOrEnvironment_NameNull_ReturnsEmpty()
        {
            ConfigurationUtility.Reset();

            string value = ConfigurationUtility.GetSetting(null);

            Assert.Equal(null, value);
        }