/// <summary> /// Lock Record /// </summary> /// <param name="loginUserID"></param> /// <param name="screenLkup"></param> /// <param name="caseID"></param> /// <param name="objUIRecordsLock"></param> /// <returns></returns> public ExceptionTypes GetLockedRecordOrLockRecord(long loginUserID, long screenLkup, long caseID, bool isRelockRequired, out UIRecordsLock objUIRecordsLock) { retValue = new ExceptionTypes(); objUIRecordsLock = new UIRecordsLock(); try { string guid = Guid.NewGuid().ToString(); retValue = _objDALCommon.GetLockedRecordOrLockRecord(loginUserID, screenLkup, caseID, guid, isRelockRequired, out objUIRecordsLock); if (retValue == (long)ExceptionTypes.Success) { if (objUIRecordsLock.CreatedByRef != loginUserID) { objUIRecordsLock.LockedHours = (DateTime.Now.ToUniversalTime() - objUIRecordsLock.UTCCreatedOn).TotalHours; } else if (guid != objUIRecordsLock.Guid.Trim()) { objUIRecordsLock.IsEditInProgress = true; } objUIRecordsLock.Status = (long)ExceptionTypes.Success; } } catch (Exception ex) { objUIRecordsLock.Status = (long)ExceptionTypes.UnknownError; objUIRecordsLock.ErrorMessage = "Error while locking record."; } return(retValue); }
//Process Unlock Record public bool ProcessUnlockRecord(long ScreenType, long CaseID) { UIRecordsLock objRecordsLocked = new UIRecordsLock(); bool isSuccess = false; try { BLCommon objBLCommon = new BLCommon(); _retValue = objBLCommon.UnlockRecord(ScreenType, CaseID); if (_retValue == ExceptionTypes.Success && objRecordsLocked.Status == (long)ExceptionTypes.Success) { isSuccess = true; } } catch (Exception ex) { BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPSendOOALetter, (long)ExceptionTypes.Uncategorized, ex.Message.ToString(), ex.Message.ToString()); //ErrorMessage += ex.Message + ex.StackTrace; } return(isSuccess); }
//Process Lock Record public bool ProcessLockRecord(long UserID, long ScreenType, long CaseID, bool IsRelockRequired) { UIRecordsLock objRecordsLocked = new UIRecordsLock(); bool isSuccess = false; try { BLCommon objBLCommon = new BLCommon(); _retValue = objBLCommon.GetLockedRecordOrLockRecord(UserID, ScreenType, CaseID, IsRelockRequired, out objRecordsLocked); if (_retValue == ExceptionTypes.Success && objRecordsLocked.Status == (long)ExceptionTypes.Success && objRecordsLocked.CreatedByRef == UserID) { isSuccess = true; } } catch (Exception ex) { BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPCreateCMSTransaction, (long)ExceptionTypes.Uncategorized, ex.Message.ToString(), ex.Message.ToString()); //ErrorMessage += ex.Message + ex.StackTrace; } return(isSuccess); }
public JsonResult GetLockedRecordOrLockRecord(long caseId, long screenLkup, bool isForcedLocked) { UIRecordsLock objRecordsLocked = new UIRecordsLock(); try { long currentLoginUserId = currentUser.ADM_UserMasterId; BLCommon objCommon = new BLCommon(); ExceptionTypes result = objCommon.GetLockedRecordOrLockRecord(currentLoginUserId, screenLkup, caseId, isForcedLocked, out objRecordsLocked); if (result == (long)ExceptionTypes.Success) { return(Json(objRecordsLocked)); } } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.RecordsLocked, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); } objRecordsLocked.Status = (long)ExceptionTypes.UnknownError; objRecordsLocked.ErrorMessage = "The record is locked for editing by other user. Please retry."; return(Json(objRecordsLocked, JsonRequestBehavior.AllowGet)); }
long _currentLoginUserId = 11;//for MIIM System will be set in Create session // GET: MIIMConnector public ActionResult GetCaseDetails(string caseId) { ViewBag.PageName = ConstantTexts.MiimPageName; try { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMNew, _currentLoginUserId, TarceMethodLkup.New.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); if (long.TryParse(caseId, out long lQueueID))// to check if case exists in DB { #region Create Session ExceptionTypes result = CreateSession(WorkBasket.OST); #endregion if (result == ExceptionTypes.Success) { ///Log For User Authentication Success MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMUserAuthSucc, _currentLoginUserId, TarceMethodLkup.InProgress.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); #region validate Record Lock UIRecordsLock objRecordsLocked = new UIRecordsLock(); bool isAvailable = true; try { BLCommon objCommon = new BLCommon(); result = objCommon.GetLockedRecordOrLockRecord(_currentLoginUserId, (long)ScreenType.Queue, lQueueID, false, out objRecordsLocked); if (result == (long)ExceptionTypes.Success) { isAvailable = objRecordsLocked.LockedHours.IsNullOrEmpty(); } } catch (Exception ex) { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, "Record locking failed", _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); BLCommon.LogError(_currentLoginUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.MIIMConnector, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); ViewBag.ErrorMessage = "\nError Locking the Record Please try Again."; return(View("~/Views/Shared/Error.cshtml")); } #endregion if (isAvailable) { #region Get Case Discrepancy Category result = _objBLMIIMIntegration.GetCaseDiscrepancyCategory(lQueueID, out long lDiscrepancyCategory, out string errorMessage); if (result != (long)ExceptionTypes.Success && result != ExceptionTypes.ZeroRecords) { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMRecordNotFound, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); BLCommon.LogError(_currentLoginUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.MIIMConnector, (long)ExceptionTypes.Uncategorized, errorMessage, "Error occured while getting Discrepancy Category."); ViewBag.ErrorMessage = "\nDetails Not available for selected Case."; return(View("~/Views/Shared/Error.cshtml")); } #endregion #region Redirect to Process Work Screen based on Work Basket string strEncodedCaseId = URLEncoderDecoder.Encode(lQueueID.ToString()); MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMRequestCompleted, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); switch (lDiscrepancyCategory) { case (long)DiscripancyCategory.RPR: return(RedirectToAction("RPRProcessWork", "RPR", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.Eligibility: return(RedirectToAction("EligibilityProcessWork", "Eligibility", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.DOB: return(RedirectToAction("DOBProcessWork", "Eligibility", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.Gender: return(RedirectToAction("GenderProcessWork", "Eligibility", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.OOA: return(RedirectToAction("OOAProcessWork", "OST", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.SCC: return(RedirectToAction("SCCProcessWork", "OST", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); case (long)DiscripancyCategory.TRR: return(RedirectToAction("TRRProcessWork", "OST", new { queueId = strEncodedCaseId, pageName = ConstantTexts.MiimPageName })); } #endregion } else { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, "Record is locked by User Id :" + objRecordsLocked.CreatedByRef, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); ViewBag.ErrorMessage = "\nRecord is Locked by " + objRecordsLocked.CreatedByName + " and Not Available for Processing"; return(View("~/Views/Shared/Error.cshtml")); } } else if (result == ExceptionTypes.UnknownError) { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMUserAuthFail, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); ViewBag.ErrorMessage = "\nYou are not part of ERS DB.\nPlease contact administrator"; return(View("~/Views/Shared/Error.cshtml")); } else { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ConstantTexts.MIIMUserAuthFail, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); ViewBag.ErrorMessage = "\nYou do not have permission to access this page.\nPlease contact administrator"; return(View("~/Views/Shared/Error.cshtml")); } } MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, "Invalid ERS case Id :" + caseId, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); ViewBag.ErrorMessage = "\nInvalid Case Id."; return(View("~/Views/Shared/Error.cshtml")); } catch (Exception ex) { MIIMServiceLog(MethodBase.GetCurrentMethod().Name, caseId, ex.ToString(), _currentLoginUserId, TarceMethodLkup.Failed.ToLong(), (long)MIIMServiceMethod.GetCaseDetails); BLCommon.LogError(_currentLoginUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.MIIMConnector, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.Message); return(View("~/Views/Shared/Error.cshtml")); } }