public ActionResult UpdateRate() { var lcur = _settings.ReadSetting(SettingsNames.LastUsedCurrency); if (string.IsNullOrEmpty(lcur)) { lcur = _storage.GetBaseCurrency().Code; } return(View(new UpdateRateModel { CurrencyCode = lcur })); }
public void CheckSettings() { var testValue = Guid.NewGuid().ToString(); _settings.WriteSettings(SettingsNames.Test, testValue); var val = _settings.ReadSetting(SettingsNames.Test); Assert.AreEqual(testValue, val); _settings.WriteSettings(SettingsNames.SecondCurrency, "THB"); }
public TimeZoneInfo GetCurrenTimeZone() { TimeZoneInfo tif = null; try { tif = TimeZoneInfo.FromSerializedString(_sttings.ReadSetting(SettingsNames.TimeZone)); } catch { // ignored } if (tif == null) { tif = TimeZoneInfo.Local; _sttings.WriteSettings(SettingsNames.TimeZone, tif.ToSerializedString()); } return(tif); }
public PlaneStateModel PlanState() { var model = new PlaneStateModel { PlanState = _financeHelper.GetCurrentPlanState() }; var secondCur = _settings.ReadSetting(SettingsNames.SecondCurrency); if (!string.IsNullOrEmpty(secondCur) && model.PlanState != null) { var cur = _storage.GetCurrency(secondCur); model.SecondCurrency = new SecondCurrencyState { Code = secondCur, MainState = (model.PlanState.PlannedSpend - model.PlanState.PlanSpent) * cur.Rate, LeftPlan = (model.PlanState.PlanLimit - model.PlanState.PlanSpent) >= 0? (model.PlanState.PlanLimit - model.PlanState.PlanSpent) * cur.Rate:0, LeftDay = (model.PlanState.DayLimit - model.PlanState.DaySpent) > 0? (model.PlanState.DayLimit - model.PlanState.DaySpent) * cur.Rate:0 }; } return(model); }