/// <summary>
        ///     Gets the license text with appropriate substitutions (e.g. year, owner)
        /// </summary>
        /// <returns>The finalised text of the license</returns>
        public string GetLicenseText()
        {
            var yearstring = "";

            if (Years == null || Years.Length == 0)
            {
                yearstring = DateTime.Now.Year.ToString();
            }
            else if (Years.Length == 1)
            {
                yearstring = Years.First().ToString();
            }
            else if (ShowYearsAsRange)
            {
                yearstring = $"{Years.First()}-{Years.Last()}";
            }
            else
            {
                yearstring = string.Join(", ", Years);
            }

            if (_type == LicenseType.Mit)
            {
                return(string.Format(Resources.MIT, Environment.NewLine, Copyright));
            }
            if (_type == LicenseType.CustomOrNone)
            {
                return(_customLicense);
            }

            return(null);
        }
 public ClassResultsViewModel()
 {
     LoadYears();
     if (Years.Any())
     {
         CurrentYear = Years.First();
     }
 }
 public EditPerformanceViewModel()
 {
     LoadYears();
     if (Years.Any())
     {
         CurrentYear = Years.First();
     }
 }
Exemple #4
0
        public FriendlyDateRangePicker()
        {
            var currentDate = DateTime.Now;

            Years         = DateSegmentViewModel.GetYears(currentDate.Year - 3);
            SelectedYear  = Years.First(p => p.Value == currentDate.Year);
            SelectedMonth = Months.First(p => p.Value == currentDate.Month);
            SelectedDay   = Days.First(p => p.Value == currentDate.Day);
            MonthDuration = 1;

            InitializeComponent();
        }
Exemple #5
0
        private void AddEmptyDocumentsForCurrentYear(IEnumerable <DocumentType> documentTypes)
        {
            var currentYear            = Years.First(y => y.IntYear == DateTime.Now.Year);
            var currentDocumentTypeIds = currentYear.DocumentLinks.Select(dl => dl.DocumentTypeID);

            foreach (var documentType in documentTypes)
            {
                if (!currentDocumentTypeIds.Contains(documentType.DocumentTypeID))
                {
                    currentYear.DocumentLinks.Add(new DocumentLink
                    {
                        DocumentTypeID = documentType.DocumentTypeID,
                        Name           = documentType.Name
                    });
                }
            }
        }
        public async Task LoadYears()
        {
            using var db = new AppDbContext();

            Years = db.WorkoutPlans
                    .GroupBy(x => x.AddedDate.Year)
                    .Select(x => new Year {
                YearNumber = x.Key
            })
                    .ToObservableCollection();

            if (Years.Count == 0)
            {
                Years.Add(new Year
                {
                    YearNumber = DateTime.Now.Year
                });
            }

            TargetYear = Years.First();
        }
Exemple #7
0
        /// <summary>
        /// Loads years from the birth year
        /// TODO change birth date
        /// </summary>
        public async Task LoadYears()
        {
            //if (AppSession.User != null && !string.IsNullOrEmpty(AppSession.User.BirthDate))
            //{
            //}

            var birthDateTime = new DateTime(1998, 2, 27);

            //if (DateTime.TryParse(AppSession.User.BirthDate, Settings.CultureInfo, DateTimeStyles.None, out DateTime birthDateTime))
            if (birthDateTime != null)
            {
                var currentYear = DateTime.Now.Year;

                if (birthDateTime.Year < currentYear)
                {
                    for (int i = 0; i < (currentYear - birthDateTime.Year) + 1; i++)
                    {
                        Years.Add(new Year()
                        {
                            YearNumber = birthDateTime.Year + i
                        });
                    }

                    Years      = Years.OrderByDescending(x => x.YearNumber).ToList();
                    TargetYear = Years.First();

                    return;
                }
                else if (birthDateTime.Year > currentYear)
                {
                    MessageBox.Show("Birth year bigger than curren year, check your birth date and system date time settings");
                    return;
                }
            }

            // default year = current year
            TargetYear.YearNumber = DateTime.Now.Year;
            Years.Add(TargetYear);
        }
Exemple #8
0
 public async Task OnGetAsync()
 {
     SelectedYear = Years.First();
     ClassicView  = false;
     Installments = await GetInstallments().ToListAsync();
 }