Exemplo n.º 1
0
        public static async Task <FrequencyDates> GetFrequencyDatesAsync(string tenant, int officeId)
        {
            var  applicationDates = GetFrequencyDates(tenant);
            bool persist          = false;

            if (applicationDates == null || applicationDates.Count.Equals(0))
            {
                applicationDates = await FiscalYears.GetFrequencyDatesAsync(tenant).ConfigureAwait(false);

                persist = true;
            }
            else
            {
                for (int i = 0; i < applicationDates.Count; i++)
                {
                    if (applicationDates[i].NewDayStarted)
                    {
                        int officeIdToRefresh = applicationDates[i].OfficeId;

                        applicationDates.Remove(applicationDates[i]);
                        applicationDates.Add(await FiscalYears.GetFrequencyDatesAsync(tenant, officeIdToRefresh).ConfigureAwait(false));
                        persist = true;
                    }
                }
            }

            if (persist)
            {
                SetApplicationDates(tenant, applicationDates);
            }

            return(applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> IndexAsync()
        {
            var meta = await AppUsers.GetCurrentAsync().ConfigureAwait(true);

            var model = await FiscalYears.GetFrequencyDatesAsync(this.Tenant, meta.OfficeId).ConfigureAwait(true);

            return(this.FrapidView(this.GetRazorView <AreaRegistration>("Tasks/EOD/Index.cshtml", this.Tenant), model));
        }
Exemplo n.º 3
0
 public FiscalYear GetCurrentFiscalYear()
 {
     return(FiscalYears.Where(f => f.StartDate <= DateTime.Today && f.EndDate >= DateTime.Today).FirstOrDefault());
 }