public bool SaveCustomerResultSigned(MedicareCustomerResultSignedNPViewModel model) { _logger.Info("Method called : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); var orgRoleUser = _organizationRoleUserRepository.GetByUserNameAndRoleAlias(model.UserName, model.RoleAlias); if (orgRoleUser == null) { _logger.Error(string.Format("No OrganizationRoleUser found for username: {0}, roleAlias: {1}, CustomerId: {2}, EventId: {3}", model.UserName, model.RoleAlias, model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); return(false); } if (orgRoleUser.RoleId != (long)Roles.NursePractitioner) { _logger.Error(string.Format("Provided role is not NursePractitioner. username: {0}, roleAlias: {1}, CustomerId: {2}, EventId: {3}", model.UserName, model.RoleAlias, model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); return(false); } var isUpdated = _testResultService.SaveCustomerResultSigned(model, orgRoleUser); if (isUpdated) { _logger.Info(string.Format("EventCustomerResult Signed saved successfully for CustomerId: {0}, EventId: {1}", model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); } else { _logger.Info(string.Format("EventCustomerResult Chart Not Signed for CustomerId: {0}, EventId: {1}", model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); } return(isUpdated); }
public bool SaveCustomerResultSigned(MedicareCustomerResultSignedNPViewModel model) { _logger.Info("Method called : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId + " UserId: " + model.UserId); if (model.UserId <= 0) { _logger.Info("UserId is less than or equal to 0. SaveCustomerResultSigned API for Customer Id: " + model.CustomerId + " EventId : " + model.EventId); return(false); } var orgRoleUser = _organizationRoleUserRepository.GetOrganizationRoleUserByUserIdAndRoleId(model.UserId, (long)Roles.NursePractitioner); if (orgRoleUser == null) { _logger.Info("UserId or Nurse Practitioner role not exist. SaveCustomerResultSigned API for Customer Id: " + model.CustomerId + " EventId : " + model.EventId + " UserId: " + model.UserId); return(false); } try { var isUpdated = _testResultService.SaveCustomerResultSigned(model, orgRoleUser); if (isUpdated) { _logger.Info(string.Format("EventCustomerResult Signed saved successfully for CustomerId: {0}, EventId: {1}", model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); } else { _logger.Info(string.Format("EventCustomerResult Chart Not Signed for CustomerId: {0}, EventId: {1}", model.CustomerId, model.EventId)); _logger.Info("Method Completed : SaveCustomerResultSigned for CustmerId: " + model.CustomerId + " EventId: " + model.EventId); } return(isUpdated); } catch (Exception ex) { _logger.Info("completed SaveCustomerResultSigned API for Customer Id: " + model.CustomerId + " EventId : " + model.EventId + " With Error"); _logger.Error("Message: " + ex.Message); _logger.Error("StackTrace: " + ex.StackTrace); return(false); } }
public void SaveCustomerResultSigned_Tester() { var model = new MedicareCustomerResultSignedNPViewModel { EventId = ValidEventId, CustomerId = ValidCustomerId, IsSigned = true, RoleAlias = "NursePractitioner", UserName = "******" }; var orgRoleUser = _organizationRoleUserRepository.GetByUserNameAndRoleAlias(model.UserName, model.RoleAlias); if (orgRoleUser == null) { Assert.IsNull(orgRoleUser); } else { Assert.IsNotNull(orgRoleUser); _testResultService.SaveCustomerResultSigned(model, orgRoleUser); } }