Example #1
0
 public EmailSchedule()
 {
     InitializeComponent();
     firedumpdbDataSet.schedulesDataTable scheduletable = new firedumpdbDataSet.schedulesDataTable();
     scheduleAdapter.FillOrderByDate(scheduletable);
     dataGridView1.DataSource = scheduletable;
 }
Example #2
0
        private void onJobSetDetails(JobDetail jobDetails)
        {
            Random rnd = new Random();
            int    sec = rnd.Next(10, 50);

            jobDetails.Second = sec;

            newJobs.Add(jobDetails);
            Console.WriteLine(jobDetails.DayOfWeek);

            firedumpdbDataSetTableAdapters.schedulesTableAdapter scheduleAdapter = new firedumpdbDataSetTableAdapters.schedulesTableAdapter();
            scheduleAdapter.Insert((int)jobDetails.Server.id, jobDetails.Name, DateTime.Now, jobDetails.Activate, jobDetails.Hour, jobDetails.Database, "-", jobDetails.Minute, jobDetails.Second, jobDetails.DayOfWeek);
            firedumpdbDataSet.schedulesDataTable scheduleTable = new firedumpdbDataSet.schedulesDataTable();

            scheduleAdapter.FillIdByName(scheduleTable, jobDetails.Name);
            int scheduleId = (int)scheduleTable[0].id;
            int locId      = jobDetails.LocationId;

            firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter savelocAdapter = new firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter();
            savelocAdapter.Insert(scheduleId, locId);

            firedumpdbDataSetTableAdapters.backup_locationsTableAdapter backAdapter = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
            firedumpdbDataSet.backup_locationsDataTable backuptable = new firedumpdbDataSet.backup_locationsDataTable();
            backuptable = backAdapter.GetDataByID(locId);
            dataGridViewlocs.DataSource = backuptable;

            scheduleAdapter.FillOrderByDate(scheduleTable);
            dataGridView1.DataSource = scheduleTable;
        }
Example #3
0
        public SchedulerForm()
        {
            InitializeComponent();
            firedumpdbDataSetTableAdapters.schedulesTableAdapter scheduleAdapter = new firedumpdbDataSetTableAdapters.schedulesTableAdapter();
            firedumpdbDataSet.schedulesDataTable scheduleTable = new firedumpdbDataSet.schedulesDataTable();
            scheduleAdapter.FillOrderByDate(scheduleTable);

            dataGridView1.DataSource = scheduleTable;
        }
Example #4
0
        public void TestSetUpScheduleList()
        {
            schedules = new List <firedumpdbDataSet.schedulesRow>();
            firedumpdbDataSet.schedulesDataTable schedulestable = new firedumpdbDataSet.schedulesDataTable();
            schedulesTableAdapter adapter = new schedulesTableAdapter();

            adapter.FillOrderByDate(schedulestable);

            Assert.IsTrue(schedulestable.Count > 0);
            for (int i = 0; i < schedulestable.Count; i++)
            {
                schedules.Add(schedulestable[i]);
            }
        }
Example #5
0
        private void setUpScheduleList()
        {
            scheduleQueue?.Clear();
            scheduleQueue    = new Queue <ScheduleManager>();
            schedules        = new firedumpdbDataSet.schedulesDataTable();
            schedulesAdapter = new firedumpdbDataSetTableAdapters.schedulesTableAdapter();

            //FillByDateOrder
            schedulesAdapter.FillOrderByDate(schedules);

            scheduleRowList = new List <firedumpdbDataSet.schedulesRow>();
            //copy schedules to List<>scheduleRowList
            for (int i = 0; i < schedules.Count; i++)
            {
                scheduleRowList.Add(schedules[i]);
            }
        }
Example #6
0
        private bool isTimeValid(int day, int hour, int minute)
        {
            firedumpdbDataSetTableAdapters.schedulesTableAdapter scheduleAdapter = new firedumpdbDataSetTableAdapters.schedulesTableAdapter();
            firedumpdbDataSet.schedulesDataTable scheduletable = new firedumpdbDataSet.schedulesDataTable();
            scheduleAdapter.FillOrderByDate(scheduletable);
            if (scheduletable.Count > 0)
            {
                foreach (firedumpdbDataSet.schedulesRow row in scheduletable)
                {
                    if (isScheduleOverLap(row, day, hour, minute))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #7
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            if (e.ColumnIndex == 1)
            {
                int scheduleId = 0;
                if (int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(), out scheduleId))
                {
                    if (scheduleId != -1)
                    {
                        DialogResult result = MessageBox.Show("Are you sure you want to delete this Job?", "Delete Schedule-Job", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result == DialogResult.Yes)
                        {
                            //delete from userinfo, schedule_save_location and logs first
                            //userinfo
                            firedumpdbDataSetTableAdapters.userinfoTableAdapter userAdapter = new firedumpdbDataSetTableAdapters.userinfoTableAdapter();
                            userAdapter.DeleteQueryByScheduleid(scheduleId);

                            //logs
                            firedumpdbDataSetTableAdapters.logsTableAdapter logAdapter = new firedumpdbDataSetTableAdapters.logsTableAdapter();
                            logAdapter.DeleteQueryByScheduleid(scheduleId);

                            //save_locations
                            firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter saveLocAdapter = new firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter();
                            saveLocAdapter.DeleteQueryByScheduleId(scheduleId);

                            //last delete from schedule
                            schedulesTableAdapter.DeleteQueryById(scheduleId);

                            firedumpdbDataSet.schedulesDataTable scheduleTable = new firedumpdbDataSet.schedulesDataTable();
                            schedulesTableAdapter.FillOrderByDate(scheduleTable);
                            dataGridView1.DataSource = scheduleTable;
                        }
                    }
                }
            }
            else
            {
                int scheduleId = 0;
                if (int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(), out scheduleId))
                {
                    if (scheduleId != -1)
                    {
                        firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter savelocAdapter = new firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter();
                        firedumpdbDataSetTableAdapters.backup_locationsTableAdapter        backAdapter    = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
                        firedumpdbDataSet.schedule_save_locationsDataTable saveloctable = new firedumpdbDataSet.schedule_save_locationsDataTable();
                        savelocAdapter.FillByScheduleId(saveloctable, scheduleId);
                        firedumpdbDataSet.backup_locationsDataTable backuptable = new firedumpdbDataSet.backup_locationsDataTable();
                        if (saveloctable.Count > 0)
                        {
                            backuptable = backAdapter.GetDataByID(saveloctable[0].backup_location_id);
                            dataGridViewlocs.DataSource = backuptable;
                        }
                        //MessageBox.Show(scheduleId+" "+saveloctable.Count.ToString());
                    }
                }
            }
        }