Esempio n. 1
0
 public static int Create(CallHistoryInfo info)
 {
     if (info.MobilePhone.StartsWith("0"))
     {
         info.MobilePhone = info.MobilePhone.Substring(1);
     }
     return(DataProvider.Instance().CallHistories_Insert(info.ContactId, info.StatusCareId, info.StatusMapId, info.CallTime, info.CallTimeLength, info.CallCenterInfo, info.RecallTime, info.CreatedBy, info.CreatedDate, info.MessageCode, info.AgentCode, info.StationId, info.MobilePhone, info.ResponseTime, info.CallId, info.StartTime, info.EndTime, info.Duration, info.RingTime, info.LinkRecord, info.Status, info.ErrorCode, info.ErrorDesc, info.LevelId, info.StatusUpdate, info.CallType, info.UserLogType));
 }
Esempio n. 2
0
 public static void RepairCall(CallHistoryInfo info)
 {
     if (info.MobilePhone.StartsWith("0"))
     {
         info.MobilePhone = info.MobilePhone.Substring(1);
     }
     DataProvider.Instance().CallHistories_RepairCall(info.CallHistoryId, info.MobilePhone, info.MessageCode, info.AgentCode, info.StationId, info.ResponseTime, info.CallId, info.StartTime, info.EndTime, info.Duration, info.RingTime, info.LinkRecord, info.Status, info.ErrorCode, info.ErrorDesc);
 }
        public void Remove(CallHistoryInfo callInfo)
        {
            if (callInfo == null)
            {
                return;
            }

            List.Remove(callInfo);
        }
        public void Add(CallHistoryInfo callInfo)
        {
            if (callInfo == null)
            {
                return;
            }

            List.Add(callInfo);
        }
        private void Redial()
        {
            CallHistoryInfo info = lvCallHistory.SelectedItem as CallHistoryInfo;

            if (info == null)
            {
                return;
            }

            DialNumber = info.OtherParty.Dialed;
            Dial(CallType.Audio, false);

            tiPhoneCalls.IsSelected = true;
        }
Esempio n. 6
0
        public CallHistoryInfo Call(int id, string mobile)
        {
            #region "Log Checkpoint - Begin Goi Den CallCenter 28/10/2016"
            int      SessionLog = TmpJobReportRepository.GetSessionLog();
            DateTime TimeBegin  = DateTime.Now;

            var logbegin = new LogDashBoard
            {
                Date      = DateTime.Now.Date,
                Time      = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                Name      = "BEGIN_CALL_CONTACT_TVTS",
                ContactId = id,
                CreatedBy = UserContext.GetCurrentUser().UserID,
                Runtime   = "0",
                Session   = SessionLog,
            };

            LogDashBoardRepository.CreateLogDashBoard(logbegin);
            #endregion

            if (string.IsNullOrEmpty(mobile))
            {
                return(null);
            }
            var user = UserRepository.GetCurrentUserInfo();


            // Logs
            var log = new TmpLogServiceInfo
            {
                Time     = DateTime.Now,
                CallType = (int)CallType.Incoming,
            };

            try
            {
                //var item = HelpUtils.Call(mobile, user.StationId, user.UserName, StoreData.CallCenterSoapBinding);

                var item = HelpUtils.CallNew(mobile, user.StationId, user.UserName, StoreData.LinkCallCenter);

                #region "Log Checkpoint - End Goi Den CallCenter 28/10/2016"
                DateTime TimeEnd = DateTime.Now;
                var      logend  = new LogDashBoard
                {
                    Date      = DateTime.Now.Date,
                    Time      = TimeEnd.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                    Name      = "END_CALL_CONTACT_TVTS",
                    ContactId = id,
                    CreatedBy = UserContext.GetCurrentUser().UserID,
                    Runtime   = "0",
                    Session   = SessionLog,
                    CallId    = item.call_id
                };
                LogDashBoardRepository.CreateLogDashBoard(logend);
                #endregion

                var entity = new CallHistoryInfo
                {
                    ContactId      = id,
                    StatusMapId    = 0,
                    StatusUpdate   = 1,
                    StatusCareId   = 0,
                    CallHistoryId  = 0,
                    RecallTime     = null,
                    CallTimeLength = 0,
                    Status         = item.status,
                    CallId         = item.call_id,
                    CreatedBy      = user.UserID,
                    CallTime       = DateTime.Now,
                    RingTime       = item.ringtime,
                    Duration       = item.duration,
                    CreatedDate    = DateTime.Now,
                    AgentCode      = item.agent_code,
                    ErrorCode      = item.error_code,
                    ErrorDesc      = item.error_desc,
                    StationId      = item.station_id,
                    CallCenterInfo = string.Empty,
                    MessageCode    = item.message_code,
                    MobilePhone    = item.mobile_phone,
                    LinkRecord     = item.link_down_record,
                    EndTime        = item.end_time.ToDateTime("yyyyMMddHHmmss"),
                    StartTime      = item.start_time.ToDateTime("yyyyMMddHHmmss"),
                    ResponseTime   = item.datetime_response.ToDateTime("yyyyMMddHHmmss"),
                    LogCallCenter  = item.log_callcenter
                };
                entity.CallHistoryId = CallHistoryRepository.Create(entity);

                // Logs
                log.Description = entity.LogCallCenter;
                log.Status      = 1; // ko lỗi
                TmpLogServiceRepository.Create(log);

                // Return
                return(entity);
            }
            catch (Exception ex)
            {
                // Logs
                log.Status      = 0; //lỗi
                log.Description = "CallHistories/Call, Mobile: " + mobile + ": " + ex.Message.ToString();
                TmpLogServiceRepository.Create(log);

                // Return
                return(null);
            }
        }
