コード例 #1
0
        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)));
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
ファイル: MixERPWebpage.cs プロジェクト: mixerp7/mixerp
        private void ForceLogOff()
        {
            int officeId = SessionHelper.GetOfficeId();
            Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates();

            if (applicationDates != null)
            {
                ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));
                if (model != null)
                {
                    if (model.ForcedLogOffTimestamp != null)
                    {
                        if (model.ForcedLogOffTimestamp <= DateTime.Now && model.ForcedLogOffTimestamp >= SessionHelper.GetSignInTimestamp())
                        {
                            RequestLogOnPage();
                        }
                    }
                }
            }
        }