Ejemplo n.º 1
0
        public static PFSchedule CreateScheduleFromScreenInput(MainForm frm)
        {
            PFSchedule sked = new PFSchedule(frm.txtScheduleName.Text.Trim());

            try
            {
                _msg.Length = 0;
                _msg.Append("CreateScheduleFromScreenInput started ...\r\n");
                Program._messageLog.WriteLine(_msg.ToString());

                enScheduleFrequency skedFreq = PFScheduler.GetScheduleFrequency(frm.cboScheduleFrequency.Text.Trim());

                if (frm.txtCurrDateTime.Text.Trim().Length == 0)
                {
                    frm.txtCurrDateTime.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
                }

                switch (skedFreq)
                {
                case enScheduleFrequency.OneTime:
                    CreateRunOneTimeSchedule(frm, sked);
                    break;

                case enScheduleFrequency.Daily:
                    CreateDailySchedule(frm, sked);
                    break;

                case enScheduleFrequency.Weekly:
                    CreateWeeklySchedule(frm, sked);
                    break;

                case enScheduleFrequency.Monthly:
                    CreateMonthlySchedule(frm, sked);
                    break;

                default:
                    _msg.Length = 0;
                    _msg.Append("Unexpected or invalid schedule frequency: ");
                    _msg.Append(frm.txtScheduleName.Text.Trim());
                    throw new System.Exception(_msg.ToString());
                    //break;
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                _msg.Length = 0;
                _msg.Append("\r\n... CreateScheduleFromScreenInput finished.");
                Program._messageLog.WriteLine(_msg.ToString());
            }

            return(sked);
        }
Ejemplo n.º 2
0
        //tests
        public static void RunTest(MainForm frm)
        {
            enScheduleFrequency skedFreq = enScheduleFrequency.Unknown;

            try
            {
                _msg.Length = 0;
                _msg.Append("RunTest started ...\r\n");
                Program._messageLog.WriteLine(_msg.ToString());

                skedFreq = PFScheduler.GetScheduleFrequency(frm.cboScheduleFrequency.Text);

                switch (skedFreq)
                {
                case enScheduleFrequency.OneTime:
                    RunOneTimeTest(frm);
                    break;

                case enScheduleFrequency.Daily:
                    RunDailyTest(frm);
                    break;

                case enScheduleFrequency.Weekly:
                    RunWeeklyTest(frm);
                    break;

                case enScheduleFrequency.Monthly:
                    RunMonthlyTest(frm);
                    break;

                default:
                    break;
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                _msg.Length = 0;
                _msg.Append("\r\n... RunTest finished.");
                Program._messageLog.WriteLine(_msg.ToString());
            }
        }