Пример #1
0
        public static bool Load_Local_UserSettings_SYSTEM1()
        {
            StringCollection aFields = new StringCollection();

            //Format
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysMaskGeneralValue }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskLocalAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskForeignAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPercent }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskQty }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPrice }));
            if (!GetLocalUserConfig("Format", aFields))
            {
                return(false);
            }

            if (aFields[0].Trim() != "")
            {
                Settings.sysMaskGeneralValue = aFields[2];
            }
            if (aFields[1].Trim() != "")
            {
                Settings.sysMaskLocalAmt = aFields[2];
            }
            if (aFields[2].Trim() != "")
            {
                Settings.sysMaskForeignAmt = aFields[2];
            }
            if (aFields[3].Trim() != "")
            {
                Settings.sysMaskPercent = aFields[3];
            }
            if (aFields[4].Trim() != "")
            {
                Settings.sysMaskQty = aFields[4];
            }
            if (aFields[5].Trim() != "")
            {
                Settings.sysMaskPrice = aFields[5];
            }

            //Color
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_FG }));
            if (!GetLocalUserConfig("Color", aFields))
            {
                return(false);
            }
            ;

            if (aFields[0].Trim() != "")
            {
                Settings.sysPriceColor_Increase_BG = ColorTranslator.FromHtml(aFields[0]);
            }
            if (aFields[1].Trim() != "")
            {
                Settings.sysPriceColor_Increase_FG = ColorTranslator.FromHtml(aFields[1]);
            }

            if (aFields[2].Trim() != "")
            {
                Settings.sysPriceColor_Decrease_BG = ColorTranslator.FromHtml(aFields[2]);
            }
            if (aFields[3].Trim() != "")
            {
                Settings.sysPriceColor_Decrease_FG = ColorTranslator.FromHtml(aFields[3]);
            }

            if (aFields[4].Trim() != "")
            {
                Settings.sysPriceColor_NotChange_BG = ColorTranslator.FromHtml(aFields[4]);
            }
            if (aFields[5].Trim() != "")
            {
                Settings.sysPriceColor_NotChange_FG = ColorTranslator.FromHtml(aFields[5]);
            }

            //System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysLanguage }));
            aFields.Add(common.system.GetName(new { Settings.sysAutoRefreshData }));
            if (!GetLocalUserConfig("System", aFields))
            {
                return(false);
            }
            ;
            Settings.sysLanguage        = AppTypes.Code2Language(aFields[0].Trim());
            Settings.sysAutoRefreshData = aFields[1].Trim() != Boolean.FalseString;
            return(true);
        }
