public bool Save() { BusinessCache.Settings.SearchingKeywordsString = txtSearchingKeyword.Text; BusinessCache.Settings.MatchingKeywordsString = FormatMatchingKeywords(txtMatchKeyword.Text); BusinessCache.Settings.Yijia = TypeParser.GetDouble(txtYijia.Text); BusinessCache.Settings.Rate = TypeParser.GetDouble(txtRate.Text); BusinessCache.Settings.NextPayment = TypeParser.GetInt(txtNextPayment.Text); BusinessCache.Settings.FreqTransfer = TypeParser.GetInt32Value(txtFreqTranser.Text, 60); BusinessCache.Settings.DelayTransfer = TypeParser.GetInt32Value(txtDelayTransfer.Text); BusinessCache.Settings.PageFrom = TypeParser.GetInt32Value(txtPageFrom.Text); BusinessCache.Settings.PageTo = TypeParser.GetInt32Value(txtPageTo.Text); BusinessCache.Settings.AutoAcquire = chkAutoAcquire.Checked; BusinessCache.Settings.TrySaveToConfig(); return(true); }
public static void TryRetriveFromConfig(this UserSettings setting) { if (setting == null) { setting = new UserSettings(); } setting.SearchingKeywordsString = TypeParser.GetStringValue(ConfigurationManager.AppSettings[UserSettings.Namespance.SearchingKeyword]); setting.MatchingKeywordsString = TypeParser.GetStringValue(ConfigurationManager.AppSettings[UserSettings.Namespance.MatchingKeyword]); setting.Yijia = TypeParser.GetDouble(ConfigurationManager.AppSettings[UserSettings.Namespance.Yijia]); setting.Rate = TypeParser.GetDouble(ConfigurationManager.AppSettings[UserSettings.Namespance.Rate]); setting.NextPayment = TypeParser.GetInt(ConfigurationManager.AppSettings[UserSettings.Namespance.NextPayment]); setting.FreqTransfer = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.FreqTransfer], 60); setting.DelayTransfer = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.DelayTransfer]); setting.PageFrom = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.PageFrom]); setting.PageTo = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.PageTo]); setting.AutoAcquire = TypeParser.GetBoolValue(ConfigurationManager.AppSettings[UserSettings.Namespance.AutoAcquire]); }