public ValidBudgetCheck IsBudgetValid(string budgetPath) { try { SQLiteBudgetStore.EnsureValidEventStore(budgetPath); } catch (InvalidBudgetStoreException e) { return(new ValidBudgetCheck(false, e.Message)); } return(new ValidBudgetCheck(true, null)); }
public BudgetModel CreateNewBudget(string budgetPath) { var deviceSettings = _settingsProvider.Get <Device>(); Guid deviceId = deviceSettings.DeviceID; if (File.Exists(budgetPath)) { File.Delete(budgetPath); } IBudgetStore budgetStore = new SQLiteBudgetStore(deviceId, budgetPath); var budgetModel = BudgetModel.CreateNew(deviceId, budgetStore); return(budgetModel); }
public BudgetModel LoadBudget(string budgetPath) { var deviceSettings = _settingsProvider.Get <Device>(); Guid deviceId = deviceSettings.DeviceID; if (!File.Exists(budgetPath)) { throw new FileNotFoundException(budgetPath); } IBudgetStore budgetStore = new SQLiteBudgetStore(deviceId, budgetPath); var budgetModel = BudgetModel.Load(deviceId, budgetStore); return(budgetModel); }