Пример #2
0
        //From database
        public static bool Load_Global_Settings(ref GlobalSettings settings)
        {
            int num;
            StringCollection aFields = new StringCollection();

            // System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.WriteLogAccess }));
            aFields.Add(common.system.GetName(new { settings.PasswordMinLen }));
            aFields.Add(common.system.GetName(new { settings.UseStrongPassword }));
            if (!GetConfig(ref aFields))
            {
                return(false);
            }

            if (int.TryParse(aFields[0], out num))
            {
                settings.WriteLogAccess = (AppTypes.SyslogMedia)num;
            }
            if (int.TryParse(aFields[1], out num))
            {
                settings.PasswordMinLen = (byte)num;
            }
            if (aFields[2].Trim() != "")
            {
                settings.UseStrongPassword = (aFields[2] == Boolean.TrueString);
            }

            // Data count
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DayScanForLastPrice }));
            aFields.Add(common.system.GetName(new { settings.AlertDataCount }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_FIRST }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_MORE }));
            if (!GetConfig(ref aFields))
            {
                return(false);
            }

            if (aFields[0].Trim() != "" & int.TryParse(aFields[0], out num))
            {
                settings.DayScanForLastPrice = (short)num;
            }
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num))
            {
                settings.AlertDataCount = (short)num;
            }
            if (aFields[2].Trim() != "" & int.TryParse(aFields[2], out num))
            {
                settings.ChartMaxLoadCount_FIRST = (short)num;
            }
            if (aFields[3].Trim() != "" & int.TryParse(aFields[3], out num))
            {
                settings.ChartMaxLoadCount_MORE = (short)num;
            }


            //Auto key
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DataKeyPrefix }));
            aFields.Add(common.system.GetName(new { settings.DataKeySize }));
            aFields.Add(common.system.GetName(new { settings.AutoEditKeySize }));
            aFields.Add(common.system.GetName(new { settings.TimeOut_AutoKey }));
            if (!GetConfig(ref aFields))
            {
                return(false);
            }
            if (aFields[0].Trim() != "")
            {
                settings.DataKeyPrefix = aFields[0].Trim();
            }
            if (int.TryParse(aFields[1], out num))
            {
                settings.DataKeySize = num;
            }
            if (int.TryParse(aFields[2], out num))
            {
                settings.AutoEditKeySize = num;
            }
            if (int.TryParse(aFields[3], out num))
            {
                settings.TimeOut_AutoKey = num;
            }

            //Email
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.smtpAddress }));
            aFields.Add(common.system.GetName(new { settings.smtpPort }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthAccount }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthPassword }));
            aFields.Add(common.system.GetName(new { settings.smtpSSL }));
            if (!GetConfig(ref aFields))
            {
                return(false);
            }

            if (aFields[0].Trim() != "")
            {
                settings.smtpAddress = aFields[0];
            }
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num))
            {
                settings.smtpPort = num;
            }
            settings.smtpAuthAccount  = aFields[2].Trim();
            settings.smtpAuthPassword = aFields[3].Trim();
            settings.smtpSSL          = (aFields[4].Trim() == Boolean.TrueString);

            //Default
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DefautLanguage }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeRange }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeScaleCode }));
            aFields.Add(common.system.GetName(new { settings.ScreeningTimeScaleCode }));

            aFields.Add(common.system.GetName(new { settings.AlertDataCount }));
            aFields.Add(common.system.GetName(new { settings.ScreeningDataCount }));

            if (!GetConfig(ref aFields))
            {
                return(false);
            }

            if (aFields[0].Trim() != "")
            {
                settings.DefautLanguage = AppTypes.Code2Language(aFields[0].Trim());
            }
            if (aFields[1].Trim() != "")
            {
                settings.DefaultTimeRange = AppTypes.TimeRangeFromCode(aFields[1]);
            }
            if (aFields[2].Trim() != "")
            {
                settings.DefaultTimeScaleCode = aFields[2];
            }
            if (aFields[3].Trim() != "")
            {
                settings.ScreeningTimeScaleCode = aFields[3];
            }

            if (aFields[4].Trim() != "" & int.TryParse(aFields[4], out num))
            {
                settings.AlertDataCount = (short)num;
            }
            if (aFields[5].Trim() != "" & int.TryParse(aFields[5], out num))
            {
                settings.ScreeningDataCount = (short)num;
            }

            //Timming
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.TimerIntervalInSecs }));
            aFields.Add(common.system.GetName(new { settings.RefreshDataInSecs }));
            aFields.Add(common.system.GetName(new { settings.CheckAlertInSeconds }));
            aFields.Add(common.system.GetName(new { settings.AutoCheckInSeconds }));
            if (!GetConfig(ref aFields))
            {
                return(false);
            }

            if (aFields[0].Trim() != "" & int.TryParse(aFields[0], out num))
            {
                settings.TimerIntervalInSecs = (short)num;
            }
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num))
            {
                settings.RefreshDataInSecs = (short)num;
            }
            if (aFields[2].Trim() != "" & int.TryParse(aFields[2], out num))
            {
                settings.CheckAlertInSeconds = (short)num;
            }
            if (aFields[3].Trim() != "" & int.TryParse(aFields[3], out num))
            {
                settings.AutoCheckInSeconds = (short)num;
            }
            return(true);
        }