private void butDeleteSchedProc_Click(object sender, EventArgs e)
 {
     if (!_schedProcOld.IsNew && MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will delete the currently selected Scheduled Process. Continue?",
                                             "Delete Scheduled Process."))
     {
         ScheduledProcesses.Delete(_schedProcOld.ScheduledProcessNum);
     }
     DialogResult = DialogResult.OK;
 }
        private bool IsScheduled()
        {
            //If editing a scheduled process and click ok without changing values, do not warn.
            if (_schedProcEdit.ScheduledProcessNum == _schedProcOld.ScheduledProcessNum &&
                _schedProcEdit.ScheduledAction == _schedProcOld.ScheduledAction &&
                _schedProcEdit.TimeToRun.TimeOfDay == _schedProcOld.TimeToRun.TimeOfDay &&
                _schedProcEdit.FrequencyToRun == _schedProcOld.FrequencyToRun)
            {
                return(false);
            }
            List <ScheduledProcess> listSchedProc = ScheduledProcesses.CheckAlreadyScheduled(_schedProcEdit.ScheduledAction, _schedProcEdit.FrequencyToRun,
                                                                                             _schedProcEdit.TimeToRun);

            if (listSchedProc.Count < 1)
            {
                return(false);
            }
            return(true);
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!ValidateFields())
     {
         return;
     }
     SetScheduledProcessObject();
     if (IsScheduled())
     {
         MessageBox.Show("There is an identical Action already scheduled for that time and frequency.");
         return;
     }
     if (_schedProcEdit.IsNew)
     {
         ScheduledProcesses.Insert(_schedProcEdit);
     }
     else
     {
         ScheduledProcesses.Update(_schedProcEdit, _schedProcOld);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #4
0
        private void FillGrid()
        {
            List <ScheduledProcess> listScheduledProcesses = ScheduledProcesses.Refresh();

            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g(this, "Scheduled Action"), 120);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Frequency to Run"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Time To Run"), 75);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Time of Last Run"), 155);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            foreach (ScheduledProcess schedProc in listScheduledProcesses)
            {
                row = new GridRow();
                row.Cells.Add(schedProc.ScheduledAction.GetDescription());
                row.Cells.Add(schedProc.FrequencyToRun.GetDescription());
                row.Cells.Add(schedProc.TimeToRun.ToShortTimeString());
                if (schedProc.LastRanDateTime.Year > 1880)
                {
                    row.Cells.Add(schedProc.LastRanDateTime.ToString());
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Tag = schedProc;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }