Beispiel #1
0
        public MainViewModel(Settings settings, bool useUI = true)
        {
            _saved = false;
            _queryTextBeforeLeaveResults = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            _historyItemsStorage       = new WoxJsonStorage <History>();
            _userSelectedRecordStorage = new WoxJsonStorage <UserSelectedRecord>();
            _topMostRecordStorage      = new WoxJsonStorage <TopMostRecord>();
            _history            = _historyItemsStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord      = _topMostRecordStorage.Load();

            ContextMenu      = new ResultsViewModel(_settings);
            Results          = new ResultsViewModel(_settings);
            History          = new ResultsViewModel(_settings);
            _selectedResults = Results;

            _translator = InternationalizationManager.Instance;
            if (useUI)
            {
                InitializeKeyCommands();
                RegisterResultsUpdatedEvent();

                SetHotkey(_settings.Hotkey, OnHotkey);
                SetCustomPluginHotkey();
            }

            RegisterResultConsume();
        }
Beispiel #2
0
        public void GherkinKeywordShouldBe(string lang, string expected)
        {
            var sut = new FeatureBuilder(Internationalization.For(lang), string.Empty);

            sut.Keyword.Syntax.Should().Be(GherkinKeyword.Feature);
            sut.Keyword.Localised.Should().Be(expected);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GherkinLexer"/> class.
        /// </summary>
        /// <param name="sourceFilePath">The source file path.</param>
        /// <param name="featureFileReader">The feature file reader.</param>
        public GherkinLexer(string sourceFilePath, TextReader featureFileReader)
        {
            this.sourceFilePath = sourceFilePath;
            var contents = featureFileReader.ReadToEnd();

            this.language          = Internationalization.SetDefault().TryParse(contents);
            this.featureFileReader = new StringReader(contents);
        }
Beispiel #4
0
 /// <summary>
 /// Help selecting the active language translation
 /// </summary>
 /// <param name="htmlHelper"></param>
 /// <param name="en">Default text identifier</param>
 /// <param name="da"></param>
 /// <returns></returns>
 public static string DisplayUserLanguage(this HtmlHelper htmlHelper, string en, string da = "")
 {
     if (Internationalization.LanguageCode == "da")
     {
         return(da);
     }
     return(Internationalization.GetText(en, Internationalization.LanguageCode));
 }
Beispiel #5
0
        ///############################################################
        /// <summary>
        /// Populates the global variables holding the <c>Cn.Web</c> settings.
        /// </summary>
        /// <remarks>
        /// NOTE: This function relies on the default table names for the system settings ("cnInternationalization", "cnRendererConfiguration", "cnHolidayCalculations", and "cnPicklists"). If you have chosen to rename your system configuration tables, you will need to utilize this function's sibling implementation.
        /// <para/>NOTE: This function assumes that the Default Internationalization table name is "cnInternationalization".
        /// </remarks>
        /// <param name="oDBMS"><c>DBMS</c> instance representing an active connection to the related data source.</param>
        /// <param name="bInternationalizationDefaultData">Boolean value representing if the Default Internationalization global variable is to be updated.</param>
        /// <param name="bInternationalization">Boolean value representing if the <paramref>sSystemName</paramref>'s Internationalization global variable is to be updated.</param>
        /// <param name="bPicklists">Boolean value representing if the persistent Picklists's (named after the <paramref>sSystemName</paramref>) global variable is to be updated.</param>
        /// <param name="bMetaData">Boolean value representing if the <paramref>sSystemName</paramref>'s DataSource MetaData global variable is to be updated.</param>
        /// <param name="eDataSource">Enumeration representing the source the <paramref>oDataSourceMetaData</paramref> was generated from.</param>
        /// <param name="sDataSourceContainerName">String representing the name of the data source's container.</param>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eDataSource</paramref> is unsupported or unreconized.</exception>
        ///############################################################
        /// <LastUpdated>May 28, 2007</LastUpdated>
        public static void GetData(DBMS oDBMS, bool bInternationalizationDefaultData, bool bInternationalization, bool bPicklists, bool bMetaData, enumDataSource eDataSource, string sDataSourceContainerName)
        {
            string sInternationalizationDefaultDataTableName = "";
            string sInternationalizationTableName            = "";
            string sMetaDataTableName  = "";
            string sPicklistsTableName = "";

            //#### Setup the local s*TableName variables to the default names based on the passed information (skipping any set to false)
            if (bInternationalizationDefaultData)
            {
                sInternationalizationDefaultDataTableName = "cnInternationalization";
            }
            if (bInternationalization)
            {
                sInternationalizationTableName = "cnInternationalization";
            }
            if (bPicklists)
            {
                sPicklistsTableName = "cnPicklists";
            }
            if (bMetaData)
            {
                //#### Determine the eDataSource, setting sMetaDataTableName accordingly
                switch (eDataSource)
                {
                case enumDataSource.cnSQLServer: {
                    sMetaDataTableName = sDataSourceContainerName + ".INFORMATION_SCHEMA.COLUMNS";
                    break;
                }

                case enumDataSource.cnOracle: {
                    sMetaDataTableName = "all_tab_columns";
                    break;
                }

                //#### Else the passed eDataSource is unsupported or unreconized, so raise the error (based on the passed sSystemName)
                default: {
                    Internationalization.RaiseDefaultError(g_cClassName + "", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eDataSource", Data.Tools.MakeString(eDataSource, ""));
                    break;
                }
                }
            }

            //#### Pass the call off to our sibling implementation to do the actual work
            GetData(oDBMS,
                    sInternationalizationDefaultDataTableName,
                    sInternationalizationTableName,
                    sPicklistsTableName,
                    sMetaDataTableName,
                    eDataSource
                    );
        }
Beispiel #6
0
 ///############################################################
 /// <summary>
 /// Gets/sets the string value present at the referenced row/column (pseudo-parameterized property).
 /// </summary>
 /// <remarks>
 /// This is a pseudo-parameterized property implimentation. The overloaded pair of methods serve the same function as a parameterized property would.
 /// </remarks>
 /// <param name="sKey">String representing the desired key.</param>
 /// <param name="sNewValue">String representing the new value for the referenced key.</param>
 ///############################################################
 /// <LastUpdated>December 21, 2005</LastUpdated>
 public void Value(string sKey, string sNewValue)
 {
     //#### If the passed sKey is invalid, raise the error
     if (sKey == null || sKey.Length == 0 || sKey.IndexOf("=") > -1 || sKey.IndexOf("&") > -1 || sKey.IndexOf("%") > -1)
     {
         Internationalization.RaiseDefaultError(g_cClassName + "Value", Internationalization.enumInternationalizationValues.cnDeveloperMessages_CookieMonster_InvalidKeyName, sNewValue, "");
     }
     //#### Else the passed sKey is valid, so (re)set it's value within gh_sFields
     else
     {
         gh_sFields[sKey] = sNewValue;
     }
 }
Beispiel #7
0
        //##########################################################################################
        //# Public Functions
        //##########################################################################################
        ///############################################################
        /// <summary>
        /// Retrieves the requested Renderer configuration value.
        /// </summary>
        /// <param name="eSetting">Enumeration representing the required setting value.</param>
        /// <returns>String representing the requested configuration value.</returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eSetting</paramref> is unreconized.</exception>
        ///############################################################
        /// <LastUpdated>June 18, 2010</LastUpdated>
        public static string Value(enumSettingValues eSetting)
        {
            string sReturn = "";

            //#### Determine the value of the passed eSetting, setting our return value accordingly
            //####     NOTE: We utilize our own property for this so that the Configuration/Internationalization picklsit is initilized if it hasn't already been
            switch (eSetting)
            {
            case enumSettingValues.cnUIDirectoryURL: {
//				    sReturn = "http://" + HttpContext.Current.Request.ServerVariables["Server_Name"] + g_oRendererSettings.Decoder("GeneralSettings", "BaseDirectory") + "/";

                //#### Set our sReturn value to the .ProtocolHostPortURL plus the .cnUIDirectory
                sReturn = Web.Tools.ProtocolHostPortURL() + Specific.AppSettings("CnUIDirectory");
                break;
            }

            case enumSettingValues.cnUIDirectory: {
                sReturn = Specific.AppSettings("CnUIDirectory");
                break;
            }

            case enumSettingValues.cnDOMElementPrefix: {
                sReturn = Data.Tools.MakeString(Specific.AppSettings("DOMElementPrefix"), g_cDefaultDOMElementPrefix);
                break;
            }

            case enumSettingValues.cnHTMLPageBreak: {
                sReturn = Data.Tools.MakeString(Specific.AppSettings("HTMLPageBreak"), g_cDefaultHTMLPageBreak);
                break;
            }

            case enumSettingValues.cnCSSClass_PopUpErrorDIV: {
                sReturn = Data.Tools.MakeString(Specific.AppSettings("CSSClass_PopUpErrorDIV"), g_cDefaultCSSClass_PopUpErrorDIV);
                break;
            }

            case enumSettingValues.cnCSSClass_FormInputError: {
                sReturn = Data.Tools.MakeString(Specific.AppSettings("CSSClass_FormInputError"), g_cDefaultCSSClass_FormInputError);
                break;
            }

            //#### Else the passed eSetting was unreconized, so raise the error
            default: {
                Internationalization.RaiseDefaultError(g_cClassName + "Value", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eSetting", Data.Tools.MakeString(eSetting, "[?]"));
                break;
            }
            }

            //#### Return the above determined sReturn value to the caller
            return(sReturn);
        }
Beispiel #8
0
        //##########################################################################################
        //# Public Static Functions
        //##########################################################################################
        ///###############################################################
        /// <summary>
        /// Retrieves the associative array of data elements stored within the passed key/value pair structure.
        /// </summary>
        /// <param name="sKeysValues">String representing a QueryString-style key/value pair structure (i.e. - "key1=value1&amp;key2=value2&amp;key3=value3").</param>
        /// <returns>Hashtable where each index represents a key/value pair stored within the passed <paramref>sKeysValues</paramref>.</returns>
        ///###############################################################
        /// <LastUpdated>January 10, 2006</LastUpdated>
        public static Hashtable KeyValueString(string sKeysValues)
        {
            Hashtable h_sReturn = new Hashtable();

            string[] a_sKeyValuePairs;
            string[] a_sKeyValue;
            char[]   a_charEquals = { '=' };
            int      i;

            //#### Split the passed sKeysValues into its a_sKeyValuePairs
            a_sKeyValuePairs = sKeysValues.Split('&');

            //#### Traverse the a_sKeyValuePairs
            for (i = 0; i < a_sKeyValuePairs.Length; i++)
            {
                //#### Split the current a_sKeyValuePair apart into a key/value
                a_sKeyValue = a_sKeyValuePairs[i].Split(a_charEquals, 2);

                //#### If there is a key and a value defined
                if (a_sKeyValue.Length == 2)
                {
                    //#### If the current key is already within the h_sReturn, raise the error
                    if (h_sReturn.Contains(a_sKeyValue[0]))
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "ParseKeyValueString", Internationalization.enumInternationalizationValues.cnDeveloperMessages_CookieMonster_InvalidKeysValuesDuplicateKey, sKeysValues, a_sKeyValue[0]);
                    }
                    //#### Else the current key is (so far) unique, so .Add the Key with it's Value into g_hFields
                    else
                    {
                        h_sReturn.Add(a_sKeyValue[0], KeyValueStringDecoder(a_sKeyValue[1]));
                    }
                }
                //#### Else we have a malformed key definition, so raise the error, reset the return value and exit the loop
                else
                {
                    Internationalization.RaiseDefaultError(g_cClassName + "ParseKeyValueString", Internationalization.enumInternationalizationValues.cnDeveloperMessages_CookieMonster_InvalidKeysValues, sKeysValues, "");
                    h_sReturn.Clear();
                    break;
                }
            }

            //#### Return the above determined h_sReturn value to the caller
            return(h_sReturn);
        }
Beispiel #9
0
        protected override void Configure()
        {
            var logPath = LogSetup.GetLogsFolderPath("Logs");

            LogSetup.Execute();

            var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log");

            var logConfig = new LoggerConfiguration()
                            .WriteTo.Async(config =>
                                           config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000))
                            .SetDefaultLevel();

            Logger = Log.Logger = logConfig.CreateLogger();

            Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation);

            Internationalization.Initialize();
        }
        protected override void Configure()
        {
            LocalAppDataPath = Path.Combine(
                Environment.GetFolderPath(
                    Environment.SpecialFolder.LocalApplicationData,
                    Environment.SpecialFolderOption.DoNotVerify),
                ApplicationName);

            if (!Directory.Exists(LocalAppDataPath))
            {
                Directory.CreateDirectory(LocalAppDataPath);
            }

            AppDataPath = Path.Combine(
                Environment.GetFolderPath(
                    Environment.SpecialFolder.CommonApplicationData,
                    Environment.SpecialFolderOption.DoNotVerify),
                ApplicationName);

            Container = AutoFacConfiguration.RegisterAutoFac();
            var logPath = Path.Combine(AppDataPath, "Logs");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log");

            var logConfig = new LoggerConfiguration()
                            .WriteTo.Async(config => config.LiterateConsole())
                            .WriteTo.Async(config =>
                                           config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000))
                            .SetDefaultLevel();

            Logger = Log.Logger = logConfig.CreateLogger();

            Internationalization.Initialize();
        }
