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); 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 static void Create(TmpLogServiceInfo info) { try { DataProvider.Instance().TmpLogService_Insert(info.Status, info.CallType, info.Time, info.Description); } catch { } }
public CallHistoryInfo Call(int id, string mobile) { if (string.IsNullOrEmpty(mobile)) return null; var user = UserRepository.GetCurrentUserInfo(); // Logs var log = new TmpLogServiceInfo { Time = DateTime.Now, Description = mobile, CallType = (int)CallType.Incoming, }; try { var item = HelpUtils.Call(mobile, user.StationId, user.UserName, StoreData.CallCenterSoapBinding); 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"), }; entity.CallHistoryId = CallHistoryRepository.Create(entity); // Logs log.Status = 0; TmpLogServiceRepository.Create(log); // Return return entity; } catch (Exception ex) { // Logs log.Status = 0; log.Description = ex.ToString(); TmpLogServiceRepository.Create(log); // Return return null; } }
// tuy chon, thoa thich public Result SendRequestSB100(int ContactId, int feePackageType) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendRequestSB100; log.Time = DateTime.Now; try { // var infoContact = ContactRepository.GetInfo(ContactId); var model = new SB100(); model.hocVienId = ContactId; model.hoTenHocVien = infoContact.Fullname; var phones = PhoneRepository.GetByContact(ContactId); foreach (var phone in phones) { if (phone.IsPrimary == 1) { model.dienThoai = phone.PhoneNumber; break; } } var infoLevel = ContactLevelInfoRepository.GetInfoByContactId(ContactId); model.kieuHocPhiId = feePackageType; // infoLevel.FeePackageType; var infoUser = UserRepository.GetInfo(infoContact.UserConsultantId); model.TVTS = infoUser.UserName; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.UpdateSB100(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 Result SendInterviewInfo(AppointmentInterviewInfo info) { 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.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 = 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 = "Không gửi được thông tin đặt lịch phỏng vấn cho chuyên môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return result; } }
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 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; } }
/// <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; } }
/// <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 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 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) { //var mod = TestResultRepository.TestHasMark(input.contactId); //var info = new TestResultInfo(); //info.ContactId = mod.ContactId; //if (mod == null) //{ // TestResultRepository.InsertInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, input.levelSpeaking); //} //else //{ // TestResultRepository.UpdateInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, input.levelSpeaking); //} TestResultRepository.InsertInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, input.levelSpeaking,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 đ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 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) { //var mod = TestResultRepository.TestHasMark(input.contactId); //var info = new TestResultInfo(); //info.ContactId = mod.ContactId; //if (mod == null) //{ // TestResultRepository.InsertCasecMark(input.contactId, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec, input.tongDiem,input.ngayThi); //} //else //{ // TestResultRepository.UpdateCasecMark(input.contactId, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec, input.tongDiem, input.ngayThi); //} 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 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); 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; } }