Beispiel #1
0
        public ActionResult Details(int id)
        {
            var calReg      = _databaseContex.CallRegistrations.Find(id);
            var callType    = _databaseContex.CallTypes.FirstOrDefault(_ => _.Id == calReg.CallTypeId);
            var userProfile = _databaseContex.UserProfiles.FirstOrDefault(_ => _.UserId == calReg.UserId);

            var detail = new CallHistoryViewModel()
            {
                Id            = calReg.Id,
                CallerName    = calReg.CallerName,
                MobileNumber  = calReg.MobileNumber,
                Address       = calReg.Address,
                Time          = calReg.Time,
                Description   = calReg.Description,
                CallerEmail   = calReg.CallerEmail,
                OrderCode     = calReg.OrderCode,
                ProductCode   = calReg.ProductCode,
                ComplainType  = calReg.ComplainType,
                QueryType     = calReg.QueryType,
                PaymentMethod = calReg.PaymentMethod,
                CallTypeId    = calReg.CallTypeId,
                CallTypeName  = callType.CallTypeName,
                UserId        = calReg.UserId,
                UserName      = userProfile.UserName,
                //                CallingStatusId = calReg.CallingStatusId,
                //                OfficeOwnerId = calReg.OfficeOwnerId,
                //                JobCategoryId = calReg.JobCategoryId,
                AdminComment = calReg.AdminComment,
                CallDuration = calReg.CallDuration
            };

            return(View(detail));
        }
Beispiel #2
0
 public void SetDataContext(CallHistoryViewModel viewModel)
 {
     //******************************************************************************************************************
     // Setting the call history view to Display.
     //******************************************************************************************************************
     _callHistoryModel = viewModel;
     DataContext       = viewModel;
 }
Beispiel #3
0
        public ActionResult ConfirmCallHistory(CallHistoryViewModel editedInfo)
        {
            var call = _databaseContex.CallRegistrations.Find(editedInfo.Id);

            if (call != null)
            {
                call.OrderCode    = editedInfo.OrderCode;
                call.CallerName   = editedInfo.CallerName;
                call.Address      = editedInfo.Address;
                call.Description  = editedInfo.Description;
                call.CallerEmail  = editedInfo.CallerEmail;
                call.AdminComment = editedInfo.AdminComment;

                //                call.OrderCode = editedInfo.OrderCode;
                //                call.ProductCode = editedInfo.ProductCode;
                //                call.ComplainType = editedInfo.ComplainType;
                //                call.QueryType = editedInfo.QueryType;
                //                call.PaymentMethod = editedInfo.PaymentMethod;
                //                call.DeliveryDate = editedInfo.DeliveryDate;
                //                call.CallTypeId = editedInfo.CallTypeId;
                //                call.CallingStatusId = editedInfo.CallingStatusId;
                //                call.OfficeOwnerId = editedInfo.OfficeOwnerId;
                //                call.JobCategoryId = editedInfo.JobCategoryId;

                _databaseContex.CallRegistrations.Attach(call);
                _databaseContex.Entry(call).State = EntityState.Modified;
            }
            _databaseContex.SaveChanges();

            string role = WebSecurity.CurrentUserName;

            if (Roles.IsUserInRole("Employee"))
            {
                return(RedirectToAction("MyCallHistory", "Employee"));
            }
            else
            {
                return(RedirectToAction("CallHistory", "Office"));
            }
        }
Beispiel #4
0
        private void SetHistoryViewModelList(IEnumerable <CallQueueCustomerCallViewModel> callQueueCustomerCalls, IEnumerable <CallCenterNotes> callCenterNoteses, CallQueueCustomer cqc, OutboundCallQueueViewModel outboundModel)
        {
            if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any())
            {
                var calls = callQueueCustomerCalls.Where(
                    cqcc => (cqc.CustomerId.HasValue && cqcc.CustomerId == cqc.CustomerId.Value) ||
                    (cqc.ProspectCustomerId.HasValue && cqcc.ProspectCustomerId == cqc.ProspectCustomerId.Value))
                            .Select(cqcc => cqcc).ToArray();

                if (calls.Any())
                {
                    calls = calls.OrderByDescending(x => x.CallDateTime).ToArray();
                    var callHistoryList = new List <CallHistoryViewModel>();
                    foreach (var customerCall in calls)
                    {
                        var callHistory = new CallHistoryViewModel()
                        {
                            CallId      = customerCall.CallId,
                            DateCreated = customerCall.CallDateTime
                        };

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

                        callHistoryList.Add(callHistory);
                    }

                    outboundModel.CallHistory = callHistoryList;
                }
            }
        }
Beispiel #5
0
 public CallLogCtrl(CallHistoryViewModel viewModel) :
     this()
 {
     SetDataContext(viewModel);
 }