Beispiel #11
0
        private Result ContextMenuPluginInfo(string id)
        {
            PluginMetadata       metadata   = PluginManager.GetPluginForId(id).Metadata;
            Internationalization translator = InternationalizationManager.Instance;

            string author   = translator.GetTranslation("author");
            string website  = translator.GetTranslation("website");
            string version  = translator.GetTranslation("version");
            string plugin   = translator.GetTranslation("plugin");
            string title    = $"{plugin}: {metadata.Name}";
            string icon     = metadata.IcoPath;
            string subtitle =
                $"{author}: {metadata.Author}, {website}: {metadata.Website} {version}: {metadata.Version}";

            Result menu = new Result {
                Title           = title,
                IcoPath         = icon,
                SubTitle        = subtitle,
                PluginDirectory = metadata.PluginDirectory,
                Action          = _ => false
            };

            return(menu);
        }
Beispiel #12
0
        /// <inheritdoc />
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ThemeAssist.BundledTheme.Generate("ChocolateyGui");

            var configService          = Bootstrapper.Container.Resolve <IConfigService>();
            var effectiveConfiguration = configService.GetEffectiveConfiguration();

            ThemeMode themeMode;

            if (effectiveConfiguration.DefaultToDarkMode == null)
            {
                themeMode = ThemeMode.WindowsDefault;
            }
            else if (effectiveConfiguration.DefaultToDarkMode.Value)
            {
                themeMode = ThemeMode.Dark;
            }
            else
            {
                themeMode = ThemeMode.Light;
            }

            if (string.IsNullOrEmpty(effectiveConfiguration.UseLanguage))
            {
                Internationalization.Initialize();
                configService.SetConfigValue(nameof(effectiveConfiguration.UseLanguage), CultureInfo.CurrentCulture.Name);
            }
            else
            {
                Internationalization.UpdateLanguage(effectiveConfiguration.UseLanguage);
            }

            ThemeAssist.BundledTheme.SyncTheme(themeMode);
        }
Beispiel #13
0
        /// <summary>
        /// create by minzw
        /// 根据语言版本得到国际化的显示文本
        /// </summary>
        /// <param name="lang">语言版本</param>
        /// <param name="msgType">枚举类型</param>
        /// <returns></returns>
        public static Dictionary<string, string> GetSelectOption(AppLanguage lang, Internationalization interType)
        {
            switch (lang)
            {
                case AppLanguage.CN:
                    switch (interType)
                    {
                        case Internationalization.Common:
                            return _CommonCN;
                        case Internationalization.DataList:
                            return _DataListCN;
                        case Internationalization.Storage:
                            return _StorageCN;
                        case Internationalization.Purchasing:
                            return _PurchaseCN;
                        case Internationalization.OrderSys:
                            return _OrderCN;
                        case Internationalization.ProductSys:
                            return _ProductCN;
                        case Internationalization.StockSet:
                            return _StockCN;
                        case Internationalization.MyMenu:
                            return _MenuCN;
                        case Internationalization.Users:
                            return _UsersCN;
                        case Internationalization.PromManage:
                            return _PromManageCN;
                        case Internationalization.CustomerManage:
                            return _CusManageCN;
                        case Internationalization.WebsiteManage:
                            return _WebsiteManageCN;
                        case Internationalization.FinaceManage:
                            return _FinaceManageCN;
                        case Internationalization.SysSetup:
                            return _SysSetupCN;
                        case Internationalization.DeskTop:
                            return _DeskTopCN;
                        case Internationalization.WebCommon:
                            return _WebCommonCN;
                        case Internationalization.WebProduct:
                            return _WebProductCN;
                        case Internationalization.WebTuan:
                            return _WebTuanCN;
                        case Internationalization.WebTheme:
                            return _WebThemeCN;
                        case Internationalization.WebHelp:
                            return _WebHelpCN;
                        case Internationalization.WebAccout:
                            return _WebAccoutCN;
                    }
                    break;

                case AppLanguage.EN:
                    switch (interType)
                    {
                        case Internationalization.Common:
                            return _CommonEN;
                        case Internationalization.DataList:
                            return _DataListEN;
                        case Internationalization.Storage:
                            return _StorageEN;
                        case Internationalization.Purchasing:
                            return _PurchaseEN;
                        case Internationalization.OrderSys:
                            return _OrderEN;
                        case Internationalization.ProductSys:
                            return _ProductEN;
                        case Internationalization.StockSet:
                            return _StockEN;
                        case Internationalization.MyMenu:
                            return _MenuEN;
                        case Internationalization.Users:
                            return _UsersEN;
                        case Internationalization.PromManage:
                            return _PromManageEN;
                        case Internationalization.CustomerManage:
                            return _CusManageEN;
                        case Internationalization.WebsiteManage:
                            return _WebsiteManageEN;
                        case Internationalization.FinaceManage:
                            return _FinaceManageEN;
                        case Internationalization.SysSetup:
                            return _SysSetupEN;
                        case Internationalization.DeskTop:
                            return _DeskTopEN;
                        case Internationalization.WebCommon:
                            return _WebCommonEN;
                        case Internationalization.WebProduct:
                            return _WebProductEN;
                        case Internationalization.WebTuan:
                            return _WebTuanEN;
                        case Internationalization.WebTheme:
                            return _WebThemeEN;
                        case Internationalization.WebHelp:
                            return _WebHelpEN;
                        case Internationalization.WebAccout:
                            return _WebAccoutEN;
                    }
                    break;

                case AppLanguage.FR:
                    switch (interType)
                    {
                        case Internationalization.Common:
                            return _CommonFR;
                        case Internationalization.DataList:
                            return _DataListFR;
                        case Internationalization.Storage:
                            return _StorageFR;
                        case Internationalization.Purchasing:
                            return _PurchaseFR;
                        case Internationalization.OrderSys:
                            return _OrderFR;
                        case Internationalization.ProductSys:
                            return _ProductFR;
                        case Internationalization.StockSet:
                            return _StockFR;
                        case Internationalization.MyMenu:
                            return _MenuFR;
                        case Internationalization.Users:
                            return _UsersFR;
                        case Internationalization.PromManage:
                            return _PromManageFR;
                        case Internationalization.CustomerManage:
                            return _CusManageFR;
                        case Internationalization.WebsiteManage:
                            return _WebsiteManageFR;
                        case Internationalization.FinaceManage:
                            return _FinaceManageFR;
                        case Internationalization.SysSetup:
                            return _SysSetupFR;
                        case Internationalization.DeskTop:
                            return _DeskTopFR;
                        case Internationalization.WebCommon:
                            return _WebCommonFR;
                        case Internationalization.WebProduct:
                            return _WebProductFR;
                        case Internationalization.WebTuan:
                            return _WebTuanFR;
                        case Internationalization.WebTheme:
                            return _WebThemeFR;
                        case Internationalization.WebHelp:
                            return _WebHelpFR;
                        case Internationalization.WebAccout:
                            return _WebAccoutFR;
                    }
                    break;

                case AppLanguage.GE:
                    switch (interType)
                    {
                        case Internationalization.Common:
                            return _CommonGE;
                        case Internationalization.DataList:
                            return _DataListGE;
                        case Internationalization.Storage:
                            return _StorageGE;
                        case Internationalization.Purchasing:
                            return _PurchaseGE;
                        case Internationalization.OrderSys:
                            return _OrderGE;
                        case Internationalization.ProductSys:
                            return _ProductGE;
                        case Internationalization.StockSet:
                            return _StockGE;
                        case Internationalization.MyMenu:
                            return _MenuGE;
                        case Internationalization.Users:
                            return _UsersGE;
                        case Internationalization.PromManage:
                            return _PromManageGE;
                        case Internationalization.CustomerManage:
                            return _CusManageGE;
                        case Internationalization.WebsiteManage:
                            return _WebsiteManageGE;
                        case Internationalization.FinaceManage:
                            return _FinaceManageGE;
                        case Internationalization.SysSetup:
                            return _SysSetupGE;
                        case Internationalization.DeskTop:
                            return _DeskTopGE;
                        case Internationalization.WebCommon:
                            return _WebCommonGE;
                        case Internationalization.WebProduct:
                            return _WebProductGE;
                        case Internationalization.WebTuan:
                            return _WebTuanGE;
                        case Internationalization.WebTheme:
                            return _WebThemeGE;
                        case Internationalization.WebHelp:
                            return _WebHelpGE;
                        case Internationalization.WebAccout:
                            return _WebAccoutGE;
                    }
                    break;

                case AppLanguage.IT:
                    switch (interType)
                    {
                        case Internationalization.Common:
                            return _CommonIT;
                        case Internationalization.DataList:
                            return _DataListIT;
                        case Internationalization.Storage:
                            return _StorageIT;
                        case Internationalization.Purchasing:
                            return _PurchaseIT;
                        case Internationalization.OrderSys:
                            return _OrderIT;
                        case Internationalization.ProductSys:
                            return _ProductIT;
                        case Internationalization.StockSet:
                            return _StockIT;
                        case Internationalization.MyMenu:
                            return _MenuIT;
                        case Internationalization.Users:
                            return _UsersIT;
                        case Internationalization.PromManage:
                            return _PromManageIT;
                        case Internationalization.CustomerManage:
                            return _CusManageIT;
                        case Internationalization.WebsiteManage:
                            return _WebsiteManageIT;
                        case Internationalization.FinaceManage:
                            return _FinaceManageIT;
                        case Internationalization.SysSetup:
                            return _SysSetupIT;
                        case Internationalization.DeskTop:
                            return _DeskTopIT;
                        case Internationalization.WebCommon:
                            return _WebCommonIT;
                        case Internationalization.WebProduct:
                            return _WebProductIT;
                        case Internationalization.WebTuan:
                            return _WebTuanIT;
                        case Internationalization.WebTheme:
                            return _WebThemeIT;
                        case Internationalization.WebHelp:
                            return _WebHelpIT;
                        case Internationalization.WebAccout:
                            return _WebAccoutIT;
                    }
                    break;

            }
            return null;
        }
