Beispiel #1
0
        public void LoadJobSchedule(JobSchedule schedule)
        {
            if (schedule == null) return;

            mtbRuntime.Text = schedule.Daily.RunAt.ToString();
            mtbEvery.Text = schedule.Daily.Every.ToString("00");
        }
Beispiel #2
0
 public void UpdateJobSchedule(JobSchedule schedule)
 {
     schedule.Daily.Every = int.Parse(mtbEvery.Text.Trim());
     schedule.Daily.RunAt =
         new HourMinute
         {
             Hour = int.Parse(mtbRuntime.Text.Substring(0, 2)),
             Minute = int.Parse(mtbRuntime.Text.Substring(3, 2))
         };
 }
Beispiel #3
0
        public ArchiveJob()
        {
            UniqueJobName = "New Job";
            JobRootPath = "C:\\";
            JobTarget = new Target();
            Schedules = new List<JobSchedule>();
            Active = true;

            var defSchedule = new JobSchedule();
            Schedules.Add(defSchedule);
        }
Beispiel #4
0
        public void LoadJobSchedule(JobSchedule schedule)
        {
            if (schedule == null) return;

            mtbRuntime.Text = schedule.Monthly.RunAt.ToString();
            mtbEvery.Text = schedule.Monthly.Every.ToString("00");
            mtbDay.Text = schedule.Monthly.DayOffset.ToString("00");

            rbFromBegin.Checked = schedule.Monthly.RelativeTo == JobRelativeTo.BeginOfTheMonth;
            rbFromEnd.Checked = schedule.Monthly.RelativeTo == JobRelativeTo.EndOfTheMonth;
            rbFromSunday.Checked = schedule.Monthly.RelativeTo == JobRelativeTo.FirstSundayOfTheMonth;
        }
Beispiel #5
0
        public void UpdateJobSchedule(JobSchedule schedule)
        {
            schedule.Monthly.Every = int.Parse(mtbEvery.Text.Trim());
            schedule.Monthly.DayOffset = int.Parse(mtbDay.Text.Trim());
            schedule.Monthly.RunAt =
                new HourMinute
                {
                    Hour = int.Parse(mtbRuntime.Text.Substring(0, 2)),
                    Minute = int.Parse(mtbRuntime.Text.Substring(3, 2))
                };

            if(rbFromBegin.Checked)         schedule.Monthly.RelativeTo = JobRelativeTo.BeginOfTheMonth;
            else if(rbFromEnd.Checked)      schedule.Monthly.RelativeTo = JobRelativeTo.EndOfTheMonth;
            else if(rbFromSunday.Checked)   schedule.Monthly.RelativeTo = JobRelativeTo.FirstSundayOfTheMonth;
        }
Beispiel #6
0
        public void LoadJobSchedule(JobSchedule schedule)
        {
            if (schedule==null) return;

            mtbRuntime.Text = schedule.Weekly.RunAt.ToString();

            cbMonday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Monday);
            cbTuesday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Tuesday);
            cbWednesday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Wednesday);
            cbThrusday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Thursday);
            cbFriday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Friday);
            cbSaturday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Saturday);
            cbSunday.Checked = schedule.Weekly.JobDays.HasFlag(JobDays.Sunday);

            mtbEvery.Text = schedule.Weekly.Every.ToString("00");
        }
Beispiel #7
0
        public void UpdateJobSchedule(JobSchedule schedule)
        {
            schedule.Weekly.Every = int.Parse(mtbEvery.Text.Trim());
            schedule.Weekly.RunAt =
                new HourMinute
                {
                    Hour = int.Parse(mtbRuntime.Text.Substring(0, 2)),
                    Minute = int.Parse(mtbRuntime.Text.Substring(3, 2))
                };

            schedule.Weekly.JobDays = 0;

            if(cbMonday.Checked)  schedule.Weekly.JobDays|=JobDays.Monday;
            if(cbTuesday.Checked)  schedule.Weekly.JobDays|=JobDays.Tuesday;
            if(cbWednesday.Checked)  schedule.Weekly.JobDays|=JobDays.Wednesday;
            if(cbThrusday.Checked) schedule.Weekly.JobDays|=JobDays.Thursday;
            if(cbFriday.Checked)  schedule.Weekly.JobDays|=JobDays.Friday;
            if(cbSaturday.Checked)  schedule.Weekly.JobDays|=JobDays.Saturday;
            if(cbSunday.Checked)  schedule.Weekly.JobDays|=JobDays.Sunday;
        }
