public ActionResult EditJobTitle(JobTitleView jobTitleInfo) { if (jobTitleInfo == null) { throw new ArgumentNullException(nameof(jobTitleInfo)); } if (!ModelState.IsValid) { var model = this.adminService.GetJobTitleUpdateView(jobTitleInfo, string.Empty); return(this.View("EditJobTitle", model)); } var processingMessage = adminService.ProcessEditJobTitleInformation(jobTitleInfo); if (!string.IsNullOrEmpty(processingMessage)) { // update model with dropdown list var model = adminService.GetJobTitleUpdateView(jobTitleInfo, processingMessage); return(this.View("EditJobTitle", model)); } var returnMessage = string.Format("Selected Job Title Updated -{0}", jobTitleInfo.JobTitleName); return(RedirectToAction("JobTitleList", new { companyId = jobTitleInfo.CompanyId, message = returnMessage })); }
public JobDetailsSessionView() { ContractsTemplates = new List<ContractTemplateEntity>(); FunctionalLevel = new FunctionalLevelEntity(); OrganisationalUnit = new OrganizationalUnitView(); Grade = new GradeEntity(); Step = new StepEntity(); Job = new JobTitleView(); IsGenerated = false; }
/// <summary> /// Creates the job title view. /// </summary> /// <param name="companyId">The company identifier.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">companyId</exception> public IJobTitleView CreateJobTitleView(int companyId) { if (companyId <= 0) { throw new ArgumentNullException(nameof(companyId)); } var view = new JobTitleView { CompanyId = companyId, ProcessingMessage = string.Empty }; return(view); }
public ActionResult AddJobTitle(JobTitleView jobTitleInfo, HttpPostedFileBase jobTitleExcelFile) { var processingMessage = string.Empty; if (jobTitleExcelFile != null) { processingMessage = this.adminService.ProcessUploadExcelJobTitle(jobTitleExcelFile); if (!string.IsNullOrEmpty(processingMessage)) { var viewModel = this.adminService.GetJobTitleUpdateView(jobTitleInfo, processingMessage); return(this.View("AddJobTitle", viewModel)); } processingMessage = string.Format("{0} successful added", jobTitleInfo.JobTitleName); return(this.RedirectToAction("JobTitleList", "HR", new { message = processingMessage })); } if (jobTitleInfo == null) { throw new ArgumentNullException(nameof(jobTitleInfo)); } if (!ModelState.IsValid) { var model = this.adminService.GetJobTitleUpdateView(jobTitleInfo, string.Empty); return(this.View("AddJobTitle", model)); } processingMessage = this.adminService.ProcessJobTitleInfo(jobTitleInfo); if (!string.IsNullOrEmpty(processingMessage)) { var model = this.adminService.GetJobTitleUpdateView(jobTitleInfo, string.Empty); return(this.View("AddJobTitle", model)); } var returnMessage = string.Format("New Job Title Added -{0}", jobTitleInfo.JobTitleName); return(RedirectToAction("JobTitleList", new { companyId = jobTitleInfo.CompanyId, message = returnMessage })); }
/// <summary> /// Creates the edit job title view. /// </summary> /// <param name="jobTitleInfo">The job title information.</param> /// <param name="processingMessage"></param> /// <returns></returns> /// <exception cref="ArgumentNullException">jobTitleInfo</exception> public IJobTitleView CreateEditJobTitleView(IJobTitle jobTitleInfo, string processingMessage) { if (jobTitleInfo == null) { throw new ArgumentNullException(nameof(jobTitleInfo)); } var returnView = new JobTitleView { JobDefinition = jobTitleInfo.JobDefinition, JobFunction = jobTitleInfo.JobFunction, JobTitleId = jobTitleInfo.JobTitleId, JobTitleName = jobTitleInfo.JobTitleName, CompanyId = jobTitleInfo.CompanyId, DateCreated = jobTitleInfo.DateCreated, ProcessingMessage = processingMessage ?? "", }; return(returnView); }
public string ProcessUploadExcelJobTitle(HttpPostedFileBase jobTitleExcelFile) { if (jobTitleExcelFile == null) { throw new ArgumentNullException(nameof(jobTitleExcelFile)); } var result = string.Empty; var jobTitleCollection = this.generateDocumentService.ExcelUpload(jobTitleExcelFile); foreach (DataRow r in jobTitleCollection.Rows) { var jobTitleView = new JobTitleView(); jobTitleView.JobTitleName = r.ItemArray[0].ToString(); jobTitleView.JobDefinition = (string)r.ItemArray[1]; jobTitleView.JobFunction = (string)r.ItemArray[2]; jobTitleView.CompanyId = (int)session.GetSessionValue(SessionKey.CompanyId); var isDataOkay = (this.jobTitleRepository.GetJobTitleByCompany(jobTitleView.CompanyId, jobTitleView.JobTitleName) == null) ? true : false; if (!isDataOkay) { result = Messages.JobTitleAlreadyExist; return(result); } result = this.jobTitleRepository.SaveJobTitleInfo(jobTitleView); if (!string.IsNullOrEmpty(result)) { return(result); } } return(result); }