Beispiel #14
0
 public static string GetMessage(AppLanguage lang, Internationalization interType, string messageID)
 {
     string revalue = "";
     try
     {
         switch (lang)
         {
             case AppLanguage.CN:
                 revalue = GetMessageCN(interType, messageID);
                 break;
             case AppLanguage.EN:
                 revalue = GetMessageEN(interType, messageID);
                 break;
             case AppLanguage.FR:
                 revalue = GetMessageFR(interType, messageID);
                 break;
             case AppLanguage.GE:
                 revalue = GetMessageGE(interType, messageID);
                 break;
             case AppLanguage.IT:
                 revalue = GetMessageIT(interType, messageID);
                 break;
         }
     }
     catch
     {
         return "错误节点位置:" + Enum.GetName(typeof(ZKEShop.Common.Internationalization), interType) + "-" + messageID.ToString();
         //return "错误错误错误" +  messageID.ToString();
     }
     return revalue;
 }
Beispiel #15
0
 private string _(string resourceId)
 {
     return(Internationalization.GetText(resourceId, Internationalization.LanguageCode));
 }
Beispiel #16
0
        static string GetMessageIT(Internationalization interType, string messageID)
        {
            switch (interType)
            {
                case Internationalization.Common:
                    return _CommonIT[messageID];
                case Internationalization.DataList:
                    return _DataListIT[messageID];
                case Internationalization.Storage:
                    return _StorageIT[messageID];
                case Internationalization.Purchasing:
                    return _PurchaseIT[messageID];
                case Internationalization.OrderSys:
                    return _OrderIT[messageID];
                case Internationalization.ProductSys:
                    return _ProductIT[messageID];
                case Internationalization.StockSet:
                    return _StockIT[messageID];
                case Internationalization.MyMenu:
                    return _MenuIT[messageID];
                case Internationalization.Users:
                    return _UsersIT[messageID];
                case Internationalization.PromManage:
                    return _PromManageIT[messageID];
                case Internationalization.CustomerManage:
                    return _CusManageIT[messageID];
                case Internationalization.WebsiteManage:
                    return _WebsiteManageIT[messageID];
                case Internationalization.FinaceManage:
                    return _FinaceManageIT[messageID];
                case Internationalization.SysSetup:
                    return _SysSetupIT[messageID];
                case Internationalization.DeskTop:
                    return _DeskTopIT[messageID];
                case Internationalization.WebCommon:
                    return _WebCommonIT[messageID];
                case Internationalization.WebProduct:
                    return _WebProductIT[messageID];
                case Internationalization.WebTuan:
                    return _WebTuanIT[messageID];
                case Internationalization.WebTheme:
                    return _WebThemeIT[messageID];
                case Internationalization.WebHelp:
                    return _WebHelpIT[messageID];
                case Internationalization.WebAccout:
                    return _WebAccoutIT[messageID];

                case Internationalization.FunctionID:
                    return _FunctionIDIT[messageID];
                default:
                    return "暂时还未初始化数据,应该在SystemFramework.MsgConfig类中初始化!";
            }
        }
