Example #1
0
 protected override void OnCellDoubleClick(DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.RowIndex < RowCount)
     {
         EditJob?.Invoke(this, new EventArgs());
     }
     base.OnCellDoubleClick(e);
 }
Example #2
0
        public ActionResult EditSubmit(EditJob data, int?jobId)
        {
            if (!string.IsNullOrWhiteSpace(data.Photo))
            {
                var originalDirectory = new DirectoryInfo(string.Format("{0}MediaUpload\\", Server.MapPath(@"\")));
                var pathString        = Path.Combine(originalDirectory.ToString(), "JobPhoto");
                var ext       = Path.GetExtension(data.Photo);
                var photoName = "temp" + GetOperation().UserId + ext;
                data.Photo = string.Format("{0}\\{1}", pathString, photoName);
            }
            var result = JobLogic.Edit(GetOperation().UserId, data, jobId);

            return(Json(result));
        }
Example #3
0
 public int EditJob(EditJob request)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@job_id", request.job_id);
         parameters.Add("@job_code", request.job_code);
         parameters.Add("@job_name", request.job_name);
         parameters.Add("@job_description", request.job_description);
         int id = SqlMapper.ExecuteScalar <int>(con, "EditJob", param: parameters, commandType: CommandType.StoredProcedure);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        // Have to test if this method works still
        public async Task <JobsViewModel> EditJob(EditJob editJob)
        {
            var job = await _jobsRepository.Get(editJob.JobId);

            job.Address           = editJob.Address;
            job.Contact           = editJob.Contact;
            job.PhoneNumber       = editJob.PhoneNumber;
            job.NumberOfPositions = editJob.NumberOfPositions;
            job.Positions         = editJob.Positions;

            var jobEmployees = new List <JobsEmployee>();

            // Remove the ids or else it will make duplicates
            _jobsEmployeesRepository.ClearIds(job.Id);


            // add new employees to the jobemployee table
            foreach (var employeeId in editJob.EmployeeIds)
            {
                Employee employee = await _employeeRepository.Get(employeeId);

                var je = new JobsEmployee()
                {
                    JobsId     = editJob.JobId,
                    Jobs       = job,
                    EmployeeId = employeeId,
                    Employee   = employee
                };

                jobEmployees.Add(je);
            }

            _jobsEmployeesRepository.SaveJobsEmployeeEdits(jobEmployees);

            var updatedJob = await _jobsRepository.UpdateJob(job);

            return(updatedJob);
        }
Example #5
0
 public ActionResult Edit(JobAddEditViewModel vm)
 {
     try
     {
         var j       = vm.Job;
         var request = new EditJob()
         {
             Id               = j.Id,
             Title            = j.Title,
             Status           = j.Status,
             AssigneeId       = j.AssigneeId,
             Description      = j.Description,
             FinalDescription = j.FinalDescription,
             Scheduled        = j.Scheduled,
             VehicleId        = j.VehicleId
         };
         mediator.Send(request);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Example #6
0
 public int EditJob(EditJob request)
 {
     return(_jobRepository.EditJob(request));
 }
Example #7
0
 public int EditJob([FromBody] EditJob request)
 {
     return(_jobService.EditJob(request));
 }
Example #8
0
        public async Task <ActionResult <JobsViewModel> > ModifyJob(EditJob editJob)
        {
            var result = await _jobService.EditJob(editJob);

            return(Ok(result));
        }