Beispiel #6
0
        public CallQueueCustomerNotesViewModel GetCustomerNotes(long callId, long callQueueCustomerId)
        {
            var callHistoryModel = new List <CallHistoryViewModel>();

            CallQueueCustomer callQueueCustomer = null;
            long customerId         = 0;
            long prospectCustomerId = 0;

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

            var calls = _callCenterCallRepository.GetCallsForCallQueueCustomer(callId, customerId, prospectCustomerId);

            if (calls != null && calls.Any())
            {
                var callCenterNotes = _callCenterNotesRepository.GetByCallIds(calls.Select(x => x.CallId));
                var agentNameIds    = _organizationRoleUserRepository.GetNameIdPairofUsers(calls.Select(x => x.CreatedByOrgRoleUserId).ToArray());

                var callHistoryList = new List <CallHistoryViewModel>();

                foreach (var customerCall in calls)
                {
                    var agentNameId = agentNameIds.First(c => c.FirstValue == customerCall.CreatedByOrgRoleUserId);

                    var dispositionValue = "N/A";

                    if (!string.IsNullOrEmpty(customerCall.Disposition))
                    {
                        ProspectCustomerTag disposition;
                        Enum.TryParse(customerCall.Disposition, out disposition);

                        if (Enum.IsDefined(typeof(ProspectCustomerTag), disposition))
                        {
                            dispositionValue = disposition.GetDescription();
                        }
                    }

                    var callHistory = new CallHistoryViewModel()
                    {
                        CallId              = customerCall.CallId,
                        DateCreated         = customerCall.CallDateTime,
                        CallOutcome         = ((CallStatus)customerCall.Status).GetDescription(),
                        RequestedCallBack   = callQueueCustomer != null ? callQueueCustomer.CallDate : (DateTime?)null,
                        CreatedBy           = agentNameId.SecondValue,
                        Disposition         = dispositionValue,
                        NotInterestedReason = customerCall.NotInterestedReasonId.HasValue ? ((NotInterestedReason)customerCall.NotInterestedReasonId).GetDescription() : "N/A"
                    };

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

                    callHistoryList.Add(callHistory);
                }

                callHistoryModel.AddRange(callHistoryList.OrderByDescending(x => x.DateCreated).ToList());
            }
            var mailHistoryList = new List <DirectMailViewModel>();

            if (customerId > 0)
            {
                var directMails = _directMailRepository.GetByCustomerId(customerId);

                if (directMails != null && directMails.Any())
                {
                    var agentNameIds    = _organizationRoleUserRepository.GetNameIdPairofUsers(directMails.Select(x => x.Mailedby).ToArray());
                    var directMailTypes = _directMailTypeRepository.GetAll();

                    foreach (var directMail in directMails)
                    {
                        var agentNameId = agentNameIds.First(c => c.FirstValue == directMail.Mailedby);
                        var directMailSentToCustomer = "N/A";

                        if (directMail.DirectMailTypeId.HasValue)
                        {
                            directMailSentToCustomer = directMailTypes.Single(x => x.Id == directMail.DirectMailTypeId.Value).Name;
                        }
                        mailHistoryList.Add(new DirectMailViewModel()
                        {
                            DateCreated    = directMail.MailDate,
                            CreatedBy      = agentNameId.SecondValue,
                            DirectMailType = directMailSentToCustomer,
                            Notes          = directMail.IsInvalidAddress ? directMail.Notes : "N/A"
                        });
                    }
                }
            }

            var customerCallNotesViewModel = new List <CustomerCallNotesViewModel>();

            if (customerId > 0)
            {
                var customerCallNotes = _customerCallNotesRepository.GetCustomerNotes(customerId).ToList();

                var orders = _orderRepository.GetAllOrdersForCustomer(customerId);
                if (orders != null && orders.Count() > 0)
                {
                    var refundRequests = _refundRequestRepository.GeRefundRequestByOrderIds(orders.Select(oec => oec.Id).ToArray(), RefundRequestType.CustomerCancellation);

                    if (refundRequests != null && refundRequests.Count() > 0)
                    {
                        var refundRequestNotes = new List <CustomerCallNotes>();
                        foreach (var refundRequest in refundRequests)
                        {
                            refundRequestNotes.Add(new CustomerCallNotes
                            {
                                CustomerId           = customerId,
                                Notes                = refundRequest.Reason,
                                NotesType            = CustomerRegistrationNotesType.CancellationNote,
                                DataRecorderMetaData = new DataRecorderMetaData(refundRequest.RequestedByOrgRoleUserId, refundRequest.RequestedOn, null)
                            });
                        }
                        customerCallNotes = customerCallNotes.Concat(refundRequestNotes).ToList();
                    }
                }

                if (!customerCallNotes.IsNullOrEmpty())
                {
                    customerCallNotes = customerCallNotes.OrderByDescending(x => x.DataRecorderMetaData.DateCreated).ToList();
                    var orgRoleUserIds = customerCallNotes.Select(x => x.DataRecorderMetaData.DataRecorderCreator.Id).ToArray();
                    orgRoleUserIds = orgRoleUserIds.Distinct().ToArray();

                    var agentNameIds = _organizationRoleUserRepository.GetNameIdPairofUsers(orgRoleUserIds);

                    customerCallNotesViewModel.AddRange(from notes in customerCallNotes
                                                        let createdBy = agentNameIds.First(x => x.FirstValue == notes.DataRecorderMetaData.DataRecorderCreator.Id).SecondValue
                                                                        select GetCustomerCallNotesViewModel(notes, createdBy));
                }
            }

            var notesViewModel = new CallQueueCustomerNotesViewModel
            {
                CallHistory       = callHistoryModel,
                CustomerCallNotes = customerCallNotesViewModel,
                DirectMail        = mailHistoryList
            };

            return(notesViewModel);
        }
Beispiel #7
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);
        }
Beispiel #8
0
 public ActionResult UpdateCallHistory(CallHistoryViewModel callHistory)
 {
     return(View(callHistory));
 }