示例#1
0
        public ActionResult RegisterForEvent(long callQueueCustomerId, long eventId, long callId, long attemptId, bool isGmsCall = false, bool isViciCall = false, long previousEventId = 0)
        {
            var guid = Guid.NewGuid().ToString();
            CallQueueCustomer callQueueCustomer = null;
            long customerId         = 0;
            long prospectCustomerId = 0;
            long campaignId         = 0;

            if (callQueueCustomerId > 0)
            {
                callQueueCustomer  = _callQueueCustomerRepository.GetById(callQueueCustomerId);
                customerId         = callQueueCustomer.CustomerId.HasValue ? callQueueCustomer.CustomerId.Value : 0;
                prospectCustomerId = callQueueCustomer.ProspectCustomerId.HasValue ? callQueueCustomer.ProspectCustomerId.Value : 0;
                campaignId         = callQueueCustomer.CampaignId.HasValue ? callQueueCustomer.CampaignId.Value : 0;
            }
            else
            {
                var call = _callCenterCallRepository.GetById(callId);
                customerId = call.CalledCustomerId;
            }

            var registrationFlow = new RegistrationFlowModel
            {
                GuId                = guid,
                CallId              = callId,
                EventId             = eventId,
                CallQueueCustomerId = callQueueCustomerId,
                CustomerId          = customerId,
                ProspectCustomerId  = prospectCustomerId,
                CampaignId          = campaignId,
                AttempId            = attemptId,
                IsGmsCall           = isGmsCall,
                IsViciCall          = isViciCall
            };

            Session[guid] = registrationFlow;


            if (registrationFlow.CustomerId > 0)
            {
                if (previousEventId > 0)
                {
                    _eventCustomerQuestionAnswerService.UpdatePreQualifiedTestAnswers(customerId, eventId, previousEventId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                }
                _callCenterCallRepository.UpdateCallCenterCallStatus(CallType.Existing_Customer.ToString().Replace("_", " "), callId);
                string redirectUrl = _settings.AppUrl + "/App/CallCenter/CallCenterRep/ExistingCustomer/ExistingCustomer.aspx?CustomerType=Existing&CustomerID=" + registrationFlow.CustomerId + "&guid=" + guid;
                Response.RedirectUser(redirectUrl);
                return(null);
            }
            if (registrationFlow.ProspectCustomerId > 0)
            {
                _callCenterCallRepository.UpdateCallCenterCallStatus(CallType.Register_New_Customer.ToString().Replace("_", " "), callId);
                string redirectUrl = _settings.AppUrl + "/App/CallCenter/CallCenterRep/ExistingCustomer/ExistingCustomer.aspx?CustomerType=New&guid=" + guid;
                Response.RedirectUser(redirectUrl);
                return(null);
            }
            return(null);
        }