Beispiel #17
0
        //##########################################################################################
        //# Private Static Functions
        //##########################################################################################
        ///############################################################
        /// <summary>
        /// Returns the requested JavaScript file references.
        /// </summary>
        /// <remarks>
        /// NOTE: <c>cnCnRendererComplexSorter</c> is not yet implemented.
        /// </remarks>
        /// <param name="eJavaScriptFile">Enumeration representing the JavaScript/DHTML code to return.</param>
        /// <param name="iRenderedJavaScriptFiles">Reference to an integer representing a bitwise value indicating which JavaScript file references have been rendered previously.</param>
        /// <param name="sEndUserMessagesLanguageCode">String representing the end user's ISO639 2-letter language code.</param>
        /// <param name="sPath">String representing the path from the web oRootDir to the JavaScript oFiles.</param>
        /// <param name="sCRLF">String representing the line break character(s) to be included in the return value.</param>
        /// <returns>String representing the required JavaScript file script block(s) for the referenced <paramref>eJavaScriptFile</paramref>.</returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eJavaScriptFile</paramref> is unreconized.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eJavaScriptFile</paramref> is <c>cnRenderAllJavaScript</c> and the passed <paramref>iRenderedJavaScriptFiles</paramref> signanifies that some or all of the JavaScript file script blocks have been rendered previously.</exception>
        ///############################################################
        /// <LastUpdated>March 3, 2010</LastUpdated>
        private static string DoGetScriptReferences(enumJavaScriptFiles eJavaScriptFile, ref int iRenderedJavaScriptFiles, string sEndUserMessagesLanguageCode, string sPath, string sCRLF, bool bDebug)
        {
            string sReturn = "";

            //#### As long as the iRenderedJavaScriptFiles is not set to .cnDisableJavaScriptRendering and the passed eJavaScriptFile has not yet been rendered
            if (iRenderedJavaScriptFiles != (int)enumJavaScriptFiles.cnDisableJavaScriptRendering && (iRenderedJavaScriptFiles & (int)eJavaScriptFile) == 0)
            {
                //#### Determine the passed eJavaScriptFile and process accordingly
                switch (eJavaScriptFile)
                {
                //#### If this is a .cnCn eJavaScriptFile request, reset the sReturn value accordingly
                case enumJavaScriptFiles.cnCn: {
                    sReturn = "<script type='text/javascript' src='" + sPath + "Cn/Cn.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Cn.js." + g_cServerSideScriptFileExtension + "'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnTools eJavaScriptFile request
                case enumJavaScriptFiles.cnCnTools: {
                    //#### Recurse to collect the JavaScript for .cnCn and .cnYUIDOM (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Most of the .cnCn* calls below rely on the call below in order to collect their own copy of .cnCn
                    //####     NOTE: Since .cnYUIDOM also requires .cnYUI, it is not included below (as the .cnYUIDOM call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIDOM, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Data/Tools.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Tools.js'></script>" + sCRLF;
                    break;
                }

                //##########
                //##########

                //#### If this is a .cnCnInputs eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputs: {
                    //#### Recurse to collect the JavaScript for .cnCn and .cnCnTools (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnTools call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/Inputs.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnInputsValidation eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsValidation: {
                    //#### Recurse to collect the JavaScript for .cnCn, .cnCnTools, .cnCnInputs and .cnYUIDOM (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnTools call will pick it up)
                    //####     NOTE: Since .cnYUIDOM also requires .cnYUI, it is not included below (as the .cnYUIDOM call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnInputs, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIDOM, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/Validation.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/Validation.js." + g_cServerSideScriptFileExtension +
                              "?LanguageCode=" + sEndUserMessagesLanguageCode +
                              "'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnInputsDateTime eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsDateTime: {
                    //#### Recurse to collect the JavaScript for .cnCn, .cnCnTools and .cnYUICalendar (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnSettings call will pick it up)
                    //####     NOTE: Since .cnYUICalendar also requires .cnYUI, it is not included below (as the .cnYUICalendar call will pick it up)
                    //####     NOTE: SystemName and LanguageCode are passed in via the QueryString because they are used by the server-side script
                    //####     NOTE: WeekOfYearCalculation is passed in via the QueryString because it is defined programaticially by the Developer at runtime
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUICalendar, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Dates/Tools.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/DateTime.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/DateTime.js." + g_cServerSideScriptFileExtension +
                              "?LanguageCode=" + sEndUserMessagesLanguageCode +
                              "'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "Cn/Dates/Tools.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnInputsComboBox eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsComboBox: {
                    //#### Recurse to collect the JavaScript for .cnCn and .cnCnTools (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnSettings call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/ComboBox.js'></script>" + sCRLF;
                    break;
                }

//! neek
                //#### If this is a .cnCnInputsHTMLEditor eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsHTMLEditor: {
                    //#### Recurse to collect the JavaScript for .cnCn, .cnCnTools and .cnYUIRichTextEditor (as it is required for this eJavaScriptFile) before appending the script tag
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIRichTextEditor, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/HTMLEditor.js'></script>" + sCRLF;
                    break;
                }

//! neek
                //#### If this is a .cnCnInputsMaxLength eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsMaxLength: {
                    //#### Recurse to collect the JavaScript for .cnCnTools, .cnCnInputs, .cnCnInputsValidation and .cnYUIEvent (as it is required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnTools also requires .cnCn, it is not included below (as the .cnCnTools call will pick it up)
                    //####     NOTE: Since .cnYUIEvent also requires .cnYUI, it is not included below (as the .cnYUIEvent call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnInputs, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnInputsValidation, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/MaxLength.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnInputsRadio eJavaScriptFile request
                case enumJavaScriptFiles.cnCnInputsRadio: {
                    //#### Recurse to collect the JavaScript for .cnCnTools and .cnYUIEvent (as it is required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnTools also requires .cnCn, it is not included below (as the .cnCnTools call will pick it up)
                    //####     NOTE: Since .cnYUIEvent also requires .cnYUI, it is not included below (as the .cnYUIEvent call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCnTools, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Inputs/Radio.js'></script>" + sCRLF;
                    break;
                }

                //##########
                //##########

                //#### If this is a .cnCnRendererForm eJavaScriptFile request
                case enumJavaScriptFiles.cnCnRendererForm: {
                    //#### Recurse to collect the JavaScript for .cnCn, .cnCnInputs and .cnCnInputsValidation (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnSettings call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnInputs, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnCnInputsValidation, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Renderer/Form.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnRendererComplexSorter eJavaScriptFile request
                case enumJavaScriptFiles.cnCnRendererComplexSorter: {
//!						sReturn += "<script type='text/javascript' src='" + sBaseDirectory + "Cn/Web/Renderer/ComplexSorter.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnCnRendererUserSelectedStack eJavaScriptFile request
                case enumJavaScriptFiles.cnCnRendererUserSelectedStack: {
                    //#### Recurse to collect the JavaScript for .cnCn (as it is required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnCnSettings also requires .cnCn, it is not included below (as the .cnCnSettings call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnCn, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "Cn/Web/Renderer/UserSelectedStack.js'></script>"
                    ;
                    break;
                }

                //##########
                //##########

                //#### If this is a .cnYUIRichTextEditor eJavaScriptFile request
                case enumJavaScriptFiles.cnYUIRichTextEditor: {
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              DoGetScriptReferences(enumJavaScriptFiles.cnYUIDOM, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "yui/element.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "yui/container.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "yui/simpleeditor.js'></script>" + sCRLF +

                              "<script type='text/javascript' src='" + sPath + "yui/menu.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "yui/button.js'></script>" + sCRLF +
                              "<script type='text/javascript' src='" + sPath + "yui/editor.js'></script>" + sCRLF +
                              "<link rel='stylesheet' type='text/css' href='" + sPath + "yui/editor-core.css' />"
                    ;
                    break;
                }

                //##########
                //##########

                //#### If this is a .cnYUI eJavaScriptFile request, reset the sReturn value accordingly
                case enumJavaScriptFiles.cnYUI: {
                    sReturn = "<script type='text/javascript' src='" + sPath + "yui/yahoo.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnYUICalendar eJavaScriptFile request
                case enumJavaScriptFiles.cnYUICalendar: {
                    //#### Recurse to collect the JavaScript for .cnYUI and .cnYUIEvent (as they are required for this eJavaScriptFile) before appending the script tag
                    //####     NOTE: Since .cnYUIEvent also requires .cnYUI, it is not included below (as the .cnYUIEvent call will pick it up)
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnYUIEvent, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "yui/calendar.js'></script>" + sCRLF +
                              "<link rel='stylesheet' type='text/css' href='" + sPath + "yui/calendar.css' />"
                    ;
                    break;
                }

                //#### If this is a .cnYUIEvent eJavaScriptFile request
                case enumJavaScriptFiles.cnYUIEvent: {
                    //#### Recurse to collect the JavaScript for .cnYUI (as it is required for this eJavaScriptFile) before appending the script tag
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnYUI, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "yui/event.js'></script>" + sCRLF;
                    break;
                }

                //#### If this is a .cnYUIDOM eJavaScriptFile request
                case enumJavaScriptFiles.cnYUIDOM: {
                    //#### Recurse to collect the JavaScript for .cnYUI (as it is required for this eJavaScriptFile) before appending the script tag
                    sReturn = DoGetScriptReferences(enumJavaScriptFiles.cnYUI, ref iRenderedJavaScriptFiles, sEndUserMessagesLanguageCode, sPath, sCRLF, bDebug) +
                              "<script type='text/javascript' src='" + sPath + "yui/dom.js'></script>" + sCRLF;
                    break;
                }

                //##########
                //##########

                //#### If this is a .cnRenderAllJavaScript eJavaScriptFile request
                case enumJavaScriptFiles.cnRenderAllJavaScript: {
                    //#### If no other JavaScript has been previously rendered
                    if (iRenderedJavaScriptFiles == 0)
                    {
                        //#### Reset the value of the sPath to ensure that we are not looking at the /Debug path
                        sPath = Settings.Value(Settings.enumSettingValues.cnUIDirectory) + g_cJavaScriptDirectory;

                        //#### Set the sReturn value to the required all/ .js oFiles
                        //####     NOTE: Since there is no Debug/ version of the all/ .js oFiles, the value of sPath is not utilized below
                        //####     NOTE: SystemName and LanguageCode are passed in via the QueryString because they are used by the server-side script
//! neek - debug hard coded!!
//								"<script type='text/javascript' src='" + sPath + "JS.aspx?Mode=Cn&Debug=" + bDebug + "&LanguageCode=" + sEndUserMessagesLanguageCode + "'></script>" + sCRLF +

                        sReturn = "<script type='text/javascript' src='" + sPath + "JS.aspx?Mode=YUI&Debug=true'></script>" + sCRLF +
                                  "<script type='text/javascript' src='" + sPath + "JS.aspx?Mode=Cn&Debug=true&LanguageCode=" + sEndUserMessagesLanguageCode + "'></script>" + sCRLF +
                                  "<script type='text/javascript' src='" + sPath + "JS.aspx?Mode=CSS&Debug=true'></script>"
                        ;

                        //#### Set the .RenderedJavaScriptFiles to .cnDisableJavaScriptRendering (as no further JavaScript is to be rendered and .cnDisableJavaScriptRendering gives us this effect)
                        iRenderedJavaScriptFiles = (int)enumJavaScriptFiles.cnDisableJavaScriptRendering;
                    }
                    //#### Else some JavaScript oFiles have been previously rendered, so raise the error
                    else
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "JavaScript", Internationalization.enumInternationalizationValues.cnDeveloperMessages_Renderer_RenderedJavaScript, "", "");
                    }
                    break;
                }

                //#### If this is a .cnDisableJavaScriptRendering eJavaScriptFile request
                case enumJavaScriptFiles.cnDisableJavaScriptRendering: {
                    iRenderedJavaScriptFiles = (int)enumJavaScriptFiles.cnDisableJavaScriptRendering;
                    break;
                }

                //#### Else the eJavaScriptFile was unreconized, so raise the error
                default: {
                    Internationalization.RaiseDefaultError(g_cClassName + "JavaScript", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eJavaScriptFile", Data.Tools.MakeString(eJavaScriptFile, ""));
                    break;
                }
                }

                //#### If the .RenderedJavaScriptFiles is not set to .cnDisableJavaScriptRendering
                if (iRenderedJavaScriptFiles != (int)enumJavaScriptFiles.cnDisableJavaScriptRendering)
                {
                    //#### Flip the eJavaScriptFile bit within the .RenderedJavaScriptFiles
                    iRenderedJavaScriptFiles = (iRenderedJavaScriptFiles | (int)eJavaScriptFile);
                }
            }

            //#### Return the above determined sReturn value to the caller
            return(sReturn);
        }
Beispiel #18
0
        ///############################################################
        /// <summary>
        /// Creates a SQL DELETE statement based on the provided data.
        /// </summary>
        /// <param name="sTableName">String representing the table name to target.</param>
        /// <param name="a_oColumns">ColumnDescription array where each index represents a single column to be represented within the statement.</param>
        /// <returns>String value containing the requested SQL DELETE statement.</returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>sTableName</paramref> contains macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> is null or contains no columns.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains one or more <c>ColumnName</c>s containing macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains no columns defining the WHERE clause (columns defined as non-insertable/updateable).</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains one or more unreconized <c>Operator</c>s.</exception>
        ///############################################################
        /// <LastUpdated>February 15, 2006</LastUpdated>
        public static string Delete(string sTableName, ColumnDescription[] a_oColumns)
        {
            string sOperator;
            string sReturn = "";
            int    i;

            //#### If the caller passed in a_oColumns to traverse
            if (a_oColumns != null && a_oColumns.Length > 0)
            {
                //#### If the passed sTableName is safe
                if (IsUserDataSafe(sTableName))
                {
                    //#### Traverse the passed a_oColumns
                    for (i = 0; i < a_oColumns.Length; i++)
                    {
                        //#### If the current .ColumnName is safe
                        if (IsUserDataSafe(a_oColumns[i].ColumnName))
                        {
                            //#### If this is a .IsWhereClauseColumn
                            if (a_oColumns[i].IsWhereClauseColumn)
                            {
                                //#### Determine the sOperator for the current a_oColumn
                                sOperator = TranslateOperator("Delete", a_oColumns[i].Operator);

                                //#### If we are supposed to .Quote(the)Value (i.e. - this is a string-based type)
                                if (a_oColumns[i].Quote)
                                {
                                    //#### Append the .ColumnName and the PadSQL'd .Value onto the sReturn value
                                    sReturn += " AND " + a_oColumns[i].ColumnName + sOperator + "'" + FormatForSQL(a_oColumns[i].Value, false) + "'";
                                }
                                //#### Else this must be a numeric (or otherwise non-quotable) value
                                else
                                {
                                    //#### If the .Value .Is(a)Numeric
                                    //####     NOTE: Since .IsNumeric traverses the sValue one character at a time (and therefore does not convert it into a numeric type), there is no issue with overflow errors
                                    if (Data.Tools.IsNumeric(a_oColumns[i].Value))
                                    {
                                        //#### Append the .ColumnName and the .Value onto the sReturn value
                                        //####     NOTE: We do a PadSQL below in order to avoid security issues. If this is indeed a numeric value, then .Value will not be changed by PadSQL. If it is a malicious attack, it will fail (as will the statement probably).
                                        sReturn += " AND " + a_oColumns[i].ColumnName + sOperator + FormatForSQL(a_oColumns[i].Value, false);
                                    }
                                }
                            }
                        }
                        //#### Else the current .ColumnName seems to contain macilious code, so raise the error
                        else
                        {
                            Internationalization.RaiseDefaultError(g_cClassName + "Delete", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                        }
                    }

                    //#### If the sReturn was never set above, raise the error
                    if (sReturn.Length == 0)
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "Delete", Internationalization.enumInternationalizationValues.cnDeveloperMessages_DbTools_WhereClauseRequired, "a_oColumns", "");
                    }
                    //#### Else we have all the data we need to build the statement
                    else
                    {
                        //#### Coalesce the above created sReturn (while removing its leading " AND ", hence 5), storing the return value back into the sReturn value
                        sReturn = "DELETE FROM " + sTableName + " WHERE " + sReturn.Substring(5);
                    }
                }
                //#### Else the passed sTableName seems to contain macilious code, so raise the error
                else
                {
                    Internationalization.RaiseDefaultError(g_cClassName + "Delete", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                }
            }
            //#### Else the passed a_oColumns is empty, so raise the error
            else
            {
                Internationalization.RaiseDefaultError(g_cClassName + "Delete", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_ValueRequired, "a_oColumns", "");
            }

            //#### Return the above determiend sReturn value to the caller
            return(sReturn);
        }
Beispiel #19
0
        //#######################################################################################################
        //# Private Functions
        //#######################################################################################################
        ///############################################################
        /// <summary>
        /// Translates the provided comparison operator into the actual operator.
        /// </summary>
        /// <param name="sFunction">String representing the calling function's name.</param>
        /// <param name="eValueOperator">Enumeration representing the comparison operator.</param>
        /// <returns></returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eValueOperator</paramref> is unreconized or defines a insertable/updateable column.</exception>
        ///############################################################
        /// <LastUpdated>September 13, 2005</LastUpdated>
        private static string TranslateOperator(string sFunction, enumValueOperators eValueOperator)
        {
            string sReturn = "";

            //#### Determine the passed eValueOperator then set the sReturn value accordingly
            switch (eValueOperator)
            {
            case enumValueOperators.cnWhereEqualTo: {
                sReturn = "=";
                break;
            }

            case enumValueOperators.cnWhereGreaterThen: {
                sReturn = ">";
                break;
            }

            case enumValueOperators.cnWhereGreaterThenOrEqualTo: {
                sReturn = ">=";
                break;
            }

            case enumValueOperators.cnWhereIsNotNull: {
                sReturn = "IS NOT NULL";
                break;
            }

            case enumValueOperators.cnWhereIsNull: {
                sReturn = "IS NULL";
                break;
            }

            case enumValueOperators.cnWhereLessThen: {
                sReturn = "<";
                break;
            }

            case enumValueOperators.cnWhereLessThenOrEqualTo: {
                sReturn = "<=";
                break;
            }

            case enumValueOperators.cnWhereLike: {
                sReturn = "LIKE";
                break;
            }

            case enumValueOperators.cnWhereNotEqualTo: {
                sReturn = "!=";
                break;
            }

            case enumValueOperators.cnWhereNotLike: {
                sReturn = "NOT LIKE";
                break;
            }

//				case enumValueOperators.cnIgnore:
//				case enumValueOperators.cnInsertIfPresent:
//				case enumValueOperators.cnInsertNull:
//				case enumValueOperators.cnInsertNullString:
            default: {
                Internationalization.RaiseDefaultError(g_cClassName + sFunction, Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eValueOperator", eValueOperator.ToString());
                break;
            }
            }

            //#### Return the above determiend sReturn value to the caller
            return(sReturn);
        }
Beispiel #20
0
/*	    '###############################################################
 *          '# Removes all _DisallowedUserStrings and _DisallowedUserWords (as defined in RendererCore.custom.asp) with "", returning the resulting string
 *          '###############################################################
 *          '# Last Updated: June 23, 2004
 *          Public Function CleanSQL(ByVal sValue)
 *              Dim i
 *
 *                  '#### Default the return value to the normalized sValue
 *              CleanSQL = Normalize(sValue)
 *
 *                  '#### Traverse aRD_DisallowedUserStrings, replacing each _DisallowedUserString as we go
 *              For i = 0 To UBound(aRD_DisallowedUserStrings)
 *                  CleanSQL = Replace(CleanSQL, aRD_DisallowedUserStrings(i), "", 1, -1, vbTextCompare)
 *              Next
 *
 *                  '#### Traverse aRD_DisallowedUserWords, replacing each _DisallowedUserWord as we go
 *              For i = 0 To UBound(aRD_DisallowedUserWords)
 *                  CleanSQL = Replace(CleanSQL, " " & aRD_DisallowedUserWords(i) & " ", " ", 1, -1, vbTextCompare)
 *              Next
 *          End Function
 */

        //##########################################################################################
        //# Public Build*Statement-related Functions
        //##########################################################################################
        ///############################################################
        /// <summary>
        /// Creates a SQL INSERT statement based on the provided data.
        /// </summary>
        /// <param name="sTableName">String representing the table name to target.</param>
        /// <param name="a_oColumns">ColumnDescription array where each index represents a single column to be represented within the statement.</param>
        /// <returns>String value containing the requested SQL INSERT statement.</returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>sTableName</paramref> contains macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> is null or contains no columns.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains one or more <c>ColumnName</c>'s containing macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains no columns defined as insertable/updateable.</exception>
        ///############################################################
        /// <LastUpdated>March 1, 2006</LastUpdated>
        public static string Insert(string sTableName, ColumnDescription[] a_oColumns)
        {
            string sInsertValues = "";
            string sReturn       = "";
            int    i;
            bool   bColumnsPresent = false;

            //#### If the caller passed in a_oColumns to traverse
            if (a_oColumns != null && a_oColumns.Length > 0)
            {
                //#### If the passed sTableName is safe
                if (IsUserDataSafe(sTableName))
                {
                    //#### Traverse the passed a_oColumns
                    for (i = 0; i < a_oColumns.Length; i++)
                    {
                        //#### If the current .ColumnName is safe
                        if (IsUserDataSafe(a_oColumns[i].ColumnName))
                        {
                            //#### As long as this is an .IsInsertOrUpdateColumn
                            if (a_oColumns[i].IsInsertOrUpdateColumn)
                            {
                                //#### Flip the value of bColumnsPresent to true
                                bColumnsPresent = true;

                                //#### If the .Value is a null-string
                                if (a_oColumns[i].Value.Length == 0)
                                {
                                    //#### Determine the current a_oColumns' .Operator and process accordingly
                                    switch (a_oColumns[i].Operator)
                                    {
                                    case enumValueOperators.cnInsertNull: {
                                        //#### Append the .ColumnName and the NULL .Value onto the sReturn value
                                        sReturn       += "," + a_oColumns[i].ColumnName;
                                        sInsertValues += ",NULL";
                                        break;
                                    }

                                    case enumValueOperators.cnInsertNullString: {
                                        //#### Append the .ColumnName and the null-string .Value onto the sReturn value
                                        sReturn       += "," + a_oColumns[i].ColumnName;
                                        sInsertValues += ",''";
                                        break;
                                    }
                                    }
                                }
                                //#### Else there is a .Value to insert
                                else
                                {
                                    //#### If we are supposed to .Quote(the)Value (i.e. - this is a string-based type)
                                    if (a_oColumns[i].Quote)
                                    {
                                        //#### Append the .ColumnName onto the sReturn value and the FormatForSQL'd .Value onto sInsertValues
                                        sReturn       += "," + a_oColumns[i].ColumnName;
                                        sInsertValues += ",'" + FormatForSQL(a_oColumns[i].Value, false) + "'";
                                    }
                                    //#### Else this must be a numeric (or otherwise non-quotable) value
                                    else
                                    {
                                        //#### Append the .ColumnName onto the sReturn value and the FormatForSQL'd .Value onto sInsertValues
                                        //####     NOTE: We do a FormatForSQL below in order to avoid security issues. If this is indeed a numeric (or otherwise non-quotable) value, then .Value will not be changed by FormatForSQL. If it is a malicious attack, it will fail (as will the statement probably).
                                        sReturn       += "," + a_oColumns[i].ColumnName;
                                        sInsertValues += "," + FormatForSQL(a_oColumns[i].Value, false);
                                    }
                                }
                            }
                        }
                        //#### Else the current .ColumnName seems to contain macilious code, so raise the error
                        else
                        {
                            Internationalization.RaiseDefaultError(g_cClassName + "Insert", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                        }
                    }

                    //#### If insertable/updateable bColumns(were)Present
                    if (bColumnsPresent)
                    {
                        //#### Coalesce the above created sInsertValues back into the return value (while removing their leading ","s)
                        sReturn = "INSERT INTO " + sTableName + " (" + sReturn.Substring(1) + ") VALUES (" + sInsertValues.Substring(1) + ")";
                    }
                    //#### Else no insertable/updateable bColumns(were)Present, so raise the error
                    else
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "Insert", Internationalization.enumInternationalizationValues.cnDeveloperMessages_DbTools_InsertUpdateColumnsRequired, "a_oColumns", "");
                    }
                }
                //#### Else the passed sTableName seems to contain macilious code, so raise the error
                else
                {
                    Internationalization.RaiseDefaultError(g_cClassName + "Insert", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                }
            }
            //#### Else the passed a_oColumns is empty, so raise the error
            else
            {
                Internationalization.RaiseDefaultError(g_cClassName + "Insert", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_ValueRequired, "a_oColumns", "");
            }

            //#### Return the above determiend sReturn value to the caller
            return(sReturn);
        }
Beispiel #21
0
        private async void OnActivated(object sender, ActivationEventArgs activationEventArgs)
        {
            _config = _configService.GetEffectiveConfiguration();

            var chocolateyFeatures = await _chocolateyService.GetFeatures();

            foreach (var chocolateyFeature in chocolateyFeatures)
            {
#if !DEBUG // We hide this during DEBUG as it is a dark feature
                var descriptionKey = "Chocolatey_" + chocolateyFeature.Name + "Description";

                var newDescription = _translationSource[descriptionKey];

                if (string.IsNullOrEmpty(newDescription))
                {
                    descriptionKey = chocolateyFeature.Description;
                    newDescription = _translationSource[descriptionKey];
                }

                if (!string.IsNullOrEmpty(newDescription))
                {
                    chocolateyFeature.Description       = newDescription;
                    _translationSource.PropertyChanged += (s, e) =>
                    {
                        chocolateyFeature.Description = _translationSource[descriptionKey];
                    };
                }
#endif
                ChocolateyFeatures.Add(chocolateyFeature);
            }

            _changedChocolateyFeature = new Subject <ChocolateyFeature>();
            _changedChocolateyFeature
            .Select(f => Observable.FromAsync(() => UpdateChocolateyFeature(f)))
            .Concat()
            .Subscribe();

            var chocolateySettings = await _chocolateyService.GetSettings();

            foreach (var chocolateySetting in chocolateySettings)
            {
#if !DEBUG // We hide this during DEBUG as it is a dark feature
                var descriptionKey = "Chocolatey_" + chocolateySetting.Key + "Description";

                var newDescription = _translationSource[descriptionKey];

                if (string.IsNullOrEmpty(newDescription))
                {
                    descriptionKey = chocolateySetting.Description;
                    newDescription = _translationSource[descriptionKey];
                }

                if (!string.IsNullOrEmpty(newDescription))
                {
                    chocolateySetting.Description       = newDescription;
                    _translationSource.PropertyChanged += (s, e) =>
                    {
                        chocolateySetting.Description = _translationSource[descriptionKey];
                    };
                }
#endif
                ChocolateySettings.Add(chocolateySetting);
            }

            _changedChocolateySetting = new Subject <ChocolateySetting>();
            _changedChocolateySetting
            .Select(s => Observable.FromAsync(() => UpdateChocolateySetting(s)))
            .Concat()
            .Subscribe();

            var chocolateyGuiFeatures = _configService.GetFeatures(global: false, useResourceKeys: true);
            foreach (var chocolateyGuiFeature in chocolateyGuiFeatures)
            {
                chocolateyGuiFeature.DisplayTitle = _translationSource["ChocolateyGUI_" + chocolateyGuiFeature.Title + "Title"];
#if DEBUG
                var descriptionKey = string.Empty;
#else
                var descriptionKey = "ChocolateyGUI_" + chocolateyGuiFeature.Title + "Description";
#endif

                var newDescription = _translationSource[descriptionKey];

                if (string.IsNullOrEmpty(newDescription))
                {
                    descriptionKey = chocolateyGuiFeature.Description;
                    newDescription = _translationSource[descriptionKey];
                }

                if (!string.IsNullOrEmpty(newDescription))
                {
                    chocolateyGuiFeature.Description    = newDescription;
                    _translationSource.PropertyChanged += (s, e) =>
                    {
                        chocolateyGuiFeature.DisplayTitle = _translationSource["ChocolateyGUI_" + chocolateyGuiFeature.Title + "Title"];
                        chocolateyGuiFeature.Description  = _translationSource[descriptionKey];
                    };
                }

                ChocolateyGuiFeatures.Add(chocolateyGuiFeature);
            }

            _changedChocolateyGuiFeature = new Subject <ChocolateyGuiFeature>();
            _changedChocolateyGuiFeature
            .Select(s => Observable.FromAsync(() => UpdateChocolateyGuiFeature(s)))
            .Concat()
            .Subscribe();

            var chocolateyGuiSettings = _configService.GetSettings(global: false, useResourceKeys: true);
            foreach (var chocolateyGuiSetting in chocolateyGuiSettings.Where(c => !string.Equals(c.Key, nameof(UseLanguage), StringComparison.OrdinalIgnoreCase)))
            {
                chocolateyGuiSetting.DisplayName = _translationSource["ChocolateyGUI_" + chocolateyGuiSetting.Key + "Title"];
#if DEBUG
                var descriptionKey = string.Empty;
#else
                var descriptionKey = "ChocolateyGUI_" + chocolateyGuiSetting.Key + "Description";
#endif

                var newDescription = _translationSource[descriptionKey];

                if (string.IsNullOrEmpty(newDescription))
                {
                    descriptionKey = chocolateyGuiSetting.Description;
                    newDescription = _translationSource[descriptionKey];
                }

                if (!string.IsNullOrEmpty(newDescription))
                {
                    chocolateyGuiSetting.Description    = newDescription;
                    _translationSource.PropertyChanged += (s, e) =>
                    {
                        chocolateyGuiSetting.DisplayName =
                            _translationSource["ChocolateyGUI_" + chocolateyGuiSetting.Key + "Title"];
                        chocolateyGuiSetting.Description = _translationSource[descriptionKey];
                    };
                }

                ChocolateyGuiSettings.Add(chocolateyGuiSetting);
            }

            _changedChocolateyGuiSetting = new Subject <ChocolateyGuiSetting>();
            _changedChocolateyGuiSetting
            .Select(s => Observable.FromAsync(() => UpdateChocolateyGuiSetting(s)))
            .Concat()
            .Subscribe();

            var sources = await _chocolateyService.GetSources();

            foreach (var source in sources)
            {
                Sources.Add(source);
            }

            AllLanguages.Clear();

            foreach (var language in Internationalization.GetAllSupportedCultures().OrderBy(c => c.NativeName))
            {
                AllLanguages.Add(language);
            }

            var selectedLanguage = _config.UseLanguage;

            // We set it to the configuration itself, instead of the property
            // as we do not want to save the configuration file when it is not needed.
            _config.UseLanguage = Internationalization.GetSupportedCultureInfo(selectedLanguage).Name;
            NotifyOfPropertyChange(nameof(UseLanguage));
        }
Beispiel #22
0
        ///############################################################
        /// <summary>
        /// Populates the global variables holding the <c>Cn.Web</c> settings.
        /// </summary>
        /// <param name="oDBMS"><c>DBMS</c> instance representing an active connection to the related data source.</param>
        /// <param name="sInternationalizationDefaultDataTableName">String representing the name of the Default Internationalization table.</param>
        /// <param name="sInternationalizationTableName">String representing the name of the <paramref>sSystemName</paramref>'s Internationalization table.</param>
        /// <param name="sPicklistsTableName">String representing the name of the Picklists table.</param>
        /// <param name="sMetaDataTableName">String representing the name of the <paramref>sSystemName</paramref>'s DataSource MetaData view/table.</param>
        /// <param name="eDataSource">Enumeration representing the source the <paramref>oDataSourceMetaData</paramref> was generated from.</param>
        ///############################################################
        /// <LastUpdated>May 29, 2007</LastUpdated>
        public static void GetData(DBMS oDBMS, string sInternationalizationDefaultDataTableName, string sInternationalizationTableName, string sPicklistsTableName, string sMetaDataTableName, enumDataSource eDataSource)
        {
            MultiArray[] a_oResults;
            string       sSQL = "";
            int          iDefaultInternationalization = -1;
            int          iInternationalization        = -1;
            int          iMetaData  = -1;
            int          iPicklists = -1;
            int          i          = 0;

            //#### Create the required sSQL statement bassed on the passed information (skipping any with blank table names)
            if (!string.IsNullOrEmpty(sInternationalizationDefaultDataTableName))
            {
                sSQL += Internationalization.GetData.SQLStatement(sInternationalizationDefaultDataTableName) + "; ";
                iDefaultInternationalization = i;
                i++;
            }
            if (!string.IsNullOrEmpty(sInternationalizationTableName))
            {
                sSQL += Internationalization.GetData.SQLStatement(sInternationalizationTableName) + "; ";
                iInternationalization = i;
                i++;
            }
            if (!string.IsNullOrEmpty(sPicklistsTableName))
            {
                sSQL      += Picklists.GetData.SQLStatement(sPicklistsTableName) + "; ";
                iPicklists = i;
                i++;
            }
            if (!string.IsNullOrEmpty(sMetaDataTableName))
            {
                sSQL     += MetaData.GetData.SQLStatement(sMetaDataTableName, eDataSource) + "; ";
                iMetaData = i;
                //i++;
            }

            //#### Collect the a_oResults based on the above created sSQL statement
            a_oResults = oDBMS.GetMultiArrays(sSQL);

            //#### GetData the various configuration structures with the data within the a_oResults (skipping any with blank table names)
            if (iDefaultInternationalization != -1)
            {
                Internationalization.DefaultData = a_oResults[iDefaultInternationalization];
            }
            if (iInternationalization != -1)
            {
                Internationalization = new Internationalization(a_oResults[iInternationalization]);
            }
            if (iPicklists != -1)
            {
                Picklists = new Picklists(a_oResults[iPicklists]);
            }
            if (iMetaData != -1)
            {
                MetaData = new MetaData(a_oResults[iMetaData], eDataSource);

                //#### If Web.Settings.Picklists was also set above, .Set(the)RelatedPicklists now
                if (iPicklists != -1)
                {
                    MetaData.SetRelatedPicklists(Picklists);
                }
            }
        }
Beispiel #23
0
 public static void ApplyLanguageResources(Internationalization i)
 {
     RemoveResource(Internationalization.DirectoryName);
     Application.Current.Resources.MergedDictionaries.Add(i.GetResourceDictionary());
 }
Beispiel #24
0
        static string GetMessageCN(Internationalization interType, string messageID)
        {
            try
            {
                switch (interType)
                {
                    case Internationalization.Common:
                        return _CommonCN[messageID];
                    case Internationalization.DataList:
                        return _DataListCN[messageID];
                    case Internationalization.Storage:
                        return _StorageCN[messageID];
                    case Internationalization.Purchasing:
                        return _PurchaseCN[messageID];
                    case Internationalization.OrderSys:
                        return _OrderCN[messageID];
                    case Internationalization.ProductSys:
                        return _ProductCN[messageID];
                    case Internationalization.StockSet:
                        return _StockCN[messageID];
                    case Internationalization.MyMenu:
                        return _MenuCN[messageID];
                    case Internationalization.Users:
                        return _UsersCN[messageID];
                    case Internationalization.PromManage:
                        return _PromManageCN[messageID];
                    case Internationalization.CustomerManage:
                        return _CusManageCN[messageID];
                    case Internationalization.WebsiteManage:
                        return _WebsiteManageCN[messageID];
                    case Internationalization.FinaceManage:
                        return _FinaceManageCN[messageID];
                    case Internationalization.SysSetup:
                        return _SysSetupCN[messageID];
                    case Internationalization.DeskTop:
                        return _DeskTopCN[messageID];
                    case Internationalization.WebCommon:
                        return _WebCommonCN[messageID];
                    case Internationalization.WebProduct:
                        return _WebProductCN[messageID];
                    case Internationalization.WebTuan:
                        return _WebTuanCN[messageID];
                    case Internationalization.WebTheme:
                        return _WebThemeCN[messageID];
                    case Internationalization.WebHelp:
                        return _WebHelpCN[messageID];
                    case Internationalization.WebAccout:
                        return _WebAccoutCN[messageID];
                    case Internationalization.FunctionID:
                        return _FunctionIDCN[messageID];
                    case Internationalization.MsgSellerMenu:
                        return _MsgSellerMenuCN[messageID];
                    case Internationalization.MsgSellerHead:
                        return _MsgSellerHeadCN[messageID];
                    case Internationalization.MsgSelOrderList:
                        return _MsgSelOrderListCN[messageID];
                    case Internationalization.MsgSelOrderDetail:
                        return _MsgSelOrderDetailCN[messageID];
                    case Internationalization.MsgSelShipOrderList:
                        return _MsgSelShipOrderListCN[messageID];
                    case Internationalization.MsgSelShipOrderDetail:
                        return _MsgSelShipOrderDetailCN[messageID];
                    case Internationalization.MsgSelOrderReGoodsList:
                        return _MsgSelOrderReGoodsListCN[messageID];
                    case Internationalization.MsgSelOrderReGoodsDetail:
                        return _MsgSelOrderReGoodsDetailCN[messageID];
                    case Internationalization.MsgSelOrderMark:
                        return _MsgSelOrderMarkCN[messageID];
                    case Internationalization.MsgSelNavAdFlashPicInfo:
                        return _MsgSelNavAdFlashPicInfoCN[messageID];
                    case Internationalization.MsgSelProductChoiceProCata:
                        return _MsgSelProductChoiceProCataCN[messageID];
                    case Internationalization.MsgSelProductDetail:
                        return _MsgSelProductDetailCN[messageID];
                    case Internationalization.MsgSelProductProductTj:
                        return _MsgSelProductProductTjCN[messageID];
                    case Internationalization.MsSelProductList:
                        return _MsSelProductListCN[messageID];
                    case Internationalization.MsgProductStoreList:
                        return _MsgProductStoreListCN[messageID];
                    case Internationalization.MsgPromotionLimitTjInfo:
                        return _MsgPromotionLimitTjInfoCN[messageID];
                    case Internationalization.MsgPromotionLimitTjList:
                        return _MsgPromotionLimitTjListCN[messageID];
                    case Internationalization.MsgPromotionPackageInfo:
                        return _MsgPromotionPackageInfoCN[messageID];
                    case Internationalization.MsgPromotionPackageList:
                        return _MsgPromotionPackageListCN[messageID];
                    case Internationalization.MsgPromotionProInfo:
                        return _MsgPromotionProInfoCN[messageID];
                    case Internationalization.MsgPromotionProInfo2:
                        return _MsgPromotionProInfo2CN[messageID];
                    case Internationalization.MsgPromotionInfo3:
                        return _MsgPromotionInfo3CN[messageID];
                    case Internationalization.MsgPromotionList:
                        return _MsgPromotionListCN[messageID];
                    case Internationalization.MsgServiceAfterML:
                        return _MsgServiceAfterMLCN[messageID];
                    case Internationalization.MsgServiceCompList:
                        return _MsgServiceCompListCN[messageID];
                    case Internationalization.MsgServiceConsultingList:
                        return _MsgServiceConsultingListCN[messageID];
                    case Internationalization.MsgSetupCarryTemp:
                        return _MsgSetupCarryTempCN[messageID];
                    case Internationalization.MseSetupCarryTempList:
                        return _MseSetupCarryTempListCN[messageID];
                    case Internationalization.MseSetupConsumerPro:
                        return _MseSetupConsumerProCN[messageID];

                    case Internationalization.MsgSelOrderReGoodsConfirm:
                        return _MsgSelOrderReGoodsConfirmCN[messageID];
                    case Internationalization.MsgSelOrderModPrice:
                        return _MsgSelOrderModPriceCN[messageID];
                    case Internationalization.MsgSelOrderRefRegoods:
                        return _MsgSelOrderRefRegoodsCN[messageID];
                    case Internationalization.DeliveryBase:
                        return _DeliveryBaseCN[messageID];
                    case Internationalization.MsgSelReviewManage:
                        return _MsgSelReviewManageCN[messageID];
                    case Internationalization.MsgPageBase:
                        return _MsgPageBaseCN[messageID];

                    default:
                        return "暂时还未初始化数据,应该在SystemFramework.MsgConfig类中初始化!";
                }

            }
            catch (Exception)
            {
            }
            return messageID;
        }
Beispiel #25
0
        ///############################################################
        /// <summary>
        /// Creates a SQL UPDATE statement based on the provided data.
        /// </summary>
        /// <param name="sTableName">String representing the table name to target.</param>
        /// <param name="a_oColumns">ColumnDescription array where each index represents a single column to be represented within the statement.</param>
        /// <returns>String value containing the requested SQL UPDATE statement.</returns>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>sTableName</paramref> contains macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> is null or contains no columns.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains one or more <c>ColumnName</c>'s containing macilicious SQL statements.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains no columns defining the WHERE clause (columns defined as non-insertable/updateable).</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains no columns defined as insertable/updateable.</exception>
        /// <exception cref="Cn.CnException">Thrown when the passed <paramref>a_oColumns</paramref> contains one or more unreconized <c>Operator</c>s.</exception>
        ///############################################################
        /// <LastUpdated>July 10, 2006</LastUpdated>
        public static string Update(string sTableName, ColumnDescription[] a_oColumns)
        {
            string sWhereClause = "";
            string sOperator;
            string sReturn = "";
            int    i;

            //#### If the caller passed in a_oColumns to traverse
            if (a_oColumns != null && a_oColumns.Length > 0)
            {
                //#### If the passed sTableName is safe
                if (IsUserDataSafe(sTableName))
                {
                    //#### Traverse the passed a_oColumns
                    for (i = 0; i < a_oColumns.Length; i++)
                    {
                        //#### If the current .ColumnName is safe
                        if (IsUserDataSafe(a_oColumns[i].ColumnName))
                        {
                            //#### If this is an .IsInsertOrUpdateColumn
                            if (a_oColumns[i].IsInsertOrUpdateColumn)
                            {
                                //#### If the .Value is a null-string
                                if (a_oColumns[i].Value.Length == 0)
                                {
                                    //#### Determine the current a_oColumns' .Operator and process accordingly
                                    switch (a_oColumns[i].Operator)
                                    {
                                    case enumValueOperators.cnInsertNull: {
                                        //#### Append the .ColumnName and the NULL .Value onto the sReturn value
                                        sReturn += "," + a_oColumns[i].ColumnName + "=NULL";
                                        break;
                                    }

                                    case enumValueOperators.cnInsertNullString: {
                                        //#### Append the .ColumnName and the null-string .Value onto the sReturn value
                                        sReturn += "," + a_oColumns[i].ColumnName + "=''";
                                        break;
                                    }
                                    }
                                }
                                //#### Else there is a .Value to insert
                                else
                                {
                                    //#### If we are supposed to .Quote(the)Value (i.e. - this is a string-based type)
                                    if (a_oColumns[i].Quote)
                                    {
                                        //#### Append the .ColumnName and the FormatForSQL'd .Value onto the sReturn value
                                        sReturn += "," + a_oColumns[i].ColumnName + "='" + FormatForSQL(a_oColumns[i].Value, false) + "'";
                                    }
                                    //#### Else this must be a numeric (or otherwise non-quotable) value
                                    else
                                    {
                                        //#### Append the .ColumnName and the .Value onto the sReturn value
                                        //####     NOTE: We do a FormatForSQL below in order to avoid security issues. If this is indeed a numeric (or otherwise non-quotable) value, then .Value will not be changed by FormatForSQL. If it is a malicious attack, it will fail (as will the statement probably).
                                        sReturn += "," + a_oColumns[i].ColumnName + "=" + FormatForSQL(a_oColumns[i].Value, false);
                                    }
                                }
                            }
                            //#### Else if this is a WHERE clause column of some sort
                            else if (a_oColumns[i].IsWhereClauseColumn)
                            {
                                //#### Determine the sOperator for the current a_oColumn
                                sOperator = TranslateOperator("Update", a_oColumns[i].Operator);

                                //#### If we are supposed to .Quote(the)Value (i.e. - this is a string-based type)
                                if (a_oColumns[i].Quote)
                                {
                                    //#### Append the .ColumnName and the PadSQL'd .Value onto the sWhereClause
                                    sWhereClause += " AND " + a_oColumns[i].ColumnName + sOperator + "'" + FormatForSQL(a_oColumns[i].Value, false) + "'";
                                }
                                //#### Else this must be a numeric (or otherwise non-quotable) value
                                else
                                {
                                    //#### If the .Value .Is(a)Numeric
                                    //####     NOTE: Since .IsNumeric traverses the sValue one character at a time (and therefore does not convert it into a numeric type), there is no issue with overflow errors
                                    if (Data.Tools.IsNumeric(a_oColumns[i].Value))
                                    {
                                        //#### Append the .ColumnName and the .Value onto the sWhereClause
                                        //####     NOTE: We do a PadSQL below in order to avoid security issues. If this is indeed a numeric value, then .Value will not be changed by PadSQL. If it is a malicious attack, it will fail (as will the statement probably).
                                        sWhereClause += " AND " + a_oColumns[i].ColumnName + sOperator + FormatForSQL(a_oColumns[i].Value, false);
                                    }
                                }
                            }
                        }
                        //#### Else the current .ColumnName seems to contain macilious code, so raise the error
                        else
                        {
                            Internationalization.RaiseDefaultError(g_cClassName + "Update", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                        }
                    }

                    //#### If the sWhereClause was never set above, raise the error
                    if (sWhereClause.Length == 0)
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "Update", Internationalization.enumInternationalizationValues.cnDeveloperMessages_DbTools_WhereClauseRequired, "a_oColumns", "");
                    }
                    //#### Else if insertable/updatable columns were present
                    else if (sReturn.Length > 0)
                    {
                        //#### Coalesce the above created sReturn value and the determined sWhereClause (while removing its leading " AND ", hence begining at 5)
                        sReturn = "UPDATE " + sTableName + " SET " + sReturn.Substring(1) + " WHERE " + sWhereClause.Substring(5);
                    }
                    //#### Else no insertable/updateable bColumns(were)Present, so raise the error
                    else
                    {
                        Internationalization.RaiseDefaultError(g_cClassName + "Update", Internationalization.enumInternationalizationValues.cnDeveloperMessages_DbTools_InsertUpdateColumnsRequired, "a_oColumns", "");
                    }
                }
                //#### Else the passed sTableName seems to contain macilious code, so raise the error
                else
                {
                    Internationalization.RaiseDefaultError(g_cClassName + "Update", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_MaliciousSQLFound, "", "");
                }
            }
            //#### Else the passed a_oColumns is empty, so raise the error
            else
            {
                Internationalization.RaiseDefaultError(g_cClassName + "Update", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_ValueRequired, "a_oColumns", "");
            }

            //#### Return the above determiend sReturn value to the caller
            return(sReturn);
        }
Beispiel #26
0
        static string GetMessageFR(Internationalization interType, string messageID)
        {
            switch (interType)
            {
                case Internationalization.Common:
                    return _CommonFR[messageID];
                case Internationalization.DataList:
                    return _DataListFR[messageID];
                case Internationalization.Storage:
                    return _StorageFR[messageID];
                case Internationalization.Purchasing:
                    return _PurchaseFR[messageID];
                case Internationalization.OrderSys:
                    return _OrderFR[messageID];
                case Internationalization.ProductSys:
                    return _ProductFR[messageID];
                case Internationalization.StockSet:
                    return _StockFR[messageID];
                case Internationalization.MyMenu:
                    return _MenuFR[messageID];
                case Internationalization.Users:
                    return _UsersFR[messageID];
                case Internationalization.PromManage:
                    return _PromManageFR[messageID];
                case Internationalization.CustomerManage:
                    return _CusManageFR[messageID];
                case Internationalization.WebsiteManage:
                    return _WebsiteManageFR[messageID];
                case Internationalization.FinaceManage:
                    return _FinaceManageFR[messageID];
                case Internationalization.SysSetup:
                    return _SysSetupFR[messageID];
                case Internationalization.DeskTop:
                    return _DeskTopFR[messageID];
                case Internationalization.WebCommon:
                    return _WebCommonFR[messageID];
                case Internationalization.WebProduct:
                    return _WebProductFR[messageID];
                case Internationalization.WebTuan:
                    try
                    {
                        return _WebTuanFR[messageID];
                    }
                    catch (Exception e)
                    { throw new ApplicationException(messageID); }
                case Internationalization.WebTheme:
                    return _WebThemeFR[messageID];
                case Internationalization.WebHelp:
                    return _WebHelpFR[messageID];
                case Internationalization.WebAccout:
                    return _WebAccoutFR[messageID];

                case Internationalization.FunctionID:
                    return _FunctionIDFR[messageID];
                default:
                    return "暂时还未初始化数据,应该在SystemFramework.MsgConfig类中初始化!";
            }
        }
Beispiel #27
0
        ///############################################################
        /// <summary>
        /// Places the key/value pair data (spaned across this instance's cookie collection) onto the user's system.
        /// </summary>
        /// <remarks>
        /// Each cookie represents a "crumb" of the key/value pair data that is no longer then the HTTP specification maximum of 4kb per cookie.
        /// </remarks>
        /// <exception cref="Cn.CnException">Thrown when the key/value pair data stored within this instance's cookie collection is longer then the specified <c>MaxLength</c>.</exception>
        ///############################################################
        /// <LastUpdated>August 23, 2005</LastUpdated>
        public void Place()
        {
            HttpCookieCollection oCookies = HttpContext.Current.Response.Cookies;
            HttpCookie           oNewCookie;
            string   sCMData;
            DateTime dExpires;
            int      iCookieIndex = 1;
            int      iCrumbSize;
            int      iLen;
            int      i;

            //#### Drop(all of the)CurrentCookies from the remote system
            DropCurrentCookies(g_sName);

            //#### Init sCMData with the UserID (using g_sUserID's property so one is generated if need be) and it's trailing PrimaryDelimiter, then determine it's iLen
            //####     NOTE: %^#ing dumbass Microsoft %^#ty ass programming fix... it seems they URLDecode incomming cookies, while not URLEncoding them on the way out... %^#ing idiots
//          sCMData = Current.Server.UrlEncode(Me.UserID & PrimaryDelimiter & BuildKeyValueString(gh_sFields, False))
            sCMData = CookieEncode(UserID + Configuration.Settings.PrimaryDelimiter + Tools.KeyValueString(gh_sFields, false));
            iLen    = sCMData.Length;

            //#### If the determined iLen of sCMData is less then the .MaxLength
            if (iLen < g_iMaxLength)
            {
                //#### Set the iCrumbSize to the length of the g_sName plus 2 (to allow for up to 2 digits in cookie numbers) plus 1 (to allow for the equal sign) plus 5 (to allow for an additional buffer) minus 4096 (4kb of data, which is the absolute max length of a single cookie)
                iCrumbSize = (4096 - (g_sName.Length + 2 + 1 + 5));

                //#### If the caller decided to have a session cookie, set dExpires to null (or in this case .MinValue)
                if (g_iTimeout == 0)
                {
                    dExpires = DateTime.MinValue;
                }
                //#### Else the caller decided to have an expiring cookie, so set dExpires to the developer-defined time
                else
                {
                    dExpires = DateTime.Now.AddMinutes(g_iTimeout);
                }

                //#### Move along the compiled sCMData, placing a single "cookie crumb" as we go
                for (i = 0; i < iLen; i += iCrumbSize)
                {
                    //#### If we still have a full iCrumbSize, set the current Cookie's .Value accordingly
                    if ((i + iCrumbSize - 1) < iLen)
                    {
                        oNewCookie = new HttpCookie(g_sName + iCookieIndex, sCMData.Substring(i, iCrumbSize));
                    }
                    //#### Else grab the remainder of the sCMData as less then (or exactly) a full iCrumbSize is left
                    else
                    {
                        oNewCookie = new HttpCookie(g_sName + iCookieIndex, sCMData.Substring(i));
                    }

                    //#### .Add the oNewCookie and set the current Cookie's .Expires to the above determined dExpires
                    oNewCookie.Expires = dExpires;
                    oCookies.Add(oNewCookie);

                    //#### Inc the iCookieIndex for the next Cookie
                    iCookieIndex += 1;
                }

                //#### Place a trailing blank Cookie
                oNewCookie = new HttpCookie(g_sName + iCookieIndex, "");
                oCookies.Add(oNewCookie);
                oCookies[g_sName + iCookieIndex].Expires = dExpires;
            }
            //#### Else the determined sCMData is too long to fit into the CookieMonster, so raise the error
            else
            {
                Internationalization.RaiseDefaultError(g_cClassName + "Place", Internationalization.enumInternationalizationValues.cnDeveloperMessages_CookieMonster_ValueTooLong, Data.Tools.MakeString(iLen, ""), Data.Tools.MakeString(g_iMaxLength, ""));
            }
        }
Beispiel #28
0
        ///###############################################################
        /// <summary>
        /// Formats the referenced server structure of data elements into a key/value pair structure.
        /// </summary>
        /// <param name="eServerObject">Enumeration representing the server structure of data elements to encode.</param>
        /// <param name="bIncludeBlankValues">Boolean value indicating if keys with null-string values are to be included.</param>
        /// <returns>String representing a QueryString-style key/value pair structure (i.e. - "key1=value1&amp;key2=value2&amp;key3=value3").</returns>
        ///###############################################################
        /// <LastUpdated>December 2, 2005</LastUpdated>
        public static string KeyValueString(enumServerObject eServerObject, bool bIncludeBlankValues)
        {
            NameObjectCollectionBase.KeysCollection oKeysCollection;
            string sValue;
            string sReturn = "";
            int    i;

            //#### Determine the passed eServerObject and process accordingly
            switch (eServerObject)
            {
            case enumServerObject.cnApplication: {
                HttpApplicationState oApplication = HttpContext.Current.Application;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oApplication.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oApplication[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the sReturn value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnForm: {
                NameValueCollection oForm = HttpContext.Current.Request.Form;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oForm.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oForm[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnQueryString: {
                NameValueCollection oQueryString = HttpContext.Current.Request.QueryString;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oQueryString.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = oQueryString[oKeysCollection[i]];

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnSession: {
                System.Web.SessionState.HttpSessionState oSession = HttpContext.Current.Session;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oSession.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oSession[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            default: {
                Internationalization.RaiseDefaultError(g_cClassName + "BuildKeyValueString", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eServerObject", Data.Tools.MakeString(eServerObject, ""));
                break;
            }
            }

            //#### If the sReturn value is holding key/value data, remove the trailing "&" (borrowing the use of i to store the sReturn value's .Length)
            i = sReturn.Length;
            if (i > 0)
            {
                //#### Clip off the trailing &
                sReturn = sReturn.Substring(0, sReturn.Length - 1);
            }

            //#### Return the above determined sReturn value to the caller
            return(sReturn);
        }
 public virtual string ToString(char separator)
 {
     return
         ($"{VersionID}{separator}{Internationalization?.ToString()}{separator}{InternationalVersionID?.ToString()}"
          .TrimEnd(separator));
 }
Beispiel #30
0
 public LocalizedDescriptionAttribute(string resourceKey)
 {
     _translator  = InternationalizationManager.Instance;
     _resourceKey = resourceKey;
 }
Beispiel #31
0
        private static void SetUpPreferredLanguage(IConfigService configService)
        {
            var effectiveService = configService.GetEffectiveConfiguration();

            Internationalization.UpdateLanguage(effectiveService.UseLanguage);
        }