Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RegistrationFlow.CanSaveConsentInfo = false;
        Page.Title = "Customer Verification";
        CallCenter_CallCenterMaster1 obj;

        obj = (CallCenter_CallCenterMaster1)this.Master;
        obj.SetTitle("Customer Verification");
        obj.SetBreadCrumbRoot = "<a href=\"/CallCenter/CallCenterRepDashboard/Index\">Dashboard</a>";

        obj.hideucsearch();

        CallCenterOrganizationId = 0;
        if (CurrentOrganizationRole.CheckRole((long)Roles.CallCenterRep))
        {
            CallCenterOrganizationId = CurrentOrganizationRole.OrganizationId;
        }
        if (!IsPostBack)
        {
            if (CallId != null)
            {
                hfCallStartTime.Value = new CallCenterCallRepository().GetCallStarttime(CallId.Value);
            }

            if (CallId != null && !string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName) && !string.IsNullOrWhiteSpace(CallBackNumber))
            {
                IProspectCustomerRepository prospectCustomerRepository = new ProspectCustomerRepository();
                var listProspectCustomerViewData =
                    prospectCustomerRepository.GetProspectCustomersWithFiltersforCallCenterRep(FirstName, LastName, CallBackNumber.Replace("(", "").Replace(")", "").Replace("-", ""));
                if (listProspectCustomerViewData != null)
                {
                    if (listProspectCustomerViewData.Count > 10)
                    {
                        ProspectGridView.DataSource = listProspectCustomerViewData.GetRange(0, 10);
                        ProspectGridView.DataBind();
                        ProspectCustomerWarningContainerDiv.Style[HtmlTextWriterStyle.Display] = "block";
                    }
                    else
                    {
                        ProspectGridView.DataSource = listProspectCustomerViewData;
                        ProspectGridView.DataBind();
                    }
                    hfheader.Value = "divHeaderProspect";
                }
                else
                {
                    ProspectCustomerNoResultFoundContainerDiv.Style[HtmlTextWriterStyle.Display] = "block";
                    ProspectCustomerContainerDiv.Style[HtmlTextWriterStyle.Display] = "none";
                }
            }
            else
            {
                ProspectCustomerNoResultFoundContainerDiv.Style[HtmlTextWriterStyle.Display] = "block";
                ProspectCustomerContainerDiv.Style[HtmlTextWriterStyle.Display] = "none";
            }
            var masterDal = new MasterDAL();
            if (!String.IsNullOrWhiteSpace(Zip))
            {
                _customerDataZip = masterDal.SearchCustomersOnCall(FirstName.Replace("'", "''"), LastName.Replace("'", "''"), Zip, 1, CallBackNumber, CustomerId, MemberId, Hicn, PhoneNumber, EmailId, CallCenterOrganizationId, MbiNumber);
                if (_customerDataZip != null && _customerDataZip.Count > 0)
                {
                    grdCustomerListZIP.DataSource = _customerDataZip;
                    grdCustomerListZIP.DataBind();

                    pnlZIP.Enabled = true;

                    hfheader.Value = "divHeaderZIP";
                    divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none");
                    divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block");
                    if (_customerDataZip.Count > 20)
                    {
                        divMoreResultsMatchingZip.Visible = true;
                    }
                }
                else
                {
                    //pnlZIP.Enabled = false;
                    divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block");
                    divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none");

                    //hfheader.Value = "divHeaderOTHERS";
                }
            }
            else
            {
                //pnlZIP.Enabled = false;
                divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block");
                divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none");

                //hfheader.Value = "divHeaderOTHERS";
            }


            _customerData = masterDal.SearchCustomersOnCall(FirstName.Replace("'", "''"), LastName.Replace("'", "''"), Zip, 0, CallBackNumber, CustomerId, MemberId, Hicn, PhoneNumber, EmailId, CallCenterOrganizationId, MbiNumber);

            if (_customerData != null && _customerData.Count > 0)
            {
                divNoResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none");
                divResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block");
                grdCustomerList.DataSource = _customerData;
                grdCustomerList.DataBind();

                if (_customerData.Count > 20)
                {
                    divMoreResultsWithoutMatchingZip.Visible = true;
                }
                hfheader.Value = "divHeaderOTHERS";
            }
            else
            {
                divNoResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block");
                divResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none");
                //pnlOTHERS.Enabled = false;
                //divResults.Style.Add(HtmlTextWriterStyle.Display, "none");
            }

            if (_customerDataZip != null && _customerDataZip.Count > 0)
            {
                hfheader.Value = "divHeaderZIP";
            }
            else if (_customerData != null && _customerData.Count > 0)
            {
                hfheader.Value = "divHeaderOTHERS";
            }
        }
        Page.ClientScript.RegisterStartupScript(typeof(string), "jscode_tabSelection", "sel_caption('" + hfheader.Value + "');", true);
        switch (hfheader.Value)
        {
        case "divHeaderOTHERS":
            tbpnlContainer.ActiveTab = pnlOTHERS;
            break;

        case "divHeaderZIP":
            tbpnlContainer.ActiveTab = pnlZIP;
            break;

        case "divHeaderProspect":
            tbpnlContainer.ActiveTab = pnlProspect;
            break;

        default:
            return;
        }

        if (RegistrationFlow.CallQueueCustomerId > 0)
        {
            var callQueueCustomerRepository = IoC.Resolve <ICallQueueCustomerRepository>();
            var callQueueRepository         = IoC.Resolve <ICallQueueRepository>();
            var callQueueCriteriaRepository = IoC.Resolve <ICallQueueCriteriaRepository>();

            var callQueueCustomer = callQueueCustomerRepository.GetById(RegistrationFlow.CallQueueCustomerId);
            var callQueue         = callQueueRepository.GetById(callQueueCustomer.CallQueueId);
            CallQueueCriteria callQueueCriteria = null;
            if (callQueueCustomer.CallQueueCriteriaId.HasValue && callQueueCustomer.CallQueueCriteriaId.Value > 0)
            {
                callQueueCriteria = callQueueCriteriaRepository.GetById(callQueueCustomer.CallQueueCriteriaId.Value);
            }

            if (callQueue.ScriptId.HasValue && callQueue.ScriptId.Value > 0)
            {
                var scriptRepository = IoC.Resolve <IScriptRepository>();
                var script           = scriptRepository.GetById(callQueue.ScriptId.Value);

                var scriptText = string.Empty;
                if (callQueueCriteria != null && callQueueCriteria.CriteriaId == (long)QueueCriteria.PhysicianPartner)
                {
                    var userSession   = IoC.Resolve <ISessionContext>().UserSession;
                    var pcpRepository = IoC.Resolve <IPrimaryCarePhysicianRepository>();

                    var pcp = callQueueCustomer.CustomerId.HasValue ? pcpRepository.Get(callQueueCustomer.CustomerId.Value) : null;

                    if (pcp != null)
                    {
                        scriptText = "Hi, this is " + HttpUtility.HtmlEncode(userSession.FullName) + " calling on behalf of " + HttpUtility.HtmlEncode(pcp.Name.FullName) + " and Physician partner office. ";
                    }
                }
                ScriptTextDiv.InnerHtml = System.Web.Security.AntiXss.AntiXssEncoder.HtmlEncode(scriptText + script.ScriptText, true);
            }
        }
    }
