public CallHistoryListModel GetByContactId(int contactId, int userLogType) { var list = CallHistoryRepository.GetAllByContactId(contactId) ?? new List <CallHistoryInfo>(); // Repear call var task = new Task(() => RepairCall(list.Where(c => !c.CallId.IsStringNullOrEmpty()) .Where(c => c.Duration.IsStringNullOrEmpty()))); //var task = new Task(() => RepairCall(list)); task.Start(); list = list.Where(c => c.StatusMapId > 0).ToList(); list = userLogType == (int)EmployeeType.Consultant ? list.Where(c => c.UserLogType.IsIntegerNull() || c.UserLogType == userLogType).ToList() : list.Where(c => c.UserLogType == userLogType).ToList(); var model = new CallHistoryListModel { Rows = list, }; var second = model.Rows.ToList().Sum(c => ConvertHelper.ToInt32(c.Duration)); var strTime = second >= 60 ? (second / 60) + " phút, " + (second % 60) + " giây" : second + " giây"; model.UserData = new List <string> { "Tổng số lượng gọi: " + model.Rows.Count(c => !string.IsNullOrEmpty(c.CallId)) + " cuộc", "Tổng thời gian gọi: " + strTime, }; return(model); }
public CallHistoryListModel GetCallError() { var listCallHistories = CallHistoryRepository.GetAllCallError() ?? new List <CallHistoryInfo>(); var model = new CallHistoryListModel { Rows = listCallHistories, }; return(model); }
public static void Main(string[] args) { var list = CallHistoryRepository.GetCallsEmptyLinkAll() ?? new List <CallHistoryInfo>(); RepairCall(list.Where(c => !c.CallId.IsStringNullOrEmpty()) .Where(c => c.Duration.IsStringNullOrEmpty())); list = list.Where(c => c.StatusMapId > 0).ToList(); list = userLogType == (int)EmployeeType.Consultant ? list.Where(c => c.UserLogType.IsIntegerNull() || c.UserLogType == userLogType).ToList() : list.Where(c => c.UserLogType == userLogType).ToList(); }
public string ChangeInterview(string infomation) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateChangeInterview, }; try { var input = JsonConvert.DeserializeObject <ChangeInterview>(infomation); var result = CheckInputChangeInterview(input); if (result.Code == 0) { CallHistoryRepository.UpdateChangeInterview(input.ContactId, input.StatusInterviewId, input.AppointmentDate, input.Notes, input.TeacherTypeId, input.TimeSlotId); //var entity = new AppointmentInterviewInfo // { // ContactId = input.ContactId, // } //AppointmentInterviewRepository.Create(); result.Code = 0; } var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Hệ thống hiện tại bị lỗi, cập nhật thay đổi trạng thái phỏng vấn không thành công" + infomation; var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } }
public CallHistoryListModel FilterHistory(int groupId, int userId, string handoverDate, string callDate, int statusMapId, int statusCareId, string levelIds, string mobilePhone, int employeeTypeId, int page, int rows) { string users; if (userId == 0) { if (groupId == 0) { users = string.Empty; } else { users = StoreData.ListUser .Where(c => c.GroupId == groupId) .Select(c => c.UserID.ToString()) .Distinct().Aggregate((total, curent) => total + "," + curent); } } else { users = userId.ToString(); } var employeeType = (EmployeeType)employeeTypeId; var dateCall = callDate.IsStringNullOrEmpty() ? null : callDate.ToDateTime(); var dateHandover = handoverDate.IsStringNullOrEmpty() ? null : handoverDate.ToDateTime(); int totalRecords; var model = new CallHistoryListModel { Rows = CallHistoryRepository.FilterHistory(users, dateHandover, dateCall, statusMapId, statusCareId, levelIds, mobilePhone, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = new List <string> { totalRecords.ToString(), }, Records = rows, Page = page, }; return(model); }
public CallHistoryListModel FilterHistoryForImporter(int userId, string callDate, string callDateEnd, string startTime, string endTime, int statusMapId, string levels, string educationLevels, string schools, string majors, int page, int rows) { DateTime?startDate = null, endDate = null; if (endTime.IsStringNullOrEmpty()) { endTime = "23:59:59"; } if (startTime.IsStringNullOrEmpty()) { startTime = "00:00:00"; } var dateCall = callDate.IsStringNullOrEmpty() ? null : callDate.ToDateTime(); var dateCallEnd = callDateEnd.IsStringNullOrEmpty() ? null : callDateEnd.ToDateTime(); if (dateCall != null) { startDate = (dateCall.Value.ToString("dd/MM/yyyy") + " " + startTime).ToDateTime("dd/MM/yyyy HH:mm:ss"); } if (dateCallEnd != null) { endDate = (dateCallEnd.Value.ToString("dd/MM/yyyy") + " " + endTime).ToDateTime("dd/MM/yyyy HH:mm:ss"); } int totalRecords; const int userLogType = (int)EmployeeType.Collaborator; var model = new CallHistoryListModel { Rows = CallHistoryRepository.FilterHistoryForImporter(userId, startDate, endDate, statusMapId, levels, educationLevels, schools, majors, userLogType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = new List <string> { totalRecords.ToString(), }, Records = rows, Page = page, }; return(model); }
public string GetAllByDateFromTo(FormDataCollection form)//(string dateTimeFrom, string dateTimeTo) { try { var dateFrom = TimeStampConvert.UnixTimeStampToDateTime(Double.Parse(form.Get("dateTimeFrom"))); var dateTo = TimeStampConvert.UnixTimeStampToDateTime(Double.Parse(form.Get("dateTimeTo"))); var result = CallHistoryRepository.GetAll_ByFromDate_ToDate(dateFrom, dateTo); foreach (var item in result) { if ((item.CreatedDate).HasValue) { item.CreatedDate_TimeStamp = TimeStampConvert.ConvertToUnixTime((DateTime)item.CreatedDate); } if ((item.StartTime).HasValue) { item.StartTime_TimeStamp = TimeStampConvert.ConvertToUnixTime((DateTime)item.StartTime); } if ((item.EndTime).HasValue) { item.EndTime_TimeStamp = TimeStampConvert.ConvertToUnixTime((DateTime)item.EndTime); } } var output = JsonConvert.SerializeObject(result); return(output); } catch (Exception ex) { Error error = new Error(); error.Code = 0; error.Description = ex.Message.ToString(); var outputError = JsonConvert.SerializeObject(error); return(outputError); } }
public string UpdateCallInfoCM(string infomation) { // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateCallInfoCM }; try { //bắt sự kiện ngoại lệ như input NULL, không có thông tin var input = JsonConvert.DeserializeObject <UpdateCasecCallInfo>(infomation); var result = CheckInputUpdateCasecCallInfo(input); if (result.Code == 0) { CallHistoryRepository.UpdateCallInfoCM(input.CallHistoryId, input.ContactId, input.AgentCode, input.StationId, input.MobilePhone, input.ResponseTime, input.StartTime, input.EndTime, input.RingTime, input.LinkRecord, input.CallCenterInfo, input.Duration, input.ErrorCode, input.ErrorDesc, input.StatusUpDate, input.CallType, input.CallTime); result.Code = 0; } var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Hệ thống hiện tại bị lỗi, cập nhật thông tin cuộc gọi không thành công" + infomation; var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } }
public string UpdateCallInfoCM(string infomation) { //bắt sự kiện ngoại lệ như input NULL, không có thông tin // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateInterviewInfoCM, }; var input = JsonConvert.DeserializeObject <UpdateCasecCallInfo>(infomation); var result = CheckInputUpdateCasecCallInfo(input); if (result.Code == 0) { CallHistoryRepository.UpdateCallInfoCM(input.CallHistoryId, input.ContactId, input.AgentCode, input.StationId, input.MobilePhone, input.ResponseTime, input.StartTime, input.EndTime, input.RingTime, input.LinkRecord, input.CallCenterInfo, input.Duration, input.ErrorCode, input.ErrorDesc, input.StatusUpDate, input.CallType); result.Code = 0; } var output = JsonConvert.SerializeObject(result); return(output); }
static void Main(string[] args) { //Goi ham get CallHistoryInfo tat ca cac cuoc goi chua co link ghi am. int count = 1; while (true) { count = 1; List <CallHistoryInfo> items = CallHistoryRepository.GetAllCallInfoNotLinkRecords(); foreach (CallHistoryInfo item in items) { try { StoreData.Job_WsUpdateCallHistoryInfo(item.CallHistoryId); var itemInfo = CallHistoryRepository.GetInfo(item.CallHistoryId); Console.WriteLine(count + "/" + items.Count + " TIME: " + itemInfo.CreatedDate + " MESSAGE: " + itemInfo.ErrorDesc + " CALLID: " + itemInfo.CallId + " LINKRECORD: " + itemInfo.LinkRecord); Console.WriteLine(); count++; } catch (Exception ex) { Console.WriteLine("Log exception: " + ex.Message); var itemInfo = CallHistoryRepository.GetInfo(item.CallHistoryId); Console.WriteLine("EXCEPTION - MESSAGE: " + itemInfo.ErrorDesc + " CALLID: " + itemInfo.CallId + "TIME: " + itemInfo.CreatedDate); Console.WriteLine(); count++; TmpLogServiceInfo tmp = new TmpLogServiceInfo(); tmp.CallType = (int)CallType.ExceptionLogGetLinkRecord; tmp.Status = 1; tmp.Description = ""; tmp.Time = DateTime.Now; TmpLogServiceRepository.Create(tmp); } } } Console.ReadLine(); }
public string UpdateStatusInterview(string infomation) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateStatusInterview, }; try { var input = JsonConvert.DeserializeObject <UpdateStatusInterview>(infomation); var result = CheckInputUpdateStatusInterview(input); if (result.Code == 0) { CallHistoryRepository.UpdateStatusInterview(input.ContactId, input.StatusInterviewId, input.Notes); result.Code = 0; } var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Hệ thống hiện tại bị lỗi, cập nhật trạng thái phỏng vấn không thành công" + infomation; var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } }
public static T Create <T>(ContactInfo info) where T : BCModelContact { var objModel = Activator.CreateInstance(typeof(T)) as BCModelContact; if (objModel == null) { return(default(T)); } objModel.Id = info.Id; objModel.Code = info.Code; objModel.Email = info.Email; objModel.Location = info.Address; objModel.Fullname = info.Fullname; objModel.Level = Enum.GetName(typeof(LevelType), info.LevelId); objModel.SourceType = Enum.GetName(typeof(SourceType), info.TypeId); objModel.HandoverDate = info.HandoverConsultantDate != null ? info.HandoverConsultantDate.Value.ToString("dd/MM/yyyy") : string.Empty; objModel.HandoverDistributorDate = info.HandoverCollaboratorDate != null ? info.HandoverCollaboratorDate.Value.ToString("dd/MM/yyyy") : info.RegisteredDate != null?info.RegisteredDate.Value.ToString("dd/MM/yyyy") : string.Empty; // Phone var phones = PhoneRepository.GetByContact(info.Id); if (phones != null) { var phoneEntity = phones.FirstOrDefault(phone => phone.IsPrimary > 0) ?? phones.FirstOrDefault(); if (phoneEntity != null) { objModel.Mobile = phoneEntity.PhoneNumber; } } // StatusCare var statusCare = StatusCareRepository.GetAll().FirstOrDefault(c => c.Id == info.StatusCareConsultantId); if (statusCare != null) { objModel.StatusCare = statusCare.Name; } // StatusMap var statusMap = StatusMapRepository.GetAll().FirstOrDefault(c => c.Id == info.StatusMapConsultantId) ?? StatusMapRepository.GetInfo(info.StatusMapConsultantId); if (statusMap != null) { objModel.StatusMap = statusMap.Name; } // Notes if (info.CallInfoConsultant.IsStringNullOrEmpty()) { var callHistories = CallHistoryRepository.GetAllByContactId(info.Id); if (!callHistories.IsNullOrEmpty()) { objModel.Notes = callHistories.Last().CallCenterInfo; } } else { objModel.Notes = info.CallInfoConsultant; } // Channel if (objModel.SourceType == Enum.GetName(typeof(SourceType), Core.SourceType.MO)) { var channel = ChannelRepository.GetAll().FirstOrDefault(c => c.ChannelId == info.ChannelId) ?? ChannelRepository.GetInfo(info.ChannelId); if (channel != null) { objModel.Channel = channel.Name; } } else if (objModel.SourceType == Enum.GetName(typeof(SourceType), Core.SourceType.CC)) { if (info.UserCollaboratorId > 0) { var user = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserCollaboratorId); if (user != null) { objModel.Channel = user.FullName; } } } else { if (info.ChannelId == 1) { if (info.UserCollaboratorId > 0) { var user = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserCollaboratorId); if (user != null) { objModel.Channel = user.FullName; } } } if (objModel.Channel.IsStringNullOrEmpty()) { var channel = ChannelRepository.GetAll().FirstOrDefault(c => c.ChannelId == info.ChannelId) ?? ChannelRepository.GetInfo(info.ChannelId); if (channel != null) { objModel.Channel = channel.Name; } } } // Consultant var consultant = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserConsultantId) ?? UserRepository.GetInfo(info.UserConsultantId); if (consultant != null) { objModel.Consultant = consultant.FullName; } return((T)objModel); }
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); } }
public CallHistoryInfo Get(int id) { return(CallHistoryRepository.GetInfo(id)); }
public int RepairCall() { var list = CallHistoryRepository.GetAllCallError() ?? new List <CallHistoryInfo>(); return(list.IsNullOrEmpty() ? 0 : RepairCall(list)); }
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", }); } }
public Result TCLCallInfoUpdate(string infomation) { // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.IncomingUpdate, }; 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 Result { Code = (int)ErrorServiceType.NullOrEmpty, Description = "Thông tin cuộc gọi đến rỗng", }); } infomation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CallInforUpdate>" + infomation + "</CallInforUpdate>"; var callInfo = ObjectHelper.CreateObject <CallInforUpdate>(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 Result { Code = (int)ErrorServiceType.NotFormat, Description = "Thông tin cuộc gọi không đúng định dạng", }); } try { if (callInfo.station_id.IsStringNullOrEmpty()) { var arr = callInfo.agent_code.Split('/'); if (arr.Length > 1) { callInfo.station_id = arr[1]; } } 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 callHitoryInfo = CallHistoryRepository.GetInfoIdentifyTcl(callInfo.call_id, (int)EmployeeType.Collaborator) ?? new CallHistoryInfo(); callHitoryInfo.CallTimeLength = 0; callHitoryInfo.CallTime = DateTime.Now; callHitoryInfo.Status = callInfo.status; callHitoryInfo.CallId = callInfo.call_id; callHitoryInfo.CreatedDate = DateTime.Now; callHitoryInfo.Duration = callInfo.duration; callHitoryInfo.RingTime = callInfo.ringtime; callHitoryInfo.CallCenterInfo = string.Empty; callHitoryInfo.StationId = callInfo.station_id; callHitoryInfo.AgentCode = callInfo.agent_code; callHitoryInfo.ErrorCode = callInfo.error_code; callHitoryInfo.ErrorDesc = callInfo.error_desc; callHitoryInfo.MessageCode = callInfo.message_code; callHitoryInfo.MobilePhone = callInfo.mobile_phone; callHitoryInfo.CallType = (int)CallType.IncomingUpdate; callHitoryInfo.StatusUpdate = contactInfo == null ? -1 : 2; callHitoryInfo.UserLogType = (int)EmployeeType.Collaborator; callHitoryInfo.LinkRecord = callInfo.link_down_record.IsStringNullOrEmpty() ? string.Empty : callInfo.link_down_record.Replace("/var/spool/asterisk/monitor/5678/", StoreData.LinkRecordTCL(contactInfo == null ? 0 : contactInfo.BranchId)); callHitoryInfo.EndTime = callInfo.end_time.ToDateTime("yyyyMMddHHmmss"); callHitoryInfo.StartTime = callInfo.start_time.ToDateTime("yyyyMMddHHmmss"); callHitoryInfo.ResponseTime = callInfo.datetime_response.ToDateTime("yyyyMMddHHmmss"); if (callHitoryInfo.ContactId.IsIntegerNull()) { callHitoryInfo.ContactId = contactInfo == null ? 0 : contactInfo.Id; } if (callHitoryInfo.LevelId.IsIntegerNull()) { callHitoryInfo.LevelId = contactInfo == null ? 0 : contactInfo.LevelId; } if (callHitoryInfo.CreatedBy.IsIntegerNull()) { callHitoryInfo.CreatedBy = contactInfo == null ? 0 : contactInfo.UserConsultantId; } if (callHitoryInfo.RecallTime == null) { callHitoryInfo.RecallTime = contactInfo == null ? null : contactInfo.AppointmentConsultantDate; } if (callHitoryInfo.StatusMapId.IsIntegerNull()) { callHitoryInfo.StatusMapId = contactInfo == null ? 0 : contactInfo.StatusMapConsultantId; } if (callHitoryInfo.StatusCareId.IsIntegerNull()) { callHitoryInfo.StatusCareId = contactInfo == null ? 0 : contactInfo.StatusCareConsultantId; } if (callHitoryInfo.CallCenterInfo.IsStringNullOrEmpty()) { callHitoryInfo.CallCenterInfo = contactInfo == null ? string.Empty : contactInfo.CallInfoConsultant; } CallHistoryRepository.Create(callHitoryInfo); // Logs log.Status = 0; log.Description = infomation + " ==> BranchId: " + (contactInfo == null ? 0 : contactInfo.BranchId); TmpLogServiceRepository.Create(log); // Return return(new Result { 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 Result { 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", }); } }