Esempio n. 1
0
 private void NextMonthButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (CurrentDate.Month == 12)
     {
         CurrentDate = CurrentDate.AddYears(1);
     }
     CurrentDate = CurrentDate.AddMonths(1);
 }
Esempio n. 2
0
 private void PreviousMonthButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (CurrentDate.Month == 1)
     {
         CurrentDate = CurrentDate.AddYears(-1);
     }
     CurrentDate = CurrentDate.AddMonths(-1);
 }
Esempio n. 3
0
        private async Task FillHouseholdExpense(List <PaymentProjectionModel> list, List <DateTime> dates, IEnumerable <PaymentType> types, BaseFilter filter)
        {
            var fromDate             = CurrentDate.AddMonths(-3).FixFirstDayInMonth();
            var allHouseholdExpenses = await _householdExpenseRepository.GetSome(new BaseFilter()
            {
                UserId = filter.UserId, StartDate = fromDate
            });

            var average = allHouseholdExpenses.Where(p => p.IsRecurrent && p.Date.SameMonthYear(fromDate)).Sum(p => p.Value);

            average += allHouseholdExpenses.Where(p => p.IsRecurrent && p.Date.SameMonthYear(fromDate.AddMonths(1))).Sum(p => p.Value);
            average += allHouseholdExpenses.Where(p => p.IsRecurrent && p.Date.SameMonthYear(fromDate.AddMonths(2))).Sum(p => p.Value);

            if (average > 0)
            {
                average = average / 3;
            }

            foreach (var date in dates)
            {
                var householdExpense = allHouseholdExpenses.Where(p => p.Date.Month == date.Month && p.Date.Year == date.Year);
                if (householdExpense.Any())
                {
                    list.Add(new PaymentProjectionModel()
                    {
                        Description = $"Despesas Domésticas",
                        MonthYear   = date.ToString("MM/yyyy"),
                        Type        = types.First(p => p.Id == (int)PaymentTypeEnum.Expense),
                        Value       = householdExpense.Sum(p => p.Value)
                    });
                }
                else if (average > 0)
                {
                    list.Add(new PaymentProjectionModel()
                    {
                        Description = $"Despesas Domésticas (Estimado)",
                        MonthYear   = date.ToString("MM/yyyy"),
                        Type        = types.First(p => p.Id == (int)PaymentTypeEnum.Expense),
                        Value       = average
                    });
                }
            }
        }
Esempio n. 4
0
        public void TimerAction()
        {
            if (Timer.Delay > 2)
            {
                Timer.Delay -= Timer.Delay / 20;
            }
            DateTime tmp = CurrentDate.AddMonths(tmrMonthDelta).Date;

            if (Math.Abs((DateTime.Now - tmp).TotalDays / 365) < 1000)
            {
                CurrentDate = tmp;
            }
            else
            {
                Timer.Stop();
                tmrMonthDelta = -tmrMonthDelta;
                MessageBoxOverlay.ShowSuccess("You won. I loose.", ParentWindow);
            }
            Invalidate();
        }
Esempio n. 5
0
 private void CreateCommands()
 {
     GoMonthBack = ReactiveCommand.Create(() =>
     {
         CurrentDate = CurrentDate.AddMonths(-1);
         RefreshData();
         GetDataByDateAndType(CurrentDate, CurrentType);
     });
     GoMonthForward = ReactiveCommand.Create(() =>
     {
         CurrentDate = CurrentDate.AddMonths(1);
         RefreshData();
         GetDataByDateAndType(CurrentDate, CurrentType);
     });
     ChangeDiagramFilterCommand = ReactiveCommand.Create(() =>
     {
         IsDiagramChangeFilterVisible = !IsDiagramChangeFilterVisible;
     });
     DisplayIncome = ReactiveCommand.Create(() =>
     {
         TextByPercentage = Strings["income_by_percentage"];
         CurrentDate      = DateTime.Now;
         CurrentType      = TransactionType.Add;
         RefreshData();
         GetDataByDateAndType(CurrentDate, CurrentType);
     });
     DisplayOutlay = ReactiveCommand.Create(() =>
     {
         TextByPercentage = Strings["outlay_by_percentage"];
         CurrentDate      = DateTime.Now;
         CurrentType      = TransactionType.Spend;
         RefreshData();
         GetDataByDateAndType(CurrentDate, CurrentType);
     });
     SelectCategory = ReactiveCommand.Create <PercentageCategory>(async note =>
     {
         await PopupNavigation.Instance.PushAsync(new DiagramPopupView(note, CurrentMonthText), true);
         return;
     });
 }
 public void DecreaseMonth()
 {
     CurrentDate     = CurrentDate.AddMonths(-1);
     FirstDateOfWeek = new DateTime(CurrentDate.Year, CurrentDate.Month, 1);
     StartDate       = FirstDateOfWeek.AddDays(-(int)FirstDateOfWeek.DayOfWeek + 1);
 }
Esempio n. 7
0
 private void Previous_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     // Render the calendar with the previous month
     RenderCalendar(CurrentDate.AddMonths(-1));
 }
Esempio n. 8
0
 private void Next_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     // Render the calendar with the next month
     RenderCalendar(CurrentDate.AddMonths(1));
 }
 private void ButtonBase2_OnClick(object sender, RoutedEventArgs e)
 {
     CurrentDate = CurrentDate.AddMonths(1);
     Draw();
 }
 protected void NextMonth()
 {
     CurrentDate = CurrentDate.AddMonths(1);
     GetDates();
     StateHasChanged();
 }
 protected void PreviousMonth()
 {
     CurrentDate = CurrentDate.AddMonths(-1);
     GetDates();
     StateHasChanged();
 }
 private void OnNextMonth()
 {
     CurrentDate   = CurrentDate.AddMonths(1);
     MonthDaysList = InitializeDays();
 }
 private void OnPreviousMonth()
 {
     CurrentDate   = CurrentDate.AddMonths(-1);
     MonthDaysList = InitializeDays();
 }