Beispiel #8
0
        private void lbAllSchedule_SelectedIndexChanged(object sender, EventArgs e)
        {
            var active = lbAllSchedule.SelectedItem as string;
            _archiveJob = string.IsNullOrEmpty(active) ? null : _serverLink.LoadArchiveJob(active);
            _schedule = null;

            if (_archiveJob != null)
            {
                //btnDelSchedule.Enabled = true;
                btnDelArchive.Enabled = true;
            }
            SyncGuiWithArchive();
        }
Beispiel #9
0
        private void cbAllSchedules_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(_suspendJobCheckEvents) return;
            _suspendJobCheckEvents = true;

            if (_schedule != null)
            {
                cbAllSchedules.Items[_scheduleItemCurSel] = _schedule;
            }

            _scheduleItemCurSel = cbAllSchedules.SelectedIndex;
            var itm = (JobSchedule)cbAllSchedules.SelectedItem;
            panelSchedule.Controls.Clear();

            if (_current != null && _schedule != null) _current.UpdateJobSchedule(_schedule);
            _schedule = itm;

            cbForceFullbackup.Checked = itm.ForceFullBackup;
            rdSchedDaily.Checked = false;
            rdSchedWeekly.Checked = false;
            rdSchedMonthly.Checked = false;
            switch (itm.ScheduleType)
            {
            case JobScheduleType.Daily:
                rdSchedDaily.Checked = true;
                _current = new DailySchedule();
                break;
            case JobScheduleType.Weekly:
                _current = new WeeklySchedule();
                rdSchedWeekly.Checked = true;
                break;
            case JobScheduleType.Monthly:
                _current = new MonthlySchedule();
                rdSchedMonthly.Checked = true;
                break;
            default:
                throw new Exception("Unexpected!");
            }
            panelSchedule.Controls.Add((UserControl)_current);
            _current.LoadJobSchedule(itm);
            _current.EnableEdit(true);
            _suspendJobCheckEvents = false;
        }
Beispiel #10
0
 private void btnNewArchive_Click(object sender, EventArgs e)
 {
     lbAllSchedule.SelectedItem = null;
     _suspendJobCheckEvents = true;
     _archiveJob = new ArchiveJob();
     _schedule = null;
     btnDelSchedule.Enabled = false;
     lbAllSchedule.SelectedItem = null;
     _suspendJobCheckEvents = false;
     SyncGuiWithArchive();
 }
Beispiel #11
0
        private void btnDelSchedule_Click(object sender, EventArgs e)
        {
            _suspendJobCheckEvents = true;
            cbAllSchedules.Items.RemoveAt(cbAllSchedules.SelectedIndex);
            _schedule = null;
            _suspendJobCheckEvents = false;

            cbAllSchedules.SelectedIndex = 0;
            if (cbAllSchedules.Items.Count == 1) btnDelSchedule.Enabled = false;
        }
Beispiel #12
0
        public void ReadXml(XmlReader reader)
        {
            var val = reader.GetAttribute("uid");
            JobUID = string.IsNullOrEmpty(val) ? null : (int?)int.Parse(val);
            UniqueJobName = reader.GetAttribute("name");
            JobRootPath = reader.GetAttribute("path");
            Active = int.Parse(reader.GetAttribute("active")??"0") != 0;

            //- Read target
            reader.Read(); if (reader.Name != "Target") throw new Exception("Expecting Target node");
            JobTarget = new Target();
            JobTarget.ReadXml(reader);
            //reader.ReadEndElement();

            //- Read Schedule
            reader.Read(); if (reader.Name != "Schedules") throw new Exception("Expecting Schedules node");
            Schedules.Clear();
            reader.Read();
            for (;;)
            {
                if(reader.NodeType== XmlNodeType.EndElement) break;
                var schedule = new JobSchedule();
                schedule.ReadXml(reader);
                Schedules.Add(schedule);
            }
            reader.ReadEndElement();
        }