Exemple #1
0
        public bool CodingCompleted(MedicareCustomerResultCodedViewModel codingCompleted)
        {
            try
            {
                _logger.Info("Running CodingCompled API for Aces for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId);

                if (string.IsNullOrWhiteSpace(codingCompleted.EmployeeId))
                {
                    _logger.Info("EmployeeId is blank. CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId);
                    return(false);
                }

                var oru = _organizationRoleUserRepository.GetOrganizationRoleUserByEmployeeIdandRoleId(codingCompleted.EmployeeId, (long)Roles.Coder);
                if (oru == null)
                {
                    _logger.Info("EmployeeId or Coder role not exist. CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId);
                    return(false);
                }

                var account = _corporateAccountRepository.GetbyEventId(codingCompleted.EventId);

                if (account != null && account.IsHealthPlan)
                {
                    var eventCustomer   = _eventCustomerRepository.Get(codingCompleted.EventId, codingCompleted.CustomerId);
                    var isTestPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV);

                    var theEvent = _eventRepository.GetById(codingCompleted.EventId);

                    var questionnaireType = _accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(account.Id, theEvent.EventDate);

                    if ((questionnaireType != QuestionnaireType.HraQuestionnaire) || !isTestPurchased)
                    {
                        _testResultService.SaveCustomerResultCoded(codingCompleted, oru);
                        _logger.Info("customer result state Updated for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId);
                    }

                    else
                    {
                        _logger.Info("Only HRA is allowed to update for customer Id: " + codingCompleted.CustomerId + "  EventId: " + codingCompleted.EventId);
                        return(false);
                    }
                }
                else
                {
                    _logger.Info("Coding Completed can be marked only for HealthPlan Events. Customer Id: " + codingCompleted.CustomerId + "  EventId: " + codingCompleted.EventId);
                    return(false);
                }

                _logger.Info("completed CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId + " Successfully");
                return(true);
            }
            catch (Exception ex)
            {
                _logger.Info("completed CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId + " With Error");
                _logger.Error("Message: " + ex.Message);
                _logger.Error("StackTrace: " + ex.StackTrace);

                return(false);
            }
        }
        public bool SaveCustomerResultCoded(MedicareCustomerResultCodedViewModel model)
        {
            _logger.Info("Method called : SaveCustomerResultAfterEvaluation 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 completd : SaveCustomerResultAfterEvaluation for CustmerId: " + model.CustomerId + " EventId: " + model.EventId);
                return(false);
            }

            if (orgRoleUser.RoleId != (long)Roles.Coder)
            {
                _logger.Error(string.Format("Provided role is not Coder. username: {0}, roleAlias: {1}, CustomerId: {2}, EventId: {3}", model.UserName, model.RoleAlias, model.CustomerId, model.EventId));
                _logger.Info("Method completd : SaveCustomerResultAfterEvaluation for CustmerId: " + model.CustomerId + " EventId: " + model.EventId);
                return(false);
            }

            _testResultService.SaveCustomerResultCoded(model, orgRoleUser);

            _logger.Info(string.Format("EventCustomerResult Coding saved successfully for CustomerId: {0}, EventId: {1}", model.CustomerId, model.EventId));
            _logger.Info("Method completd : SaveCustomerResultAfterEvaluation for CustmerId: " + model.CustomerId + " EventId: " + model.EventId);
            return(true);
        }
Exemple #3
0
        public void SaveCustomerResultCoded_Tester()
        {
            var model = new MedicareCustomerResultCodedViewModel
            {
                EventId    = ValidEventId,
                CustomerId = ValidCustomerId,
                IsCoded    = true,
                RoleAlias  = "Coder",
                UserName   = "******"
            };

            var orgRoleUser = _organizationRoleUserRepository.GetByUserNameAndRoleAlias(model.UserName, model.RoleAlias);

            if (orgRoleUser == null)
            {
                Assert.IsNull(orgRoleUser);
            }
            else
            {
                Assert.IsNotNull(orgRoleUser);
                _testResultService.SaveCustomerResultCoded(model, orgRoleUser);
            }
        }