Exemplo n.º 1
0
 public void update_a_job_for_a_user(int userJobID, string uj_name)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         UserJobs usr_j = dbContext.UserJobs.Find(userJobID);
         usr_j.name = uj_name;
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void delete_a_job_from_a_usr(string jName)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         UserJobs usr_j = dbContext.UserJobs.Where(x => x.name == jName).FirstOrDefault();
         dbContext.UserJobs.Remove(usr_j);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void UserJobs_REMOVE_for_a_user(UserSqlBackup _usr, UserJobs uj)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         var usr = dbContext.User.Find(_usr.Id);
         usr.UserJobs.Add(uj);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public Selected_Job_And_Details()
 {
     selectedJob            = new UserJobs();
     DbServerParameters     = new DbServerParameters();
     dbNamesOnThisDbServers = new List <DbNameOnThisDbServer>();
     Schedule            = new Schedule();
     Destination_Local   = new Destination_Local();
     Destination_Network = new Destination_Network();
     Destination_Cloud   = new Destination_Cloud();
 }
Exemplo n.º 5
0
 public Schedule schedule_Create_for_a_job(Schedule schedule, UserJobs userJob)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         schedule.UserJobsId = userJob.Id;
         dbContext.Schedule.Add(schedule);
         dbContext.SaveChanges();
         return(schedule);
     }
 }
Exemplo n.º 6
0
 public void create_a_job_for_a_user(int usr_ID, string uj_name)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         UserJobs uj = new UserJobs();
         uj.name            = uj_name;
         uj.UserSqlBackupId = usr_ID;
         dbContext.UserJobs.Add(uj);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void delete_a_DbServerAndDbNames_from_a_job(string jobName)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         UserJobs           usr_j = dbContext.UserJobs.Where(x => x.name == jobName).FirstOrDefault();
         DbServerParameters dbServerParameters      = dbContext.DbServerParameters.Where(x => x.UserJobsId == usr_j.Id).FirstOrDefault();
         ICollection <DbNameOnThisDbServer> dbNames = dbContext.DbNameOnThisDbServer.Where(x => x.DbServerParametersId == dbServerParameters.Id).ToList();
         foreach (DbNameOnThisDbServer dbn in dbNames)
         {
             dbContext.DbNameOnThisDbServer.Remove(dbn);
         }
         dbContext.DbServerParameters.Remove(dbServerParameters);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 8
0
        public IActionResult JobsApplied(Models.JobsApplied model)
        {
            var jerbId = 0;

            //Add New Jerb to Database if it doesnt exist
            var newJerbQuery = _db.JobsApplied.FirstOrDefault(x => x.Company == model.Company && x.Position == model.Position);

            if (newJerbQuery != null)
            {
                jerbId = newJerbQuery.Id;
            }
            else
            {
                var addNewJerb = new Models.JobsApplied
                {
                    Company     = model.Company,
                    DateApplied = model.DateApplied,
                    Interview   = model.Interview,
                    Position    = model.Position
                };

                _db.JobsApplied.Add(addNewJerb);
                _db.SaveChanges();
            }


            var userJobQuery =
                _db.UserJobs.FirstOrDefault(o => o.Email == _userManager.GetUserName(User) && o.JobId == jerbId);

            if (userJobQuery != null)
            {
                return(View());
            }
            var addUserJerb = new UserJobs
            {
                Email = _userManager.GetUserName(User),
                JobId = jerbId
            };

            _db.UserJobs.Add(addUserJerb);
            _db.SaveChanges();

            return(View());
        }
Exemplo n.º 9
0
        public void update_VM_with_schedule_with_jobName(Schedule schedule, string jN)
        {
            using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
            {
                UserJobs uj = new UserJobs();
                uj = dbContext.UserJobs.Where(x => x.name == jN).FirstOrDefault();

                var sc = dbContext.Schedule.Where(x => x.UserJobsId == uj.Id).FirstOrDefault();

                if (sc == null)
                {
                    schedule.UserJobsId = uj.Id;
                    dbContext.Schedule.Add(schedule);
                }
                else
                {
                    uj.Schedule = sc;
                }
                dbContext.SaveChanges();
            }
        }
Exemplo n.º 10
0
        public async Task SaveJobAsync(Guid jobId, string userId)
        {
            var existingUserJob = this.db.UserJobs.FirstOrDefault(x => x.JobId == jobId && x.UserId == userId);

            if (existingUserJob != null)
            {
                existingUserJob.Saved = true;
                await this.db.SaveChangesAsync();

                return;
            }

            UserJobs uj = new UserJobs
            {
                JobId  = jobId,
                UserId = userId,
                Saved  = true
            };

            await this.db.UserJobs.AddAsync(uj);

            await this.db.SaveChangesAsync();
        }
Exemplo n.º 11
0
        public Schedule schedule_Update_for_job(Schedule schedule, UserJobs userJob)
        {
            using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
            {
                Schedule _schedule = dbContext.Schedule.Where(x => x.UserJobsId == userJob.Id).FirstOrDefault();

                _schedule.IsMonday    = schedule.IsMonday;
                _schedule.IsThursday  = schedule.IsThursday;
                _schedule.IsWednesday = schedule.IsWednesday;
                _schedule.IsTuesday   = schedule.IsTuesday;
                _schedule.IsFriday    = schedule.IsFriday;
                _schedule.IsSaturday  = schedule.IsSaturday;
                _schedule.IsSunday    = schedule.IsSunday;

                _schedule.howmanyBackup = schedule.howmanyBackup;
                _schedule.interval      = schedule.interval;
                _schedule.StartDateTime = schedule.StartDateTime;

                dbContext.Schedule.Update(_schedule);

                dbContext.SaveChanges();
                return(_schedule);
            }
        }
Exemplo n.º 12
0
 public IActionResult GetUser()
 {
     UserJobs.GetUserList();
     return(Ok($"Recurring Job Scheduled. Invoice will be mailed 2 minute for!"));
 }
Exemplo n.º 13
0
 public static void UseCustomJobs(this IApplicationBuilder app)
 {
     UserJobs.GetUserList();
 }
Exemplo n.º 14
0
 public DbServerParameters DB_Server_Parameters_CREATE_for_job(DbServerParameters dbServerParameters, UserJobs usrJob)
 {
     using (DbContextSqlBackup dbContext = new DbContextSqlBackup())
     {
         dbServerParameters.UserJobsId = usrJob.Id;
         dbContext.DbServerParameters.Add(dbServerParameters);
         dbContext.SaveChanges();
     }
     return(dbServerParameters);
 }