예제 #1
0
        public ValidBudgetCheck IsBudgetValid(string budgetPath)
        {
            try
            {
                SQLiteBudgetStore.EnsureValidEventStore(budgetPath);
            }
            catch (InvalidBudgetStoreException e)
            {
                return(new ValidBudgetCheck(false, e.Message));
            }

            return(new ValidBudgetCheck(true, null));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }