コード例 #1
0
ファイル: DatePersister.cs プロジェクト: ududsha/mixerp
        public static ApplicationDateModel GetApplicationDates(int officeId)
        {
            Collection <ApplicationDateModel> applicationDates = CacheFactory.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)
            {
                CacheFactory.SetApplicationDates(applicationDates);
            }

            return(applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)));
        }
コード例 #2
0
        private void ForceLogOff(int officeId)
        {
            Collection <ApplicationDateModel> applicationDates = CacheFactory.GetApplicationDates();
            DateTime forcedLogOffOn = DateTime.Now.AddMinutes(2);

            if (applicationDates != null)
            {
                ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));

                if (model != null)
                {
                    ApplicationDateModel item = model.Clone() as ApplicationDateModel;
                    if (item != null)
                    {
                        item.ForcedLogOffTimestamp = forcedLogOffOn;
                        item.NewDayStarted         = false;

                        applicationDates.Add(item);
                        applicationDates.Remove(model);
                    }


                    CacheFactory.SetApplicationDates(applicationDates);
                }
            }
        }
コード例 #3
0
ファイル: MixERPWebpage.cs プロジェクト: Oguima/mixerp
        private void CheckForceLogOffFlags()
        {
            int officeId = CurrentUser.GetSignInView().OfficeId.ToInt();
            Collection <ApplicationDateModel> applicationDates = CacheFactory.GetApplicationDates();

            if (applicationDates != null)
            {
                ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));

                if (model != null)
                {
                    if (model.ForcedLogOffTimestamp != null && !model.ForcedLogOffTimestamp.Equals(DateTime.MinValue))
                    {
                        if (model.ForcedLogOffTimestamp <= DateTime.Now && model.ForcedLogOffTimestamp >= CurrentUser.GetSignInView().LoginDateTime)
                        {
                            RequestLogOnPage();
                        }
                    }
                }
            }
        }
コード例 #4
0
        private void SuggestDateReload()
        {
            int officeId = CurrentUser.GetSignInView().OfficeId.ToInt();
            Collection <ApplicationDateModel> applicationDates = CacheFactory.GetApplicationDates();

            if (applicationDates != null)
            {
                ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));
                if (model != null)
                {
                    ApplicationDateModel item = model.Clone() as ApplicationDateModel;
                    if (item != null)
                    {
                        item.NewDayStarted = true;

                        applicationDates.Add(item);
                        applicationDates.Remove(model);
                    }


                    CacheFactory.SetApplicationDates(applicationDates);
                }
            }
        }