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(); } }
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(); } }
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(); } }
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(); }
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); } }
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(); } }
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(); } }
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()); }
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(); } }
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(); }
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); } }
public IActionResult GetUser() { UserJobs.GetUserList(); return(Ok($"Recurring Job Scheduled. Invoice will be mailed 2 minute for!")); }
public static void UseCustomJobs(this IApplicationBuilder app) { UserJobs.GetUserList(); }
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); }