Beispiel #1
0
        /// <summary>
        /// Метод перемещающий на неделью назад.
        /// </summary>
        public void LeftButtonMethod(object param)
        {
            int    month     = (int)CurrentMonth;
            int    week      = 7;
            string Path      = CURRENT_PATH_INCOME;
            int    indexPath = PathsIncome.IndexOf(Path);

            if (PathsIncome.Count > indexPath && indexPath > 0)
            {
                CURRENT_PATH_INCOME = PathsIncome[indexPath - 1];

                CurrentDay -= week;

                if (CurrentDay <= 0)
                {
                    if (CurrentMonth != Months.Январь)
                    {
                        CurrentMonth--;
                        month -= 1;
                    }
                    else
                    {
                        CurrentMonth = (Months)12;
                        month        = 12;
                        CurrentYear--;
                    }

                    int days = DateTime.DaysInMonth(CurrentYear, month);

                    CurrentDay += days;
                }

                Refresh();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Метод перемещающий на неделью в перед.
        /// </summary>
        public void RightButtonMethod(object param)
        {
            int    days      = DateTime.DaysInMonth(CurrentYear, (int)CurrentMonth);
            int    week      = 7;
            int    months    = 12;
            string Path      = CURRENT_PATH_INCOME;
            int    indexPath = PathsIncome.IndexOf(Path);


            if (PathsIncome.Count > indexPath + 1)
            {
                CURRENT_PATH_INCOME = PathsIncome[indexPath + 1];

                CurrentDay += week;

                if (CurrentDay > days)
                {
                    if ((int)CurrentMonth != months)
                    {
                        CurrentMonth++;
                    }
                    else
                    {
                        CurrentMonth = (Months)1;
                        CurrentYear++;
                    }

                    CurrentDay -= days;
                }

                Refresh();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Метод получения текущего пути.
        /// </summary>
        private void GetCurrentPath()
        {
            var path = PathsIncome.LastOrDefault();

            if (path == null)
            {
                CURRENT_PATH_INCOME = "IncomeExpenses.json";
            }
            else
            {
                CURRENT_PATH_INCOME = path;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Метод создания новой таблицы.
        /// </summary>
        private void CreateNewTable()
        {
Never:
            var Path = Guid.NewGuid().ToString() + ".json";

            if (PathsIncome.FirstOrDefault(s => s.Equals(Path)) == null)
            {
                PathsIncome.Add(Path);

                Save(PATH_ALL_INCOMES, PathsIncome);
            }
            else
            {
                goto Never;
            }
        }