Exemplo n.º 1
0
        public static decimal After(DAS_ModelCollection modelCollection)
        {
            decimal totalSpentInMonth = DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels);
            decimal amountLeftToSpend = modelCollection.GoalModel.Amount - totalSpentInMonth;

            DateTime firstOfNextMonth = new DateTime(modelCollection.CurrentlySetTime.Year, modelCollection.CurrentlySetTime.Month, 1).AddMonths(1);
            int      daysLeftInMonth  = (firstOfNextMonth - modelCollection.CurrentlySetTime).Days;

            return(amountLeftToSpend / (daysLeftInMonth + 1));
        }
Exemplo n.º 2
0
 public void RefreshView(DAS_ModelCollection modelCollection)
 {
     BDAS.text = "$" + DailyAverageSpendCalculator.Before(modelCollection).ToString("0.00");
     if (modelCollection.CurrentlySetTime.Month < DateTime.Now.Month && modelCollection.CurrentlySetTime.Year <= DateTime.Now.Year)
     {
         ADAS.text = "N/A";
     }
     else
     {
         ADAS.text = "$" + DailyAverageSpendCalculator.After(modelCollection).ToString("0.00");
     }
 }
Exemplo n.º 3
0
        public static decimal Before(DAS_ModelCollection modelCollection)
        {
            decimal totalSpentInMonth = DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels);

            if (modelCollection.CurrentlySetTime.Month < DateTime.Now.Month && modelCollection.CurrentlySetTime.Year <= DateTime.Now.Year)
            {
                return(totalSpentInMonth / DateTime.DaysInMonth(modelCollection.CurrentlySetTime.Year, modelCollection.CurrentlySetTime.Month));
            }
            else
            {
                return(totalSpentInMonth / modelCollection.CurrentlySetTime.Day);
            }
        }
Exemplo n.º 4
0
 public void ConstructView(DAS_ModelCollection modelCollection)
 {
     RefreshView(modelCollection);
 }