public ActionResult Editjob() { Logger.Debug("Inside Job Controller- Create Job"); try { if (Session["OrganizationGUID"] != null) { int deleteresult = 0; Int16 jobclass; if (short.TryParse(Jschema.JobClass.ToString(), out jobclass) && Jschema.OrganizationGUID != null) { IList<Job> job = _IJobSchemaRepository.GetjobByJobFormClass(jobclass, new Guid(Jschema.OrganizationGUID.ToString())).ToList(); if (job != null && job.Count > 0) { deleteresult = _IJobSchemaRepository.SetDeleteFlag(Jschema.JobFormGUID); } else { deleteresult = _IJobSchemaRepository.DeleteJobSchema(Jschema.JobFormGUID); //deleteresult = _IJobSchemaRepository.Save(); } } if (deleteresult > 0) { JobFormModel jobFormModel = new JobFormModel(); jobFormModel.JobPageList = jobPageList; jobFormModel.JobItemList = jobItemList; Jschema.JobForm1 = new JavaScriptSerializer().Serialize(jobFormModel); Jschema.JobFormGUID = Guid.NewGuid(); Jschema.IsActive = true; int JobResult = _IJobSchemaRepository.InsertJobSchema(Jschema); //int JobResult = _IJobSchemaRepository.Save(); } return RedirectToAction("Index"); } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); //_IJobSchemaRepository.DeleteJobPageItemByJobLogicalGUID(Jschema.JobLogicalID); //_IJobSchemaRepository.DeleteJobPageByJobLogicalGUID(Jschema.JobLogicalID); //_IJobSchemaRepository.DeleteJobSchema(Jschema.JobLogicalID); //_IJobSchemaRepository.Save(); return RedirectToAction("Index"); } }
public ActionResult CreateJob() { Logger.Debug("Inside Job Controller- Create Job"); try { if (Session["OrganizationGUID"] != null) { JobFormModel jobFormModel = new JobFormModel(); jobFormModel.JobPageList = jobPageList; jobFormModel.JobItemList = jobItemList; Jschema.JobForm1 = new JavaScriptSerializer().Serialize(jobFormModel); _IJobSchemaRepository.InsertJobSchema(Jschema); // _IJobSchemaRepository.Save(); return RedirectToAction("Index"); } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); //_IJobSchemaRepository.DeleteJobPageItemByJobLogicalGUID(Jschema.JobLogicalID); //_IJobSchemaRepository.DeleteJobPageByJobLogicalGUID(Jschema.JobLogicalID); //_IJobSchemaRepository.DeleteJobSchema(Jschema.JobLogicalID); //_IJobSchemaRepository.Save(); return RedirectToAction("Index"); } }