public async Task RemoveSchedule(int id)
        {
            var model = databaseController.scheduleRepository.Get(id);

            if (model == null)
            {
                throw new Exception("Расписание не найдено, попробуйте обновить список, возможно, оно уже было удалено");
            }
            databaseController.scheduleRepository.Remove(model);
            await databaseController.CompleteAsync();
        }
Exemplo n.º 2
0
        public async Task SaveEmail(string emailToSave)
        {
            await RemoveAllBut_N_NewestEmails();

            var email = databaseController.emailRepository.Find(x => x.EmailString == emailToSave).FirstOrDefault();

            if (email == null)
            {
                databaseController.emailRepository.Add(new EMail()
                {
                    EmailString = emailToSave, dateTime = DateTime.Now
                });
            }
            else
            {
                email.dateTime = DateTime.Now;
            }
            await databaseController.CompleteAsync();
        }
Exemplo n.º 3
0
        public async Task SaveBackupPath(string pathToSave)
        {
            await RemoveAllBut_N_NewestPaths();

            var path = databaseController.pathRepository.Find(x => x.PathString == pathToSave).FirstOrDefault();

            if (path == null)
            {
                databaseController.pathRepository.Add(new BackupPath()
                {
                    PathString = pathToSave, dateTime = DateTime.Now
                });
            }
            else
            {
                path.dateTime = DateTime.Now;
            }
            await databaseController.CompleteAsync();
        }
Exemplo n.º 4
0
        public async Task SaveTask(TaskModel model)
        {
            var JobModel = ClientModelToDBModel(model);
            var findItem = databaseController.jobRepository.Get(model.Id);

            if (findItem == null)
            {
                databaseController.jobRepository.Add(JobModel);
            }
            else
            {
                findItem.ScheduleID        = JobModel.ScheduleID;
                findItem.ServerName        = JobModel.ServerName;
                findItem.Databases         = string.Join(",", model.SelectedDatabases);
                findItem.EmailToNotify     = model.SelectedEmail;
                findItem.Path              = model.SelectedPath;
                findItem.NotifyAboutFinish = model.NotifyAboutFinish;
                findItem.IsEnabled         = model.Enabled;
                findItem.Name              = model.Name;
            }
            await databaseController.CompleteAsync();

            WindowsServiceEvents.TaskSaved();
        }