Exemplo n.º 1
0
        private void CheckForceLogOffFlags()
        {
            int officeId = AppUsers.GetCurrent().View.OfficeId.ToInt();
            Collection <FrequencyDates> applicationDates =
                Dates.GetFrequencyDates(AppUsers.GetCurrentUserDB());

            if (applicationDates == null)
            {
                return;
            }
            FrequencyDates model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));


            if (model == null)
            {
                return;
            }

            if (model.ForcedLogOffTimestamp == null || model.ForcedLogOffTimestamp.Equals(DateTime.MinValue))
            {
                return;
            }

            if (model.ForcedLogOffTimestamp <= DateTime.Now &&
                model.ForcedLogOffTimestamp >= AppUsers.GetCurrent().View.LoginDateTime)
            {
                this.RequestLoginPage();
            }
        }
Exemplo n.º 2
0
        private static void ForceLogOff(int officeId)
        {
            Collection <FrequencyDates> applicationDates = Dates.GetFrequencyDates(AppUsers.GetCurrentUserDB());
            DateTime forcedLogOffOn = DateTime.Now.AddMinutes(2);

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

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

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


                    Dates.SetApplicationDates(AppUsers.GetCurrentUserDB(), applicationDates);
                }
            }
        }
Exemplo n.º 3
0
        private void InitializeDate()
        {
            if (this.officeId.Equals(0))
            {
                return;
            }

            FrequencyDates model = DatePersister.GetFrequencyDates(this.Catalog, this.officeId);

            DateTime date = model.Today;

            switch (this.mode)
            {
            case FrequencyType.MonthStartDate:
                date = model.MonthStartDate;
                break;

            case FrequencyType.MonthEndDate:
                date = model.MonthEndDate;
                break;

            case FrequencyType.QuarterStartDate:
                date = model.QuarterStartDate;
                break;

            case FrequencyType.QuarterEndDate:
                date = model.QuarterEndDate;
                break;

            case FrequencyType.HalfStartDate:
                date = model.FiscalHalfStartDate;
                break;

            case FrequencyType.HalfEndDate:
                date = model.FiscalHalfEndDate;
                break;

            case FrequencyType.FiscalYearStartDate:
                date = model.FiscalYearStartDate;
                break;

            case FrequencyType.FiscalYearEndDate:
                date = model.FiscalYearEndDate;
                break;
            }


            if (this.textBox != null)
            {
                this.textBox.Text = date.ToShortDateString();
            }
        }
Exemplo n.º 4
0
        public bool Reconcile(string tranCode, int year, int month, int day)
        {
            DateTime bookDate = new DateTime(year, month, day);
            string   catalog  = AppUsers.GetCurrentUserDB();
            int      officeId = AppUsers.GetCurrent().View.OfficeId.ToInt();

            FrequencyDates model = DatePersister.GetFrequencyDates(catalog, officeId);


            if (bookDate > model.FiscalYearEndDate)
            {
                throw new MixERPException(Warnings.InvalidDate);
            }

            return(Transaction.Reconcile(AppUsers.GetCurrentUserDB(), tranCode, bookDate));
        }
Exemplo n.º 5
0
        private bool IsYearEnd()
        {
            Collection <FrequencyDates> applicationDates = Dates.GetFrequencyDates(AppUsers.GetCurrentUserDB());

            if (applicationDates == null || applicationDates.Count.Equals(0))
            {
                applicationDates = Data.Helpers.DateHelper.GetFrequencyDates(AppUsers.GetCurrentUserDB());
            }

            FrequencyDates model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId));

            if (model != null)
            {
                return(model.FiscalYearEndDate == model.Today);
            }

            return(false);
        }
Exemplo n.º 6
0
        private static FrequencyDates GetApplicationDateModel(DataRow row)
        {
            if (row == null)
            {
                return(null);
            }

            FrequencyDates applicationDate = new FrequencyDates();

            applicationDate.OfficeId            = Conversion.TryCastInteger(row["office_id"]);
            applicationDate.Today               = Conversion.TryCastDate(row["today"]);
            applicationDate.MonthStartDate      = Conversion.TryCastDate(row["month_start_date"]);
            applicationDate.MonthEndDate        = Conversion.TryCastDate(row["month_end_date"]);
            applicationDate.QuarterStartDate    = Conversion.TryCastDate(row["quarter_start_date"]);
            applicationDate.QuarterEndDate      = Conversion.TryCastDate(row["quarter_end_date"]);
            applicationDate.FiscalHalfStartDate = Conversion.TryCastDate(row["fiscal_half_start_date"]);
            applicationDate.FiscalHalfEndDate   = Conversion.TryCastDate(row["fiscal_half_end_date"]);
            applicationDate.FiscalYearStartDate = Conversion.TryCastDate(row["fiscal_year_start_date"]);
            applicationDate.FiscalYearEndDate   = Conversion.TryCastDate(row["fiscal_year_end_date"]);

            return(applicationDate);
        }
Exemplo n.º 7
0
        private static void SuggestDateReload()
        {
            int officeId = AppUsers.GetCurrent().View.OfficeId.ToInt();
            Collection <FrequencyDates> applicationDates = Dates.GetFrequencyDates(AppUsers.GetCurrentUserDB());

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

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


                    Dates.SetApplicationDates(AppUsers.GetCurrentUserDB(), applicationDates);
                }
            }
        }