// // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // .NET StockTrader Sample WCF Application for Benchmarking, Performance Analysis and Design Considerations for Service-Oriented Applications //====================================================================================================== // The Settings class for the StockTrader Web Application. Please note well that we only override the // inherited settings (with the new keyword) becuase of the special case StockTrader allows for running // BSL in-process with the StockTrader Composite Web Application, vs. remote calls. You will NOT need to // do this for your services--your Settings class will be much simpler, simply using the *inherited* // global settings, and only specifying app-specific settings here. //====================================================================================================== //====================================================================================================== // Code originally contributed by Microsoft Corporation. // This contribution to the Stonehenge project is limited strictly // to the source code that is submitted in this submission. // Any technology, including underlying platform technology, // that is referenced or required by the submitted source code // is not a part of the contribution. // For example and not by way of limitation, // any systems/Windows libraries (WPF, WCF, ASP.NET etc.) // required to run the submitted source code is not a part of the contribution //====================================================================================================== using System; using System.Collections.Generic; using System.Configuration; using System.Web; using System.Data; using System.Collections; using System.Diagnostics; using System.Messaging; using System.Text; using System.Reflection; using Trade.Utility; using Trade.ConfigServiceDataContract; using Trade.ConfigClient; using Trade.ConfigServiceConfigurationSettings; using Trade.ConfigServiceContract; namespace Trade.StockTraderWebApplicationSettings { /// /// Any app or service implementing the Configuration Service needs a custom Settings class that will contain it's /// config settings. These are (largely) loaded from the SQL repository on startup with current values as set for service. /// Your custom settings class should inherit from the ConfigurationSettingsBase class, which contains common /// settings used by all services implementing the config service. /// public class Settings //db : ConfigurationSettingsBase //Inherit from base implementation!! { public static string BSL_USERID; public static string BSL_PASSWORD; public static int MAX_DISPLAY_ORDERS; public static int MAX_DISPLAY_TOP_ORDERS; public static bool DISPLAY_DUPLICATE_KEY_EXCEPTIONS; public static bool CHECK_ORDER_ALERT_EVERY_REQUEST; public static int ORDER_ALERT_CHECK_FREQUENCY; public static string EVENT_LOG; public static string CLIENT_LABEL; public static string BS_LABEL; public static string OPS_LABEL; public static readonly string CACHE_KEY_CLOSED_ORDERSALERT = "O"; //Page Names for StockTrader application public static readonly string PAGE_HOME = "TradeHome.aspx"; public static readonly string PAGE_LOGIN = "Login.aspx"; public static readonly string PAGE_QUOTES = "Quotes.aspx"; public static readonly string PAGE_ORDER = "Order.aspx"; public static readonly string PAGE_TRADE = "StockTrade.aspx"; public static readonly string PAGE_PORTFOLIO = "Portfolio.aspx"; public static readonly string PAGE_CONFIGURATION = "Configuration.aspx"; public static readonly string PAGE_CONFIGURATION_ADVANCED = "ConfigurationAdvanced.aspx"; public static readonly string PAGE_CONFIGURATION_ADD = "ConfigurationAdd.aspx"; //Trade HTML Fomatting Constants public static readonly string GAINSTYLECSS = "price-gain"; public static readonly string LOSSSTYLECSS = "price-loss"; /// /// Settings (Constructor) - handles the config. /// Sets the items in the appSettings to public variables. /// static Settings() { Settings.MAX_DISPLAY_ORDERS = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MAX_DISPLAY_ORDERS")); Settings.MAX_DISPLAY_TOP_ORDERS = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MAX_DISPLAY_TOP_ORDERS")); Settings.DISPLAY_DUPLICATE_KEY_EXCEPTIONS = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("DISPLAY_DUPLICATE_KEY_EXCEPTIONS")); Settings.CHECK_ORDER_ALERT_EVERY_REQUEST = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("DISPLAY_DUPLICATE_KEY_EXCEPTIONS")); Settings.ORDER_ALERT_CHECK_FREQUENCY = Convert.ToInt32(ConfigurationManager.AppSettings.Get("ORDER_ALERT_CHECK_FREQUENCY")); Settings.BSL_USERID = ConfigurationManager.AppSettings.Get("BSL_USERID"); Settings.BSL_PASSWORD = ConfigurationManager.AppSettings.Get("BSL_PASSWORD"); Settings.CLIENT_LABEL = ConfigurationManager.AppSettings.Get("CLIENT_LABEL"); Settings.BS_LABEL = ConfigurationManager.AppSettings.Get("BS_LABEL"); Settings.OPS_LABEL = ConfigurationManager.AppSettings.Get("OPS_LABEL"); } } }