public IActionResult RunWithParams(PowerShellParam psParam) { var jobServices = new JobServices(_scriptRepository, _scriptIO); jobServices.LaunchScriptWithParams(User.Identity.Name, psParam); return(RedirectToAction("Details", new { id = psParam.Id })); }
public IHttpActionResult GetAllJob() { JobServices jobService = CreateJobServices(); var jobs = jobService.GetAllJobs(); return(Ok(jobs)); }
private JobServices CreateJobServices() { var userid = Guid.Parse(User.Identity.GetUserId()); var jservices = new JobServices(userid); return(jservices); }
public IHttpActionResult GetJobByZipCode(int zipcode) { JobServices jobservices = CreateJobServices(); var job = jobservices.GetJobByZipCode(zipcode); return(Ok(job)); }
public IHttpActionResult GetJobById([FromUri] int id) { JobServices jobServices = CreateJobServices(); var job = jobServices.GetJobByJobId(id); return(Ok(job)); }
public ActionResult Create([Bind(Include = "Id,JobMainId,ServicesId,SupplierId,DtStart,DtEnd,Particulars,QuotedAmt,SupplierAmt,ActualAmt,Remarks,SupplierItemId")] JobServices jobServices) { if (ModelState.IsValid) { jobServices.DtEnd = ((DateTime)jobServices.DtEnd).Add(new TimeSpan(23, 59, 59)); db.JobServices.Add(jobServices); db.SaveChanges(); if (jobServices.SupplierId == NewSupplierSysId) { return(RedirectToAction("CreateSupplier", new { Svcid = jobServices.Id })); } else { // return RedirectToAction("Services", new { id = jobServices.JobMainId }); return(RedirectToAction("Services", "JobOrder", new { id = jobServices.JobMainId })); } } ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description", jobServices.JobMainId); ViewBag.SupplierId = new SelectList(db.Suppliers.Where(s => s.Status == "ACT"), "Id", "Name", jobServices.SupplierId); ViewBag.ServicesId = new SelectList(db.Services, "Id", "Name", jobServices.ServicesId); ViewBag.SupplierItemId = new SelectList(db.SupplierItems.Where(s => s.Status == "ACT"), "Id", "Description", jobServices.SupplierItemId); return(View(jobServices)); }
public IHttpActionResult GetAllJobsByCompanyName(string companyName) { JobServices jobservices = CreateJobServices(); var jobs = jobservices.GetJobByCompanyName(companyName); return(Ok(jobs)); }
public IHttpActionResult GetJobsBySalaryAndJobType(double salary, string comapnyname, string joptype) { JobServices jobservices = CreateJobServices(); var jobs = jobservices.GetJobByCompanyNameAndSalary(salary, comapnyname, joptype); return(Ok(jobs)); }
//GET: PowerShell/Schedule/1 public IActionResult Schedule(int id) { var script = _scriptRepository.GetScriptById(id); if (script == null) { return(NotFound()); } if (script.Category != null && !UserHasAccessToCategory(script.Category.Id)) { return(RedirectToAction("Index")); } var scriptParams = _scriptIO.ScriptParams(script.Name) ?? new Dictionary <string, string>(); var scheduleView = new PowerShellSchedule() { Id = script.Id, Date = DateTime.Now, Recurring = JobServices.RecurringOptions(), PSparams = scriptParams }; return(PartialView(scheduleView)); }
private JobServices CreateJobService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new JobServices(userId); return(service); }
// GET: SmallJob public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new JobServices(userId); var model = service.GetJobs(); return(View(model)); }
// Job ActionResults // GET: PowerShell/Run/1 public IActionResult Run(int id) { var jobServices = new JobServices(_scriptRepository, _scriptIO); // TODO: This can't be right. var script = _scriptRepository.GetScriptById(id); jobServices.LaunchScript(User.Identity.Name, script); return(RedirectToAction("Details", new { id })); }
//Job ActionResults // GET: PowerShell/Run/1 public ActionResult Run(int id) { var jobServices = new JobServices(_scriptRepository); var script = _scriptRepository.GetScriptById(id); jobServices.LaunchScript(User.Identity.Name, script); return(RedirectToAction("Details", new { id })); }
public ActionResult DeleteConfirmed(int id) { JobServices jobServices = db.JobServices.Find(id); int jId = jobServices.JobMainId; db.JobServices.Remove(jobServices); db.SaveChanges(); return(RedirectToAction("Services", new { id = jId })); }
public IHttpActionResult DeleteJob(int jobid) { JobServices jobservices = CreateJobServices(); var job = jobservices.DeleteJob(jobid); if (job is false) { return(InternalServerError()); } return(Ok("Job Deleted succesfully")); }
public void Post([FromBody] PowerShellParam id) { var jobServices = new JobServices(_scriptRepository, _scriptIO); var script = _scriptRepository.GetScriptById(id.Id); if (script == null || script.Category == null || !this.UserHasAccessToCategory(script.Category.Id)) { Unauthorized(); } jobServices.LaunchScriptWithParams(User.Identity.Name, id); }
// Job ActionResults // GET: PowerShell/Run/1 public IActionResult Run(int id) { var jobServices = new JobServices(_scriptRepository, _scriptIO); // TODO: This can't be right. var script = _scriptRepository.GetScriptById(id); if (script.Category != null && !UserHasAccessToCategory(script.Category.Id)) { return(RedirectToAction("Index")); } jobServices.LaunchScript(User.Identity.Name, script); return(RedirectToAction("Details", new { id })); }
public IActionResult Schedule(PowerShellSchedule schedule) { var jobServices = new JobServices(_scriptRepository, _scriptIO); var psMetadata = _scriptRepository.GetScriptById(schedule.Id); if (psMetadata == null) { return(NotFound()); } jobServices.Schedule(psMetadata, schedule, User.Identity.Name); return(RedirectToAction("Details", new { id = schedule.Id })); }
public async Task GetAllAccountsUnitTests(IEnumerable <Job> list) { var mockAccountDbHandler = new Mock <IJobDbHandler>(); mockAccountDbHandler.Setup(h => h.GetAllJobs()).ReturnsAsync(list); var userService = new JobServices(mockAccountDbHandler.Object); var users = await userService.GetJobs(); Assert.Equal(list.Count(), users.Count()); }
// GET: JobServices/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobServices jobServices = db.JobServices.Find(id); if (jobServices == null) { return(HttpNotFound()); } return(View(jobServices)); }
public ActionResult CreateSupplier(int?Svcid) { JobServices svc = db.JobServices.Find(Svcid); JobMain job = db.JobMains.Find(svc.JobMainId); ViewBag.JobOrder = job; ViewBag.Service = svc; Session["CurrentJobId"] = svc.JobMainId; Session["CurrentSvcId"] = svc.Id; ViewBag.CityId = new SelectList(db.Cities, "Id", "Name"); ViewBag.SupplierTypeId = new SelectList(db.SupplierTypes, "Id", "Description"); return(View()); }
// GET: JobServices/Create public ActionResult Create(int?JobMainId) { Models.JobMain job = db.JobMains.Find((int)JobMainId); Models.JobServices js = new JobServices(); js.JobMainId = (int)JobMainId; DateTime dtTmp = new DateTime(job.JobDate.Year, job.JobDate.Month, job.JobDate.Day, 8, 0, 0); js.DtStart = dtTmp; js.DtEnd = dtTmp.AddDays(job.NoOfDays - 1).AddHours(10); js.Remarks = "10hrs use per day P250 in excess, Driver and Fuel Included"; ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description"); ViewBag.SupplierId = new SelectList(db.Suppliers.Where(s => s.Status == "ACT"), "Id", "Name"); ViewBag.ServicesId = new SelectList(db.Services, "Id", "Name"); ViewBag.SupplierItemId = new SelectList(db.SupplierItems.Where(s => s.Status == "ACT"), "Id", "Description"); return(View(js)); }
// GET: JobServices/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobServices jobServices = db.JobServices.Find(id); if (jobServices == null) { return(HttpNotFound()); } ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description", jobServices.JobMainId); ViewBag.SupplierId = new SelectList(db.Suppliers.Where(s => s.Status == "ACT"), "Id", "Name", jobServices.SupplierId); ViewBag.ServicesId = new SelectList(db.Services, "Id", "Name", jobServices.ServicesId); ViewBag.SupplierItemId = new SelectList(db.SupplierItems.Where(s => s.Status == "ACT"), "Id", "Description", jobServices.SupplierItemId); return(View(jobServices)); }
public IHttpActionResult UpdateJob(JobEdit model, int jobid) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (model?.JobId != jobid) { return(BadRequest("Job id do not match with the model Id")); } JobServices jobservices = CreateJobServices(); var jobs = jobservices.UpdateJob(model, jobid); if (jobs is false) { return(InternalServerError()); } return(Ok("job updated successfully")); }
public ActionResult CreateSupplier([Bind(Include = "Id,Name,Contact1,Contact2,Contact3,Email,Details,CityId,SupplierTypeId")] Supplier supplier) { if (ModelState.IsValid) { db.Suppliers.Add(supplier); db.SaveChanges(); int jobid = (int)Session["CurrentJobId"]; int svcid = (int)Session["CurrentSvcId"]; JobServices jobsvc = db.JobServices.Find(svcid); jobsvc.SupplierId = supplier.Id; db.Entry(jobsvc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Services", new { id = jobid })); } ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", supplier.CityId); ViewBag.SupplierTypeId = new SelectList(db.SupplierTypes, "Id", "Description"); return(View(supplier)); }
public ActionResult CancelJobConfirmed(Job job) { var jobServices = new JobServices(_scriptRepository, _scriptIO); //Get Recurring and Original Job Info var recurringJob = _scriptRepository.GetJobById(job.Id); BackgroundJob.Delete(recurringJob.JobId.ToString()); if (recurringJob.JobType == JobType.Recurring) { var originalJob = _scriptRepository.GetJobById(recurringJob.RecurringId); BackgroundJob.Delete(originalJob.JobId.ToString()); jobServices.UpdateJobStatus(recurringJob, Status.Cancelled); } RecurringJob.RemoveIfExists(recurringJob.RecurringId.ToString()); jobServices.UpdateJobStatus(recurringJob, Status.Cancelled); return(RedirectToAction("Details", new { id = recurringJob.ScriptId })); }
//GET: PowerShell/Schedule/1 public ActionResult Schedule(int id) { var script = _scriptRepository.GetScriptById(id); if (script == null) { return(HttpNotFound()); } var scriptParams = ScriptIO.ScriptParams(script.Name) ?? new Dictionary <string, string>(); var scheduleView = new PowerShellSchedule() { Id = script.Id, Date = DateTime.Now, Recurring = JobServices.RecurringOptions(), PSparams = scriptParams }; return(PartialView(scheduleView)); }
public ActionResult Edit([Bind(Include = "Id,JobMainId,ServicesId,SupplierId,DtStart,DtEnd,Particulars,QuotedAmt,SupplierAmt,ActualAmt,Remarks,SupplierItemId")] JobServices jobServices) { if (ModelState.IsValid) { jobServices.DtEnd = ((DateTime)jobServices.DtEnd).Add(new TimeSpan(23, 59, 59)); db.Entry(jobServices).State = EntityState.Modified; DateTime dtSvc = (DateTime)jobServices.DtStart; List <Models.JobItinerary> iti = db.JobItineraries.Where(d => d.JobMainId == jobServices.JobMainId && d.SvcId == jobServices.Id).ToList(); foreach (var ititmp in iti) { int iHr = dtSvc.Hour, iMn = dtSvc.Minute; if (ititmp.ItiDate != null) { DateTime dtIti = (DateTime)ititmp.ItiDate; iHr = dtIti.Hour; iMn = dtIti.Minute; } ititmp.ItiDate = new DateTime(dtSvc.Year, dtSvc.Month, dtSvc.Day, iHr, iMn, 0); db.Entry(ititmp).State = EntityState.Modified; } db.SaveChanges(); if (jobServices.SupplierId == NewSupplierSysId) { return(RedirectToAction("CreateSupplier", new { Svcid = jobServices.Id })); } else { return(RedirectToAction("Services", new { id = jobServices.JobMainId })); } } ViewBag.JobMainId = new SelectList(db.JobMains, "Id", "Description", jobServices.JobMainId); ViewBag.SupplierId = new SelectList(db.Suppliers.Where(s => s.Status == "ACT"), "Id", "Name", jobServices.SupplierId); ViewBag.ServicesId = new SelectList(db.Services, "Id", "Name", jobServices.ServicesId); ViewBag.SupplierItemId = new SelectList(db.SupplierItems.Where(s => s.Status == "ACT"), "Id", "Description", jobServices.SupplierItemId); return(View(jobServices)); }
public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { JobFullList = new ObservableCollection <JobsHome>(); JobPostHalfList = new ObservableCollection <JobsHome>(); JobServices jobServices = new JobServices(); var j = await jobServices.GetJobsList(0); if (j != null && (j.Count() > 0)) { jobPostList = new ObservableCollection <JobsHomeModel>(j.ToList()); } //for (int i = 0; i < jobPostList.Count; i++) //{ // jobPostList.ElementAt(i).LocationType = ' '; //} SetLocationOnMap(); #region Check Location Permission //var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location); //if (status == PermissionStatus.Granted) //{ // ProgressBar pb = new ProgressBar(); // activityIndicator.IsRunning = true; // //var position = await CrossGeolocator.Current.GetPositionAsync(); // var position = jobPostList.ElementAt(0); // mapJob.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude), Distance.FromKilometers(1))); // mapJob.IsShowingUser = true; // mapJob.MapType = MapType.Street; // activityIndicator.IsRunning = false; // #region Call api to get data from server // // var helpers = await DataStore.GetHelpersList(10000, 28.4514279, 77.0704678); // // var helpers = await (new HelpersServices()).GetHelpersList(2000000, position.Latitude, position.Longitude); // // HelperList = new ObservableCollection<HelperHome>(helpers.First().HelpersInLocalties); // #endregion //} #endregion } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public JobViewModelBuilder(CandidateServices candidateServices, JobServices jobServices) { this.candidateServices = candidateServices; this.jobServices = jobServices; }