// GET: physician_status/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } physician_status physician_status = _PhysicianStatusService.GetDetails(id.Value); if (physician_status == null) { return(HttpNotFound()); } return(GetViewResult(physician_status)); }
public JsonResult SetStatus(int id, string userId = "") { try { userId = string.IsNullOrEmpty(userId) ? User.Identity.GetUserId() : userId; var physician = UserManager.FindById(userId); bool isUpdateStatusDate = true; var status = _physicianStatusService.GetDetails(id); if (physician.status_key != id) { #region Applying Rule 3 Define in TCARE-11 - Physician Status Rules/Changes if (physician.status_key == PhysicianStatus.Stroke.ToInt() && status.phs_key == PhysicianStatus.TPA.ToInt()) { isUpdateStatusDate = false; } #endregion physician.status_key = id; if (isUpdateStatusDate) { physician.status_change_date = DateTime.Now.ToEST(); } physician.status_change_date_forAll = DateTime.Now.ToEST(); physician.status_change_cas_key = null; UserManager.Update(physician); LogStatusChange(physician.status_key.Value, physician.Id); ClearPreivousSnoozeData(userId); } else { return(Json(new { success = false, isResetTimer = false, message = "physician is already in that status" })); } // if the administor is updating the status of physician, then refresh the timer of physician also if online if (userId != loggedInUser.Id) { if (Settings.RPCMode == RPCMode.SignalR) { var hubContext = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <PhysicianCasePopupHub>(); var physicianOnlineWindows = PhysicianCasePopupHub.ConnectedUsers .Where(m => m.UserId == userId) .ToList(); physicianOnlineWindows.ForEach(window => { hubContext.Clients.Client(window.ConnectionId).syncPhysicianStatusTime(isUpdateStatusDate); }); } else { var dataList = new List <object>(); dataList.Add(isUpdateStatusDate.ToString()); new WebSocketEventHandler().CallJSMethod(userId, new SocketResponseModel { MethodName = "refreshCurrentPhyStatus", Data = dataList }); } } return(Json(new { success = true, data = new { phs_color_code = status.phs_color_code, phy_status_date = DateTime.Now.ToUniversalTime().ToString("MMM,dd,yyyy,HH:mm:ss"), phs_name = status.phs_name, isResetTimer = isUpdateStatusDate } })); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return(Json(new { success = false, isResetTimer = false, message = "An error occurred while updating the status, please try later." })); } }