private static ApplicationDateModel GetApplicationDates() { int officeId = CurrentSession.GetOfficeId(); Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); bool persist = false; if (applicationDates == null || applicationDates.Count.Equals(0)) { applicationDates = Data.Frequency.GetApplicationDates(); persist = true; } else { for (int i = 0; i < applicationDates.Count; i++) { if (applicationDates[i].NewDayStarted) { int modelOfficeId = applicationDates[i].OfficeId; applicationDates.Remove(applicationDates[i]); applicationDates.Add(Data.Frequency.GetApplicationDates(modelOfficeId)); persist = true; } } } if (persist) { ApplicationStateHelper.SetApplicationDates(applicationDates); } return(applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId))); }
private void SuggestDateReload() { int officeId = CurrentSession.GetOfficeId(); Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); if (applicationDates != null) { ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)); if (model != null) { applicationDates.Add(new ApplicationDateModel(model.OfficeId, model.Today, model.MonthStartDate, model.MonthEndDate, model.QuarterStartDate, model.QuarterEndDate, model.FiscalHalfStartDate, model.FiscalHalfEndDate, model.FiscalYearStartDate, model.FiscalYearEndDate, true)); applicationDates.Remove(model); ApplicationStateHelper.SetApplicationDates(applicationDates); } } }
private void ForceLogOff(int officeId) { Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); DateTime forcedLogOffOn = DateTime.Now.AddMinutes(2); if (applicationDates != null) { ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)); if (model != null) { applicationDates.Add(new ApplicationDateModel(model.OfficeId, model.Today, model.MonthStartDate, model.MonthEndDate, model.QuarterStartDate, model.QuarterEndDate, model.FiscalHalfStartDate, model.FiscalHalfEndDate, model.FiscalYearStartDate, model.FiscalYearEndDate, false, forcedLogOffOn)); applicationDates.Remove(model); ApplicationStateHelper.SetApplicationDates(applicationDates); } } }