public PartialViewResult AddProcess(int deviceId) { ProcessViewModel viewmodel = new ProcessViewModel(); viewmodel.DeviceId = deviceId; viewmodel.Analysts = UserRes.GetAll().Where(x => x.RoleId == (int)RoleType.ANALYST || x.RoleId == (int)RoleType.MANAGER).ToList(); viewmodel.ProcessTypes = ProcessTypeRes.GetAll(); return PartialView("_PartialPageAddProcess", viewmodel); }
public JsonResult ConfirmAddProcess(int deviceId, ProcessViewModel viewmodel) { FARProcessHistoryDto his = new FARProcessHistoryDto() { DeviceId = deviceId, Analystor = viewmodel.Email, Comment = viewmodel.Comment, ProcessTypeId = viewmodel.ProcessTypeId, LastUpdatedBy = this.CurrentName, IsIncluded = true, SeqNum = 0, }; var result = ProcessHisRep.Add(his); switch (result) { case Model.SaveResult.SUCCESS: Response.StatusCode = (int)HttpStatusCode.OK; return new JsonResult { Data = new { code = "SB01", Id = deviceId }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; case Model.SaveResult.FAILURE: Response.StatusCode = (int)HttpStatusCode.BadRequest; return new JsonResult { Data = new { code = "SB02", Id = deviceId }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } Response.StatusCode = (int)HttpStatusCode.BadRequest; return new JsonResult { Data = new { code = "SB02", Id = deviceId }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public PartialViewResult EditProcess(int id) { ProcessViewModel viewmodel = new ProcessViewModel(); var single = ProcessHisRep.Single(id); viewmodel.DeviceId = single.DeviceId; viewmodel.ProcessTypeId = single.ProcessTypeId; viewmodel.Email = single.Analystor; viewmodel.Comment = single.Comment; viewmodel.Analysts = UserRes.GetAll().Where(x => x.RoleId == (int)RoleType.ANALYST || x.RoleId == (int)RoleType.MANAGER).ToList(); viewmodel.ProcessTypes = ProcessTypeRes.GetAll(); return PartialView("_PartialPageEditProcess", viewmodel); }