Exemplo n.º 1
0
        public void UpdateMedicareVisitStatus(long eventCustomerId, int visitStatus, string sessionId, ISessionContext sessionContext)
        {
            if (!_settings.SyncWithHra)
            {
                return;
            }

            var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId);

            if (eventCustomer.AwvVisitId.HasValue)
            {
                try
                {
                    _medicareApiService.Connect(sessionContext.UserSession.UserLoginLogId);
                }
                catch (Exception)
                {
                    var userSession = sessionContext.UserSession;
                    var token       = (sessionId + "_" + userSession.UserId + "_" + userSession.CurrentOrganizationRole.RoleId + "_" + userSession.CurrentOrganizationRole.OrganizationId).Encrypt();

                    var auth = new MedicareAuthenticationModel {
                        UserToken = token, CustomerId = 0, OrgName = _settings.OrganizationNameForHraQuestioner, Tag = _settings.OrganizationNameForHraQuestioner, IsForAdmin = false, RoleAlias = "CallCenterRep"
                    };
                    _medicareApiService.PostAnonymous <string>(_settings.MedicareApiUrl + MedicareApiUrl.AuthenticateUser, auth);

                    _medicareApiService.Connect(sessionContext.UserSession.UserLoginLogId);
                }

                _medicareApiService.Get <bool>(MedicareApiUrl.UpdateVisitStatus + "?visitId=" + eventCustomer.AwvVisitId.Value + "&status=" + visitStatus + "&unlock=true");
            }
        }
Exemplo n.º 2
0
        public bool UpdateVisitStatus(long visitId, int status, bool unlock = true, bool updateAccordinglyIfCancelledOrNoshow = false)
        {
            if (_settings.SyncWithHra)
            {
                if (updateAccordinglyIfCancelledOrNoshow)
                {
                    var cstatus     = _eventCustomerRepository.IsNoShowOrCancelled(visitId);
                    var isNoShow    = cstatus == 1;
                    var isCancelled = cstatus == 2;
                    if (isNoShow)
                    {
                        status = 3;
                    }
                    if (isCancelled)
                    {
                        status = 2;
                    }
                }
                _medicareApiService.Connect(_sessionContext.UserSession.UserLoginLogId);
                return(_medicareApiService.Get <bool>(MedicareApiUrl.UpdateVisitStatus + "?visitId=" + visitId + "&status=" + status + "&unlock=" + unlock));
            }

            return(false);
        }