Пример #1
0
        // Populates months, years and days which will be available in the picker

        private void PopulateDateCollection()

        {
            for (var i = 1; i <= 12; i++)
            {
                if (!Months.ContainsKey(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3)))
                {
                    Months.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i));
                }

                Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3));
            }

            // Available years = 2000-2025
            for (var i = 2000; i < 2025; i++)
            {
                Year.Add(i.ToString());
            }

            for (var i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
            {
                if (i < 10)
                {
                    Day.Add("0" + i);
                }
                else
                {
                    Day.Add(i.ToString());
                }
            }

            Date.Add(Month);
            Date.Add(Day);
            Date.Add(Year);
        }
Пример #2
0
        private void PopulateDateCollection()
        {
            //populate months
            for (int i = 1; i < 13; i++)
            {
                if (!Months.ContainsKey(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3)))
                {
                    Months.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i));
                }
                Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3));
            }
            //populate year
            for (int i = 1990; i < 2050; i++)
            {
                Year.Add(i.ToString());
            }

            ////populate Days
            //for (int i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
            //{
            //    if (i < 10)
            //    {
            //        Day.Add("0" + i);
            //    }
            //    else
            //        Day.Add(i.ToString());
            //}

            Date.Add(Month);

            //Date.Add(Day);

            Date.Add(Year);
        }
Пример #3
0
        private void Initialize()
        {
            // Subscribe
            EventAggregationProvider.InvoiceProgramEventAggregator.Subscribe(this);

            for (int i = 1; i <= 12; i++)
            {
                Month.Add(i);
            }

            Year           = DateTime.Now.Year.ToString();
            SelectedMonth  = Month.Where(x => x == DateTime.Now.Month).First();
            SelectedFilter = Filters.First();
            LoadInvoices();
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportAnalysisViewModel"/> class.
        /// </summary>
        public ReportAnalysisViewModel()
        {
            int thisYear = DateTime.Now.Year;

            //显示最近10年
            for (int i = 0; i < 10; i++)
            {
                Year.Add(thisYear - i);
            }
            for (int i = 0; i < 12; i++)
            {
                Month.Add(i + 1);
            }

            Initialize();
        }
        private void PopulateMonthAndYear()
        {
            // Populate Year
            for (int i = 2018; i < 2100; i++)
            {
                Year.Add(i.ToString());
            }

            // Populate Month
            for (int i = 1; i < 13; i++)
            {
                Month.Add(DateTimeFormatInfo.CurrentInfo.GetMonthName(i));
            }
            MonthAndYear.Add(Month);
            MonthAndYear.Add(Year);
        }
Пример #6
0
        private void PopulateDateCollection()
        {
            //populate months
            for (int i = 1; i < 13; i++)
            {
                Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3));
            }

            //populate year
            for (int i = 1990; i < 2100; i++)
            {
                Year.Add(i.ToString());
            }

            Date.Add(Month);
            Date.Add(Year);
        }
        private void PopulateDateCollection()
        {
            try
            {
                //populate months
                for (int i = 1; i < 13; i++)
                {
                    //if (!Months.ContainsKey(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3)))
                    //    Months.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i));
                    //Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3));

                    if (i < 10)
                    {
                        Month.Add("0" + i);
                    }
                    else
                    {
                        Month.Add(i.ToString());
                    }
                }
                //populate year
                for (int i = 1900; i < 2050; i++)
                {
                    Year.Add(i.ToString());
                }

                //populate Days
                for (int i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
                {
                    if (i < 10)
                    {
                        Day.Add("0" + i);
                    }
                    else
                    {
                        Day.Add(i.ToString());
                    }
                }
                Date.Add(Day);
                Date.Add(Month);
                Date.Add(Year);
            }
            catch (Exception ex)
            {
            }
        }
        public TransactionSummaryViewModel()
        {
            int thisYear = DateTime.Now.Year;

            //显示最近10年
            for (int i = 0; i < 10; i++)
            {
                Year.Add(thisYear - i);
            }
            for (int i = 0; i < 12; i++)
            {
                Month.Add(i + 1);
            }
            if (CanExecuteQueryCommand())
            {
                ExecuteQueryCommand();
            }
        }
Пример #9
0
        private void populateDateCollection()
        {
            int startYear = 1990;
            int endYear   = DateTime.Now.Date.Year + 20;

            //populate months
            for (int i = 1; i < 13; i++)
            {
                Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i));
            }

            //populate year
            for (int i = startYear; i < endYear; i++)
            {
                Year.Add(i.ToString());
            }

            Date.Add(Year);
            Date.Add(Month);
        }
Пример #10
0
        private void PopulateDateCollection()
        {
            //populate Days
            for (int i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
            {
                if (i < 10)
                {
                    Day.Add("0" + i);
                }
                else
                {
                    Day.Add(i.ToString());
                }
            }

            //populate year
            for (int i = 1990; i < 2050; i++)
            {
                Year.Add(i.ToString());
            }


            //populate months

            for (int i = 1; i < 13; i++)
            {
                if (!Months.ContainsKey(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3)))
                {
                    Months.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i));
                }
                Month.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i).Substring(0, 3));
            }
            Date.Add(Year);
            Date.Add(Month);
            Date.Add(Day);

            for (int i = 1; i <= 24; i++)
            {
                if (i < 10)
                {
                    Hour.Add("0" + i.ToString());
                }
                else
                {
                    Hour.Add(i.ToString());
                }
            }
            for (int j = 0; j < 60; j++)
            {
                if (j < 10)
                {
                    Minute.Add("0" + j);
                }
                else
                {
                    Minute.Add(j.ToString());
                }
            }



            Date.Add(Hour);
            Date.Add(Minute);
        }