Esempio n. 7
0
        public ResultMissCall Incoming(string infomation)
        {
            // Logs
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.Incoming,
            };

            if (string.IsNullOrEmpty(infomation))
            {
                // Logs
                log.Status      = 1;
                log.Description = "Thông tin cuộc gọi đến rỗng";
                TmpLogServiceRepository.Create(log);

                // Return
                return(new ResultMissCall
                {
                    Code = (int)ErrorServiceType.NullOrEmpty,
                    Description = "Thông tin cuộc gọi đến rỗng",
                });
            }

            infomation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CallInfor>" + infomation + "</CallInfor>";
            var callInfo = ObjectHelper.CreateObject <CallInfor>(infomation);

            if (callInfo == null)
            {
                // Logs
                log.Status      = 1;
                log.Description = "Thông tin cuộc gọi không đúng định dạng: " + infomation;
                TmpLogServiceRepository.Create(log);

                // Return
                return(new ResultMissCall
                {
                    Code = (int)ErrorServiceType.NotFormat,
                    Description = "Thông tin cuộc gọi không đúng định dạng",
                });
            }

            try
            {
                callInfo.mobile_phone = callInfo.mobile_phone.Trim();
                if (callInfo.mobile_phone.StartsWith("0"))
                {
                    callInfo.mobile_phone = callInfo.mobile_phone.Substring(1);
                }
                var contactInfo = ContactRepository.GetByMobile(callInfo.mobile_phone);
                var entity      = new CallHistoryInfo
                {
                    // Info call
                    CallTimeLength = 0,
                    CallTime       = DateTime.Now,
                    Status         = callInfo.status,
                    CallId         = callInfo.call_id,
                    CreatedDate    = DateTime.Now,
                    Duration       = callInfo.duration,
                    RingTime       = callInfo.ringtime,
                    CallCenterInfo = string.Empty,
                    StationId      = callInfo.station_id,
                    AgentCode      = callInfo.agent_code,
                    ErrorCode      = callInfo.error_code,
                    ErrorDesc      = callInfo.error_desc,
                    CallType       = (int)CallType.Incoming,
                    MessageCode    = callInfo.message_code,
                    MobilePhone    = callInfo.mobile_phone,
                    UserLogType    = (int)EmployeeType.Consultant,
                    StatusUpdate   = contactInfo == null ? -1 : 2,
                    LinkRecord     = callInfo.link_down_record.IsStringNullOrEmpty()
                                                      ? string.Empty
                                                      : callInfo.link_down_record.Replace("/var/spool/asterisk/monitor", StoreData.LinkRecordCRM(contactInfo == null ? 0 : contactInfo.BranchId)),
                    EndTime      = callInfo.end_time.ToDateTime("yyyyMMddHHmmss"),
                    StartTime    = callInfo.start_time.ToDateTime("yyyyMMddHHmmss"),
                    ResponseTime = callInfo.datetime_response.ToDateTime("yyyyMMddHHmmss"),

                    // Info contact
                    ContactId    = contactInfo == null ? 0 : contactInfo.Id,
                    LevelId      = contactInfo == null ? 0 : contactInfo.LevelId,
                    CreatedBy    = contactInfo == null ? 0 : contactInfo.UserConsultantId,
                    StatusMapId  = contactInfo == null ? 0 : contactInfo.StatusMapConsultantId,
                    StatusCareId = contactInfo == null ? 0 : contactInfo.StatusCareConsultantId,
                    RecallTime   = contactInfo == null ? null : contactInfo.AppointmentConsultantDate,
                };
                CallHistoryRepository.Create(entity);

                // Logs
                log.Status      = 0;
                log.Description = infomation + " ==> BranchId: " + (contactInfo == null ? 0 : contactInfo.BranchId);
                TmpLogServiceRepository.Create(log);

                // Return
                return(new ResultMissCall
                {
                    Code = (int)ErrorServiceType.Success,
                    Description = "Cập nhật cuộc gọi đến thành công",
                });
            }
            catch (Exception ex)
            {
                // Logs
                log.Status      = 0;
                log.Description = ex + " ---- input" + infomation;
                TmpLogServiceRepository.Create(log);

                // Return
                return(new ResultMissCall
                {
                    Code = (int)ErrorServiceType.Exception,
                    Description = "Cập nhật cuộc gọi đến không thành công, lỗi hệ thống",
                });
            }
        }