public string UpdateCasecMark(string infomation) { //bắt sự kiện ngoại lệ như input NULL, contactID null hoặc trống, không có thông tin điểm // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateCasecMark, }; var input = JsonConvert.DeserializeObject <UpdateCasecMark>(infomation); var result = CheckInputUpdateCasecMark(input); if (result.Code == 0) { var info = TestResultRepository.TestHasMark(input.contactId); if (info.ContactId == 0) { TestResultRepository.InsertCasecMark(input.contactId, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec); } else { TestResultRepository.UpdateCasecMark(input.contactId, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec); } result.Code = 0; } var output = JsonConvert.SerializeObject(result); return(output); }
public Result SendCancelInterview(int ContactId) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendCancelInterview; log.Time = DateTime.Now; try { var model = new CancelInterview(); model.hocVienID = ContactId; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.CancelInterview(input); // Sửa tên Hàm của CongNN viết var result = JsonConvert.DeserializeObject <Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Không gửi được hủy phỏng vấn cho chuyên môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } }
public string UpdateInterviewMark(string infomation) { // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateInterviewMark, }; var input = JsonConvert.DeserializeObject <UpdateInterviewMark>(infomation); var result = CheckInputUpdateInterviewMark(input); if (result.Code == 0) { var info = TestResultRepository.TestHasMark(input.contactId); if (info.ContactId == 0) { TestResultRepository.InsertInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, info.LevelSpeakingId); } else { TestResultRepository.UpdateInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, info.LevelSpeakingId); } result.Code = 0; } var output = JsonConvert.SerializeObject(result); return(output); }
public Result SendInterviewInfo(AppointmentInterviewInfo info, bool isVip) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendInterviewInfo; log.Time = DateTime.Now; try { //gọi link của CongNN truyền vào các tham số contactId, Account, Password trên var model = new InterviewInfo(); model.hocVienID = info.ContactId; var infoContact = ContactRepository.GetInfo(info.ContactId); model.hoTenHocVien = infoContact.Fullname; model.ngayHenPV = (DateTime)info.AppointmentDate; model.khungGioID = info.TimeSlotId; model.ghiChuLichHen = info.Notes; var phones = PhoneRepository.GetByContact(info.ContactId); foreach (var phone in phones) { if (phone.IsPrimary == 1) { model.dienThoaiHV = phone.PhoneNumber; break; } } //model.dienThoaiHV = infoContact.Mobile1; model.kieuGV = info.TeacherTypeId; model.levelTester = info.LevelTesterId; //model.UserId = infoContact.UserConsultantId; var infoUser = UserRepository.GetInfo(info.UserId); model.AccountTVTS = infoUser.UserName; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = isVip == true?ws.UpdateTTPhongVanForVip(input) : ws.UpdateTTPhongVan(input); var result = JsonConvert.DeserializeObject <Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Có lỗi xảy ra trong quá trình đặt lịch phỏng vấn. Error: " + ex.Message; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } }
public Result SendRequestSB100Topica(int ContactId, int feePackageType) // tuy chon, thoa thich { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendRequestSB100Topica; log.Time = DateTime.Now; try { var TVTS = UserRepository.GetCurrentUserInfo(); var infoContact = ContactRepository.GetInfo(ContactId); var infoResult = TestResultRepository.GetResultTopicaCurent(ContactId); var model = new SB100Topica(); model.hocVienId = ContactId; model.ngayTest = infoResult.TestDate; model.S1 = infoResult.S1; model.S2 = infoResult.S2; model.S3 = infoResult.S3; model.S4 = infoResult.S4; var phones = PhoneRepository.GetByContact(ContactId); foreach (var phone in phones) { if (phone.IsPrimary == 1) { model.mobile = phone.PhoneNumber; break; } } model.tenHocVien = infoContact.Fullname; model.TVTS = TVTS.UserName; var infoLevel = ContactLevelInfoRepository.GetInfoByContactId(ContactId); model.kieuHocPhiId = feePackageType; // infoLevel.FeePackageType; var infoUser = UserRepository.GetInfo(infoContact.UserConsultantId); var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.UpdateSB100_topica(input); var result = JsonConvert.DeserializeObject <Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Không gửi được thông tin tài khoản cấp cho Chuyên Môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } }
public static void Create(TmpLogServiceInfo info) { try { DataProvider.Instance().TmpLogService_Insert(info.Status, info.CallType, info.Time, info.Description); } catch { } }
/// <summary> /// Hàm này dùng để get thông tin về cuộc gọi /// </summary> /// <param name="callId">Call id dùng để get thông tin cuộc gọi</param> /// <param name="mobile">Số điện thọai vừa gọi</param> /// <param name="stationId">station id vừa call</param> /// <param name="agencode">Agen code thường để là username</param> /// <param name="link">Địa chỉ webservice của callcenter (có thể có hoặc không)</param> /// <returns>Đối tượng lưu toàn bộ thông tin cuộc gọi. /// Kiểm tra error_code để biết cuộc gọi có lỗi hay ko? (=1 là lỗi)</returns> public static CallInfor GetCall(string callId, string mobile, string stationId, string agencode, string link = default(string)) { const string v_str_message_code = "004"; var v_dat_datetime_request = DateTime.Now.ToLongTimeString(); if (!mobile.StartsWith("0")) { mobile = "0" + mobile; } var v_str_input_string = "<agent_code>" + agencode + "</agent_code>" + "<mobile_phone>" + mobile + "</mobile_phone>" + "<station_id>" + stationId + "</station_id>" + "<datetime_request>" + v_dat_datetime_request + "</datetime_request>" + "<message_code>" + v_str_message_code + "</message_code>" + "<call_id>" + callId + "</call_id>"; var ws = link.IsStringNullOrEmpty() ? new WsCallCenterService.CallCenterClient("CallCenter") : new WsCallCenterService.CallCenterClient("CallCenter", new EndpointAddress(link)); //var v_str_result = ws.submit(v_str_input_string); //var v_obj_infor = JsonConvert.DeserializeObject<CLichSuCuocGoi>(v_str_result); try { var v_str_result = ws.submit(v_str_input_string); var v_obj_infor = JsonConvert.DeserializeObject <CLichSuCuocGoi>(v_str_result); //dat log var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = "---Input: " + v_str_input_string + "---Output: " + v_str_result.ToString(), CallType = (int)CallType.CheckGetCall, }; log.Status = 0; TmpLogServiceRepository.Create(log); return(v_obj_infor.data); } catch (Exception ex) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = ex.ToString(), CallType = (int)CallType.CheckGetCall, }; log.Status = 1; TmpLogServiceRepository.Create(log); return(null); } }
/// <summary> /// Hàm này dùng để cập nhật lịch hẹn /// </summary> public static bool UpdateAppointment(int campainId, int contactId, string mobile, DateTime calledDate, string callId, string stationId, string agentCode, string linkEditContact, out string message, string link = default(string)) { if (!mobile.StartsWith("0")) { mobile = "0" + mobile; } message = string.Empty; var xml = "<message_code>008</message_code>" + "<Phone>" + mobile + "</Phone>" + "<CallId>" + callId + "</CallId>" + "<CampainId>" + campainId + "</CampainId>" + "<ContactId>" + contactId + "</ContactId>" + "<AgentCode>" + agentCode + "</AgentCode>" + "<StationId>" + stationId + "</StationId>" + "<Url>" + string.Format(linkEditContact, contactId) + "</Url>" + "<CallDate>" + calledDate.ToString("ddMMyyyyHHmmss") + "</CallDate>" + "<CreateDate>" + DateTime.Now.ToString("ddMMyyyyHHmmss") + "</CreateDate>"; try { // Call Service var result = (link.IsStringNullOrEmpty() ? new TPCAutoDialClient() : new TPCAutoDialClient("TPCAutoDial", new EndpointAddress(link))).processMsg(xml); var code = result.GetElement("<error_code>(?<text>.*?)</error_code>"); message = result.GetElement("<error_desc>(?<text>.*?)</error_desc>"); // Log var log = new TmpLogServiceInfo { Time = DateTime.Now, CallType = (int)CallType.UpdateAppointment, Description = (int)ErrorServiceType.Success + "_" + xml + "_" + result, }; TmpLogServiceRepository.Create(log); // Return return(code.ToInt32() == 0); } catch (Exception ex) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = ex + "_" + xml, CallType = (int)CallType.UpdateAppointment, }; TmpLogServiceRepository.Create(log); return(false); } }
private static void UpdateLog(CallType type, string description) { try { var log = new TmpLogServiceInfo { Time = DateTime.Now, CallType = (int)type, Description = description, }; TmpLogServiceRepository.Create(log); } catch { } }
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 string UpdateCasecMark(string infomation) { // Moi them 1 truong levelCasec //bắt sự kiện ngoại lệ như input NULL, contactID null hoặc trống, không có thông tin điểm // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateCasecMark, }; try { var input = JsonConvert.DeserializeObject <UpdateCasecMark>(infomation); var result = CheckInputUpdateCasecMark(input); if (result.Code == 0) { TestResultRepository.InsertCasecMark(input.contactId, input.casecAccount, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec, input.tongDiem, input.ngayThi); 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 điểm 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 UpdateLinkSB100(string infomation) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateLinkSB100, }; try { //bắt sự kiện ngoại lệ như input NULL, không có/NULL/Sai định dạng link SB100 // Logs var input = JsonConvert.DeserializeObject <UpdateLinkSB100>(infomation); var result = CheckInputUpdateLinkSB100(input); if (result.Code == 0) { TestResultRepository.UpdateLinkSB100(input.contactId, input.SB100); 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 link 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 Result SendCasecAccount(CasecAccountInfo info) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendCasecAccount; log.Time = DateTime.Now; try { var model = new CasecAccount(); model.contactId = info.ContactId; model.casecAccount = info.Account; model.passWord = info.Password; // var infoContact = ContactRepository.GetInfo(info.ContactId); model.tenHV = infoContact.Fullname; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.UpdateAcountCasec(input); var result = JsonConvert.DeserializeObject <Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Không gửi được thông tin tài khoản cấp cho Chuyên Môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } }
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); } }
/// <summary> /// Hàm này dùng để get thông tin về cuộc gọi /// </summary> public static CallInfor GetCallTcl(string callId, string mobile, string stationId, string agenCode, int campainId, string link = default(string)) { const string messageCode = "007"; var datetimeRequest = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss tt"); var xml = "<message_code>" + messageCode + "</message_code>" + "<campaign_id>" + campainId + "</campaign_id>" + "<station_id>" + stationId + "</station_id>" + "<datetime_request>" + datetimeRequest + "</datetime_request>" + "<call_id>" + callId + "</call_id>"; try { var ws = link.IsStringNullOrEmpty() ? new TPCAutoDialClient() : new TPCAutoDialClient("TPCAutoDial", new EndpointAddress(link)); var result = ws.processMsg(xml); var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = xml + "_" + result, CallType = (int)CallType.GetCallInfo, }; TmpLogServiceRepository.Create(log); var entity = JsonConvert.DeserializeObject <CLichSuCuocGoi>(result); return(entity.data.error_code == "1" ? null : entity.data); } catch (Exception ex) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = xml + ex, CallType = (int)CallType.GetCallInfo, }; TmpLogServiceRepository.Create(log); return(null); } }
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); }
public string UpdateLinkSB100(string infomation) { //bắt sự kiện ngoại lệ như input NULL, không có/NULL/Sai định dạng link SB100 // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateLinkSB100, }; var input = JsonConvert.DeserializeObject <UpdateLinkSB100>(infomation); var result = CheckInputUpdateLinkSB100(input); if (result.Code == 0) { TestResultRepository.UpdateLinkSB100(input.contactId, input.SB100); 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 UpdateInterviewMark(string infomation) { // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateInterviewMark, }; try { var input = JsonConvert.DeserializeObject <UpdateInterviewMark>(infomation); var result = CheckInputUpdateInterviewMark(input); if (result.Code == 0) { TestResultRepository.InsertInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, input.levelSpeaking, input.Notes, input.agent_user); 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 điểm 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 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 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 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 ResultMissCall MissCall(string infomation) { // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.MissCall, }; //" <dien_thoai></dien_thoai> <thoi_gian></thoi_gian> <call_id_truoc> </call_id_truoc> <agent_code></agent_code>. "; if (string.IsNullOrEmpty(infomation)) { // Logs log.Status = 1; log.Description = "Thông tin cuộc gọi nhỡ rỗng"; TmpLogServiceRepository.Create(log); // Return return(new ResultMissCall { Code = (int)ErrorServiceType.NullOrEmpty, Description = "Thông tin cuộc gọi nhỡ rỗng", }); } var rg = new Regex("<dien_thoai>(?<phone>.*?)</dien_thoai>.*?" + "<thoi_gian>(?<time>.*?)</thoi_gian>.*?" + "<call_id_truoc>(?<call_id>.*?)</call_id_truoc>.*?" + "<agent_code>(?<agent_code>.*?)</agent_code>"); var mt = rg.Match(infomation); if (!mt.Success) { // 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", }); } var phone = mt.Groups["phone"].Value; if (string.IsNullOrEmpty(phone)) { // Logs log.Status = 1; log.Description = "Số điện thoại rỗng:" + infomation; TmpLogServiceRepository.Create(log); // Return return(new ResultMissCall { Description = "Số điện thoại rỗng", Code = (int)ErrorServiceType.NullOrEmpty, }); } try { phone = phone.Trim(); if (phone.StartsWith("0")) { phone = phone.Substring(1); } var contactEntity = ContactRepository.GetByMobile(phone); var entity = new MissedCallInfo { PhoneNumber = phone, CreatedTime = DateTime.Now, OldCallId = mt.Groups["call_id"].Value, Status = contactEntity == null ? -1 : 1, AgentCode = mt.Groups["agent_code"].Value, ContactId = contactEntity == null ? 0 : contactEntity.Id, UserId = contactEntity == null ? 0 : contactEntity.UserConsultantId, MissedCallTime = mt.Groups["time"].Value.ToDateTime("yyyyMMddHHmmss") ?? DateTime.Now, }; entity.Id = MissedCallRepository.Create(entity); // Logs log.Status = 0; log.Description = infomation; TmpLogServiceRepository.Create(log); // Return return(new ResultMissCall { Code = (int)ErrorServiceType.Success, Description = "Cập nhật cuộc gọi nhỡ 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 nhỡ không thành công, lỗi hệ thống", }); } }
public string UpdateTopicaMark(string infomation) { var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = infomation, CallType = (int)CallType.UpdateTopicaMark, }; try { var input = JsonConvert.DeserializeObject <UpdateTopicaMark>(infomation); var f = input.tuVung + input.dienDat + input.ngheHieu + input.chinhTa; int levelCasec = 0; if (f >= 0 && f <= 219) { levelCasec = 1; //basic 100 } else if (f >= 220 && f <= 239) { levelCasec = 3; //basic 200 } else if (f >= 330 && f <= 449) { levelCasec = 4; //basic 300 } else if (f >= 450 && f <= 549) { levelCasec = 32; //inter 100 } else if (f >= 550 && f <= 654) { levelCasec = 33; //inter 200 } else if (f >= 655 && f <= 759) { levelCasec = 34; //inter 300 } else if (f >= 760 && f <= 849) { levelCasec = 35; //adv 100 } else if (f >= 850 && f <= 909) { levelCasec = 36; //adv 200 } else if (f >= 909 && f <= 1000) { levelCasec = 37; //adv 300 } var result = CheckInputUpdateTopicaMark(input); if (result.Code == 0) { TestResultRepository.InsertTopicaMark(input.userName, input.tuVung, input.dienDat, input.ngheHieu, input.chinhTa, levelCasec); 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 " + infomation; var output = JsonConvert.SerializeObject(result); log.Description = result.Description + "_" + infomation; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(output); } }
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", }); } }