Пример #1
0
        public override bool authenticate( )
        {
            Registry("authenticate schedule_base ");

            /// USER [ authenticate ]

            sch = new I_Scheduler(this);

            sch.ExclusiveAccess();

            if (!sch.selectIdentity(var_iPid.ToString()))
            {
                return(false);
            }

            sch.set_tg_status(Context.CLOSED);

            if (!sch.synchronize_I_Scheduler())
            {
                return(false);
            }

            sch.ReleaseExclusive();

            /// USER [ authenticate ] END

            Registry("authenticate done schedule_base ");

            return(true);
        }
Пример #2
0
        public override bool finish( )
        {
            Registry("finish schedule_base ");

            /// USER [ finish ]

            sch.ExclusiveAccess();

            if (!sch.selectIdentity(var_iPid.ToString()))
            {
                return(false);
            }

            sch.set_tg_status(Context.OPEN);

            switch (sch.get_tg_type())
            {
            case Scheduler.Daily:
            {
                int year   = DateTime.Now.Year;
                int month  = DateTime.Now.Month;
                int day    = DateTime.Now.Day;
                int hour   = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(0, 2));
                int minute = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(2, 2));

                sch.set_dt_prev(GetDataBaseTime(new DateTime(year, month, day, hour, minute, 0).AddDays(1)));

                break;
            }

            case Scheduler.Weekly:
            {
                int year   = DateTime.Now.Year;
                int month  = DateTime.Now.Month;
                int day    = DateTime.Now.Day;
                int hour   = Convert.ToInt32(sch.get_st_weekly_hhmm().Substring(0, 2));
                int minute = Convert.ToInt32(sch.get_st_weekly_hhmm().Substring(2, 2));

                sch.set_dt_prev(GetDataBaseTime(new DateTime(year, month, day, hour, minute, 0).AddDays(7)));

                break;
            }

            case Scheduler.Monthly:
            {
                int year   = DateTime.Now.Year;
                int month  = DateTime.Now.Month;
                int day    = DateTime.Now.Day;
                int hour   = Convert.ToInt32(sch.get_st_monthly_hhmm().Substring(0, 2));
                int minute = Convert.ToInt32(sch.get_st_monthly_hhmm().Substring(2, 2));

                sch.set_dt_prev(GetDataBaseTime(new DateTime(year, month, day, hour, minute, 0).AddMonths(1)));

                break;
            }

            default: break;
            }

            sch.set_dt_last(GetDataBaseTime());

            if (!sch.synchronize_I_Scheduler())
            {
                return(false);
            }

            sch.ReleaseExclusive();

            /// USER [ finish ] END

            Registry("finish done schedule_base ");

            if (remoteTransaction == true)
            {
                return(true);
            }

            return(true);
        }