protected ActionResult ViewJobBase(ViewPrdnJobViewModel viewJob, IEnumerable<HttpPostedFileBase> uploadedFiles)
        {
            ProcessAttacherForSave(viewJob.Attacher, uploadedFiles);
            bool attachChanged = (viewJob.IfNotNull(m => m.Attacher).IfNotNull(a => a.OrigChanged) == true);

            ProductionJob editJob = (from j in PrdnDBContext.ProductionJobs
                                     where j.ID == viewJob.ID
                                     select j).FirstOrDefault();
            if (editJob == null)
            {
                return ErrMsgView(SystemExtensions.Sentence("Error Saving Job: ", LocalStr.JobID, viewJob.IfNotNull(j => j.ID).ToString(), LocalStr.verbIsNot, LocalStr.valid));
            }
            if (attachChanged)
            {
                EnsurePrdnDBContextOpen();
                using (var transaction = PrdnDBContext.Connection.BeginTransaction())
                {
                    try
                    {
                        UpdateJobAttachments(editJob, viewJob.Attacher);
                        PrdnDBContext.SaveChanges();
                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        return ErrMsgView("Error Saving Job: " + ex.Message);
                    }
                }
            }

            return RedirectIfLocal(viewJob.UrlReturn,
                () => RedirectToAction(actionName: "Jobs", routeValues: new { id = viewJob.RunID }));
        }
 public ActionResult ViewJob(ViewPrdnJobViewModel viewJob, IEnumerable<HttpPostedFileBase> uploadedFiles)
 {
     return ViewJobBase(viewJob, uploadedFiles);
 }
        protected ActionResult ViewJobBase(int id, string attGroups, string urlReturn)
        {
            ViewPrdnJobViewModel viewJob = new ViewPrdnJobViewModel();
            LoadEditJobViewModel(viewJob, id, urlReturn);
            if (viewJob != null)
            {
                viewJob.CustName = GetCustName(viewJob.CustID);
                viewJob.CustLocName = GetCustLocName(viewJob.CustID);
                viewJob.ShipMethodDescription = GetShipMethodDescr(viewJob.ShipMethodCD);

                loadViewJobViewAttachments(viewJob, attGroups);

                viewJob.CanEditRun = false;

                return View(viewJob);
            }
            else
            {
                return ErrMsgView(SystemExtensions.Sentence(LocalStr.Job, LocalStr.ID, id.ToString(), LocalStr.verbIsNot, LocalStr.valid));
            }
        }