Example #2
0
        public OutboundCallQueueListModel Create(IEnumerable <CallQueueCustomer> callQueueCustomers, IEnumerable <Customer> customers, IEnumerable <ProspectCustomer> prospectCustomers,
                                                 IEnumerable <CallQueueCriteria> callQueueCriterias, IEnumerable <Criteria> criterias, IEnumerable <CallQueueCustomerCall> callQueueCustomerCalls, IEnumerable <Call> calls,
                                                 IEnumerable <CallCenterNotes> callCenterNoteses, IEnumerable <CustomerCallNotes> customerCallNotes, IEnumerable <OrderedPair <long, string> > idNamePair)
        {
            var model      = new OutboundCallQueueListModel();
            var collection = new List <OutboundCallQueueViewModel>();

            callQueueCustomers.ToList().ForEach(cqc =>
            {
                Customer customer    = null;
                var prospectCustomer = new ProspectCustomer();

                if (cqc.CustomerId.HasValue)
                {
                    customer = customers.FirstOrDefault(c => c.CustomerId == cqc.CustomerId.Value);
                }

                if (cqc.ProspectCustomerId > 0)
                {
                    prospectCustomer = prospectCustomers.First(pc => pc.Id == cqc.ProspectCustomerId);
                }

                CallQueueCriteria callQueueCriteria = null;
                var callReason = string.Empty;

                if (callQueueCriterias != null && callQueueCriterias.Any() && criterias != null && criterias.Any())
                {
                    if (cqc.CallQueueCriteriaId.HasValue && cqc.CallQueueCriteriaId.Value > 0)
                    {
                        callQueueCriteria = callQueueCriterias.Single(cqcs => cqcs.Id == cqc.CallQueueCriteriaId.Value);
                    }
                    if (callQueueCriteria != null)
                    {
                        var criteria = criterias.Single(c => c.Id == callQueueCriteria.CriteriaId);

                        callReason = criteria.Name;

                        if (callQueueCriteria.CriteriaId == (long)QueueCriteria.AllProspects)
                        {
                            callReason = prospectCustomer.Tag.GetDescription();
                        }
                    }
                }

                var prospectNotes             = _notesViewModelFactory.GetProspectCustomerNotes(cqc.ProspectCustomerId ?? 0, customerCallNotes, idNamePair);
                var email                     = string.Empty;
                PhoneNumber mobilePhoneNumber = null;
                PhoneNumber officePhoneNumber = null;

                if (customer != null)
                {
                    email             = (customer.Email != null) ? customer.Email.ToString() : string.Empty;
                    mobilePhoneNumber = customer.OfficePhoneNumber;
                    officePhoneNumber = customer.MobilePhoneNumber;
                }
                else
                {
                    email = prospectCustomer.Email != null ? prospectCustomer.Email.ToString() : string.Empty;
                }

                var outboundModel = new OutboundCallQueueViewModel
                {
                    CallQueueCustomerId = cqc.Id,
                    ProspectCustomerId  = cqc.ProspectCustomerId,
                    CustomerId          = cqc.CustomerId,
                    FirstName           = customer != null ? customer.Name.FirstName : prospectCustomer.FirstName,
                    MiddleName          = customer != null ? customer.Name.MiddleName : "",
                    LastName            = customer != null ? customer.Name.LastName : prospectCustomer.LastName,
                    Gender = customer != null ? customer.Gender : prospectCustomer.Gender,
                    Email  = email,
                    CallBackPhoneNumber = customer != null ? customer.HomePhoneNumber : prospectCustomer.CallBackPhoneNumber,
                    MobilePhoneNumber   = mobilePhoneNumber,
                    OfficePhoneNumber   = officePhoneNumber,
                    DateOfBirth         = customer != null ? customer.DateOfBirth : prospectCustomer.BirthDate,
                    CreatedOn           = cqc.DateCreated,
                    CallReason          = callReason,
                    Notes             = prospectNotes,
                    ProspectCreatedOn = prospectCustomer != null && prospectCustomer.CreatedOn != DateTime.MinValue ? prospectCustomer.CreatedOn : (DateTime?)null,
                };

                if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any())
                {
                    var callIds = callQueueCustomerCalls.Where(cqcc => cqcc.CallQueueCustomerId == cqc.Id).Select(cqcc => cqcc.CallId).ToArray();
                    if (callIds.Any())
                    {
                        var customerCalls   = calls.Where(c => callIds.Contains(c.Id)).Select(c => c);
                        var callHistoryList = new List <CallHistoryViewModel>();
                        foreach (var customerCall in customerCalls)
                        {
                            var callHistory = new CallHistoryViewModel()
                            {
                                CallId      = customerCall.Id,
                                DateCreated = customerCall.CallDateTime
                            };

                            if (callCenterNoteses != null && callCenterNoteses.Any())
                            {
                                var customerNotes = callCenterNoteses.Where(ccn => ccn.CallId == customerCall.Id).Select(ccn => ccn).ToArray();
                                callHistory.Notes = customerNotes.Select(cn => new NotesViewModel()
                                {
                                    Note = cn.Notes, EnteredOn = cn.DateCreated
                                });
                            }

                            callHistoryList.Add(callHistory);
                        }

                        outboundModel.CallHistory = callHistoryList;
                    }
                }

                collection.Add(outboundModel);
            });

            model.OutboundCallQueues = collection;
            return(model);
        }