/// <summary> /// Hàm này thực hiện chức năng trả về 1 Obj call infor, chứa các thông tin ban đầu của cuộc gọi /// </summary> /// <param name="ip_str_client_string_call">String call của client gửi về; dạng như: </param> /// <returns></returns> public static CallInfor get_start_callinfo_from_client_string_call(string ip_str_client_string_call) { // String client có dạng: <MSG><EVENT>INCOMINGCALL</EVENT><PHONENUMBER>01678334137</PHONENUMBER><CALLID>1242332</CALLID></MSG> CallInfor v_obj_start_call = new CallInfor(); //string v_str_event = ""; string v_str_callid = ""; string v_str_phonecall = ""; int v_index_start_phonecall = 0, v_index_end_phonecall = 0, v_index_start_callid = 0, v_index_end_callid = 0; v_index_start_phonecall = ip_str_client_string_call.IndexOf("<PHONENUMBER>"); v_index_end_phonecall = ip_str_client_string_call.IndexOf("</PHONENUMBER>"); v_index_start_callid = ip_str_client_string_call.IndexOf("<CALLID>"); v_index_end_callid = ip_str_client_string_call.IndexOf("</CALLID>"); if (v_index_start_phonecall > 0) { v_str_phonecall = ip_str_client_string_call.Substring(v_index_start_phonecall + "<PHONENUMBER>".Length, v_index_end_phonecall - (v_index_start_phonecall + "<PHONENUMBER>".Length)); } if (v_index_start_callid > 0) { v_str_callid = ip_str_client_string_call.Substring(v_index_start_callid + "<CALLID>".Length, v_index_end_callid - (v_index_start_callid + "<CALLID>".Length)); } v_obj_start_call.call_id = v_str_callid; v_obj_start_call.mobile_phone = v_str_phonecall; return(v_obj_start_call); }
public static void open_form_sinh_vien_call(CallInfor ip_call_info) { try { SinhVien v_obj_sinhvien = new SinhVien(); SyncData v_ws_scm = new SyncData(); string v_str_search = HelpUtils.gen_string_call_scm_get_sinh_vien_ws(ip_call_info.mobile_phone, "", "", "", "10", "TOPICA"); DataSet v_ds = v_ws_scm.TOS_search_info_hoc_vien(v_str_search); v_obj_sinhvien.get_sinh_vien_by_ds(v_ds); // // Nếu ko tìm được học viên thì Số điện thoại sẽ được bảo toàn, tránh bị Null // if (v_obj_sinhvien.Dien_thoai == null) v_obj_sinhvien.Dien_thoai = ip_call_info.mobile_phone; f200_sinh_vien_goi_den v_f200 = new f200_sinh_vien_goi_den(); v_f200.display(v_obj_sinhvien, ip_call_info.call_id); string v_str_thong_tin_goi_vao = ""; if (v_obj_sinhvien.Ho_ten != "") v_str_thong_tin_goi_vao += "Họ tên: " + v_obj_sinhvien.Ho_ten + "; "; if (v_obj_sinhvien.Dien_thoai != "") v_str_thong_tin_goi_vao += "ĐT: " + v_obj_sinhvien.Dien_thoai; HelpUtils.ghi_log_he_thong(LOG_TRUY_CAP.HOC_VIEN_GOI_DEN, v_str_thong_tin_goi_vao, "Gọi vào", f002_main_form.m_str_stationId); } catch (Exception v_e) { CSystemLog_100.ExceptionHandle(v_e); } }
public static void open_form_sinh_vien_call(CallInfor ip_call_info) { try { SinhVien v_obj_sinhvien = new SinhVien(); SyncData v_ws_scm = new SyncData(); string v_str_search = HelpUtils.gen_string_call_scm_get_sinh_vien_ws(ip_call_info.mobile_phone, "", "", "", "10", "TOPICA"); DataSet v_ds = v_ws_scm.TOS_search_info_hoc_vien(v_str_search); v_obj_sinhvien.get_sinh_vien_by_ds(v_ds); // // Nếu ko tìm được học viên thì Số điện thoại sẽ được bảo toàn, tránh bị Null // if (v_obj_sinhvien.Dien_thoai == null) { v_obj_sinhvien.Dien_thoai = ip_call_info.mobile_phone; } //f200_sinh_vien_goi_den v_f200 = new f200_sinh_vien_goi_den(); // v_f200.display(v_obj_sinhvien, ip_call_info.call_id); string v_str_thong_tin_goi_vao = ""; if (v_obj_sinhvien.Ho_ten != "") { v_str_thong_tin_goi_vao += "Họ tên: " + v_obj_sinhvien.Ho_ten + "; "; } if (v_obj_sinhvien.Dien_thoai != "") { v_str_thong_tin_goi_vao += "ĐT: " + v_obj_sinhvien.Dien_thoai; } // HelpUtils.ghi_log_he_thong(LOG_TRUY_CAP.HOC_VIEN_GOI_DEN, v_str_thong_tin_goi_vao, "Gọi vào", f002_main_form.m_str_stationId); } catch (Exception v_e) { CSystemLog_100.ExceptionHandle(v_e); } }
public void display_for_ipphone(CallInfor ip_call_infor) { m_ip_call_infor = ip_call_infor; DataSet v_ds = new DataSet(); v_ds.Tables.Add(new DataTable()); US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); v_us.FillDatasetWithQuery(v_ds, "select * from dm_khach_hang where DIEN_THOAI = '" + ip_call_infor.mobile_phone + "'"); if (v_ds.Tables[0].Rows.Count > 0) { m_cbo_user_nhan_vien_dat_hang.SelectedValue = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][0].ToString()); } m_e_form_mode = DataEntryFormMode.InsertDataState; this.ShowDialog(); m_cbo_phuong_thuc_dat_hang.SelectedValue = 183; // nếu đang có đơn hàng thì xử lí như thế nào }
private static void HandleClientComm(object client) { TcpClient tcpClient = (TcpClient)client; NetworkStream clientStream = tcpClient.GetStream(); byte[] message = new byte[4096]; int bytesRead; while (true) { bytesRead = 0; try { //blocks until a client sends a message bytesRead = clientStream.Read(message, 0, 4096); } catch { //a socket error has occured break; } if (bytesRead == 0) { //the client has disconnected from the server break; } //message has successfully been received ASCIIEncoding encoder = new ASCIIEncoding(); string v_str_output = encoder.GetString(message, 0, bytesRead); CallInfor v_obj_callinfo = HelpUtils.get_start_callinfo_from_client_string_call(v_str_output); if (v_obj_callinfo.mobile_phone == "Anonymous") { return; } open_form_sinh_vien_call(v_obj_callinfo); tcpClient.Close(); } }
/// <summary> /// Hàm này thực hiện chức năng trả về 1 Obj call infor, chứa các thông tin ban đầu của cuộc gọi /// </summary> /// <param name="ip_str_client_string_call">String call của client gửi về; dạng như: </param> /// <returns></returns> public static CallInfor get_start_callinfo_from_client_string_call(string ip_str_client_string_call) { // String client có dạng: <MSG><EVENT>INCOMINGCALL</EVENT><PHONENUMBER>01678334137</PHONENUMBER><CALLID>1242332</CALLID></MSG> CallInfor v_obj_start_call = new CallInfor(); //string v_str_event = ""; string v_str_callid = ""; string v_str_phonecall = ""; int v_index_start_phonecall = 0, v_index_end_phonecall = 0, v_index_start_callid = 0, v_index_end_callid = 0; v_index_start_phonecall = ip_str_client_string_call.IndexOf("<PHONENUMBER>"); v_index_end_phonecall = ip_str_client_string_call.IndexOf("</PHONENUMBER>"); v_index_start_callid = ip_str_client_string_call.IndexOf("<CALLID>"); v_index_end_callid = ip_str_client_string_call.IndexOf("</CALLID>"); if (v_index_start_phonecall > 0) v_str_phonecall = ip_str_client_string_call.Substring(v_index_start_phonecall + "<PHONENUMBER>".Length, v_index_end_phonecall - (v_index_start_phonecall + "<PHONENUMBER>".Length)); if (v_index_start_callid > 0) v_str_callid = ip_str_client_string_call.Substring(v_index_start_callid + "<CALLID>".Length, v_index_end_callid - (v_index_start_callid + "<CALLID>".Length)); v_obj_start_call.call_id = v_str_callid; v_obj_start_call.mobile_phone = v_str_phonecall; return v_obj_start_call; }
private void tab2_save_data() { if (tab2_check_validate_data_is_ok() == false) return; m_us_gd_xu_ly_noi_bo.dcID = 1; // giá trị bất kỳ; update dựa vào call id m_call_infor = HelpUtils.get_call_infor(m_call_infor.call_id, m_call_infor.mobile_phone, m_call_infor.station_id, CAppContext_201.getCurrentUserName()); form_2_usobject_goi_noi_bo(); m_us_gd_xu_ly_noi_bo.Update(); load_data_2_grid(); reset_form_tab2(); m_e_form_state = e_form_state.DA_LUU_THONG_TIN_CALL; }
private void call_2_nguoi_dai_dien() { m_e_form_state = e_form_state.DA_CALL_NDD; string v_str_so_dien_thoai = ""; v_str_so_dien_thoai = m_txt_dien_thoai_ndd.Text; m_call_infor = HelpUtils.call_2_contact(v_str_so_dien_thoai, m_str_stationcode, CAppContext_201.getCurrentUserName()); // Insert vào GD xử lý nội bộ form_2_usobject_goi_noi_bo(); m_us_gd_xu_ly_noi_bo.Insert(); HelpUtils.ghi_log_he_thong(LOG_TRUY_CAP.USER_GOI_NOI_BO, m_cbo_nguoi_dai_dien.SelectedItem.ToString(), "Gọi nội bộ", ""); }
//private void insert_cuoc_goi_moi() //{ // m_us_cuoc_goi = new US_GD_CUOC_GOI_YEU_CAU(); // m_us_cuoc_goi.dcCALL_ID = CIPConvert.ToDecimal(m_call_id); // m_us_cuoc_goi.strCUOC_GOI_VAO_YN = "Y"; // m_us_cuoc_goi.strHO_TEN_SINH_VIEN = m_txt_ho_ten.Text; // m_us_cuoc_goi.strLOP = m_txt_ma_lop.Text; // m_us_cuoc_goi.strMA_SINH_VIEN = m_txt_ma_hoc_vien.Text; // m_us_cuoc_goi.strNOI_SINH = m_txt_noi_sinh.Text; // m_us_cuoc_goi.strSO_DIEN_THOAI = m_txt_dien_thoai.Text; // m_us_cuoc_goi.strTRUONG = CIPConvert.ToStr(m_cbo_truong.SelectedValue); // m_us_cuoc_goi.dcID_NGUOI_DUNG = CAppContext_201.getCurrentUserID(); // m_us_cuoc_goi.dcSTATION_ID = CIPConvert.ToDecimal(f001_main_form.m_str_stationId); // m_us_cuoc_goi.Insert(); //} private void insert_cuoc_goi_moi() { // Trường hợp này xảy ra khi bấm nút Lưu câu hỏi lần đầu tiên // Nếu cuộc gọi chưa được insert thì phải insert trước if (m_us_cuoc_goi.dcID == -1) { m_us_cuoc_goi.strCALL_ID = m_call_id; m_us_cuoc_goi.strCUOC_GOI_VAO_YN = "Y"; m_us_cuoc_goi.strHO_TEN_SINH_VIEN = m_txt_ho_ten.Text; m_us_cuoc_goi.strLOP = m_txt_ma_lop.Text; m_us_cuoc_goi.strMA_SINH_VIEN = m_txt_ma_hoc_vien.Text; m_us_cuoc_goi.strNOI_SINH = m_txt_noi_sinh.Text; m_us_cuoc_goi.strSO_DIEN_THOAI = m_txt_dien_thoai.Text; m_us_cuoc_goi.strTRUONG = CIPConvert.ToStr(m_cbo_truong.SelectedValue); m_us_cuoc_goi.dcID_NGUOI_DUNG = CAppContext_201.getCurrentUserID(); m_us_cuoc_goi.dcSTATION_ID = CIPConvert.ToDecimal(f002_main_form.m_str_stationId); m_us_cuoc_goi.dcID_TRANG_THAI = -1; m_us_cuoc_goi.strHO_TEN_QLHT = m_txt_ho_ten_qlht.Text.Trim(); m_us_cuoc_goi.strDIEN_THOAI_QLHT = m_txt_dien_thoai_qlht.Text.Trim(); if (m_e_form_mode == e_form_mode.NHAP_TAY) m_us_cuoc_goi.dcTHOI_DIEM_GOI = THOI_DIEM_GOI.GOI_BUOI_TOI; else if (m_e_form_mode == e_form_mode.TU_DONG_OPEN) m_us_cuoc_goi.dcTHOI_DIEM_GOI = THOI_DIEM_GOI.GOI_BAN_NGAY; m_us_cuoc_goi.Insert(); } // Trường hợp này xảy ra khi bấm nút End Call // Nếu cuộc gọi đã được insert rồi thì chỉ việc update thông tin còn lại. else { CallInfor v_call_info = new CallInfor(); if (m_e_form_mode == e_form_mode.TU_DONG_OPEN) v_call_info = HelpUtils.get_call_infor(m_call_id ); else v_call_info = HelpUtils.get_call_infor_overtime(m_call_id ); m_us_cuoc_goi.strERROR_CODE = v_call_info.error_code; m_us_cuoc_goi.strERROR_DESC = v_call_info.error_desc; m_us_cuoc_goi.strSTATUS = v_call_info.status; m_us_cuoc_goi.strVOICE_CALL_LINK = v_call_info.link_down_record; if (v_call_info.datetime_response != null) m_us_cuoc_goi.datDATETIME_RESPOND = HelpUtils.string_2_datetime(v_call_info.datetime_response); else m_us_cuoc_goi.datDATETIME_RESPOND = CIPConvert.ToDatetime("01/01/1900","dd/MM/yyyy"); if (v_call_info.end_time != null) m_us_cuoc_goi.datEND_TIME = HelpUtils.string_2_datetime(v_call_info.end_time); else m_us_cuoc_goi.datEND_TIME = CIPConvert.ToDatetime("01/01/1900", "dd/MM/yyyy"); if (v_call_info.start_time!= null) m_us_cuoc_goi.datSTART_TIME =HelpUtils.string_2_datetime(v_call_info.start_time); else m_us_cuoc_goi.datSTART_TIME = CIPConvert.ToDatetime("01/01/1900", "dd/MM/yyyy"); m_us_cuoc_goi.dcDURATION = CIPConvert.ToDecimal( v_call_info.duration); m_us_cuoc_goi.dcID_TRANG_THAI = m_dc_id_trang_thai_cuoc_goi; m_us_cuoc_goi.dcRINGTIME = CIPConvert.ToDecimal(v_call_info.ringtime); m_us_cuoc_goi.strHO_TEN_SINH_VIEN = m_txt_ho_ten.Text.Trim(); m_us_cuoc_goi.dcID_NGUOI_DUNG = CAppContext_201.getCurrentUserID(); m_us_cuoc_goi.strSO_DIEN_THOAI = m_txt_dien_thoai.Text; m_us_cuoc_goi.strCUOC_GOI_VAO_YN = "Y"; m_us_cuoc_goi.strCALL_ID = m_call_id; if (m_e_form_mode == e_form_mode.NHAP_TAY) m_us_cuoc_goi.dcTHOI_DIEM_GOI = THOI_DIEM_GOI.GOI_BUOI_TOI; else if (m_e_form_mode == e_form_mode.TU_DONG_OPEN) m_us_cuoc_goi.dcTHOI_DIEM_GOI = THOI_DIEM_GOI.GOI_BAN_NGAY; m_us_cuoc_goi.Update(); BaseMessages.MsgBox_Infor("Đã lưu thông tin cuộc gọi thành công"); } }
private void goi_cho_sinh_vien() { CallInfor v_call_info = new CallInfor(); v_call_info = HelpUtils.call_2_contact("01682077618", "2000", "admin"); m_call_id = v_call_info.call_id; CallInfor v_call_info_answer = new CallInfor(); v_call_info_answer = HelpUtils.get_call_infor("139463024488", "01682077618", "2000", "admin"); string v_str_ket_qua = v_call_info_answer.agent_code + "\n" + v_call_info_answer.call_id + "\n" + v_call_info_answer.datetime_response + "\n" + v_call_info_answer.duration + "\n" + v_call_info_answer.end_time + "\n" + v_call_info_answer.error_code + "\n" + v_call_info_answer.error_desc + "\n" + v_call_info_answer.link_down_record + "\n" + v_call_info_answer.message_code + "\n" + v_call_info_answer.mobile_phone + "\n" + v_call_info_answer.ringtime + "\n" + v_call_info_answer.start_time + "\n" + v_call_info_answer.station_id + "\n" + v_call_info_answer.status + "\n" + v_call_info_answer.ToString(); }
private void update_info_cuoc_goi() { CallInfor v_call_info = new CallInfor(); v_call_info = HelpUtils.get_call_infor(m_us_cuoc_goi.strCALL_ID , m_txt_dien_thoai.Text , f002_main_form.m_str_stationId , CAppContext_201.getCurrentUserName()); m_us_cuoc_goi.strERROR_CODE = v_call_info.error_code; m_us_cuoc_goi.strERROR_DESC = v_call_info.error_desc; //m_us_cuoc_goi.strNOI_DUNG_TRAO_DOI = ??? m_us_cuoc_goi.strSTATUS = v_call_info.status; m_us_cuoc_goi.strVOICE_CALL_LINK = v_call_info.link_down_record; m_us_cuoc_goi.datDATETIME_RESPOND = HelpUtils.string_2_datetime(v_call_info.datetime_response); m_us_cuoc_goi.datEND_TIME = HelpUtils.string_2_datetime(v_call_info.end_time); m_us_cuoc_goi.datSTART_TIME =HelpUtils.string_2_datetime( v_call_info.start_time); m_us_cuoc_goi.dcDURATION = CIPConvert.ToDecimal( v_call_info.duration); m_us_cuoc_goi.dcRINGTIME = CIPConvert.ToDecimal(v_call_info.ringtime); m_us_cuoc_goi.BeginTransaction(); m_us_cuoc_goi.Update(); m_us_cuoc_goi.CommitTransaction(); BaseMessages.MsgBox_Infor("Đã lưu thông tin cuộc gọi thành công"); }
void m_pic_call_hoc_vien_Click(object sender, EventArgs e) { try { CallInfor v_call_info_obj = new CallInfor(); v_call_info_obj = HelpUtils.call_2_contact(m_txt_dien_thoai.Text.Trim() , f002_main_form.m_str_stationId , CAppContext_201.getCurrentUserName()); m_us_cuoc_goi.strCALL_ID = v_call_info_obj.call_id; m_us_cuoc_goi.strCUOC_GOI_VAO_YN = "N"; m_us_cuoc_goi.strHO_TEN_SINH_VIEN = m_txt_ho_ten.Text; m_us_cuoc_goi.strLOP = m_txt_ma_lop.Text; m_us_cuoc_goi.strMA_SINH_VIEN = m_txt_ma_hoc_vien.Text; m_us_cuoc_goi.strNOI_SINH = m_txt_noi_sinh.Text; m_us_cuoc_goi.strSO_DIEN_THOAI = m_txt_dien_thoai.Text; if (m_cbo_truong.SelectedValue != null) m_us_cuoc_goi.strTRUONG = m_cbo_truong.SelectedValue.ToString(); else m_us_cuoc_goi.strTRUONG = "------"; m_us_cuoc_goi.dcID_NGUOI_DUNG = CAppContext_201.getCurrentUserID(); m_us_cuoc_goi.dcSTATION_ID = CIPConvert.ToDecimal(f002_main_form.m_str_stationId); m_us_cuoc_goi.dcID_TRANG_THAI = -1; m_us_cuoc_goi.dcID_CAU_HOI_LIEN_QUAN = CIPConvert.ToDecimal(m_fg[m_fg.Row, (int)e_col_Number.ID_CAU_HOI]); m_us_cuoc_goi.dcID_CUOC_GOI_LIEN_QUAN = CIPConvert.ToDecimal(m_fg[m_fg.Row, (int)e_col_Number.ID_YEU_CAU]); m_us_cuoc_goi.Insert(); } catch (Exception v_e) { CSystemLog_100.ExceptionHandle(v_e); } }
private void insert_cuoc_goi_moi() { CallInfor v_call_info = new CallInfor(); v_call_info = HelpUtils.get_call_infor(m_us_cuoc_goi.strCALL_ID ); m_us_cuoc_goi.strERROR_CODE = v_call_info.error_code; m_us_cuoc_goi.strERROR_DESC = v_call_info.error_desc; m_us_cuoc_goi.strSTATUS = v_call_info.status; m_us_cuoc_goi.strVOICE_CALL_LINK = v_call_info.link_down_record; if (v_call_info.datetime_response != null) m_us_cuoc_goi.datDATETIME_RESPOND = HelpUtils.string_2_datetime(v_call_info.datetime_response); else m_us_cuoc_goi.datDATETIME_RESPOND = CIPConvert.ToDatetime("01/01/1900", "dd/MM/yyyy"); if (v_call_info.end_time != null) m_us_cuoc_goi.datEND_TIME = HelpUtils.string_2_datetime(v_call_info.end_time); else m_us_cuoc_goi.datEND_TIME = CIPConvert.ToDatetime("01/01/1900", "dd/MM/yyyy"); if (v_call_info.start_time != null) m_us_cuoc_goi.datSTART_TIME = HelpUtils.string_2_datetime(v_call_info.start_time); else m_us_cuoc_goi.datSTART_TIME = CIPConvert.ToDatetime("01/01/1900", "dd/MM/yyyy"); m_us_cuoc_goi.dcDURATION = CIPConvert.ToDecimal(v_call_info.duration); m_us_cuoc_goi.dcID_TRANG_THAI = m_dc_id_trang_thai_cuoc_goi; m_us_cuoc_goi.dcRINGTIME = CIPConvert.ToDecimal(v_call_info.ringtime); m_us_cuoc_goi.Update(); BaseMessages.MsgBox_Infor("Đã lưu thông tin cuộc gọi thành công"); }
private void insert_gd_cuoc_goi(CallInfor v_ip_call_infor) { US_GD_CUOC_GOI_YEU_CAU v_us = new US_GD_CUOC_GOI_YEU_CAU(); v_us.strCALL_ID = v_ip_call_infor.call_id; if (v_ip_call_infor.link_down_record != null) v_us.strVOICE_CALL_LINK = v_ip_call_infor.link_down_record; if (v_ip_call_infor.start_time != null) v_us.datSTART_TIME = Convert.ToDateTime(v_ip_call_infor.start_time); if (v_ip_call_infor.end_time != null) v_us.datEND_TIME = Convert.ToDateTime(v_ip_call_infor.end_time); if (v_ip_call_infor.station_id != null) v_us.dcSTATION_ID = CIPConvert.ToDecimal(v_ip_call_infor.station_id.ToString()); if (v_ip_call_infor.duration != null) v_us.dcDURATION = CIPConvert.ToDecimal(v_ip_call_infor.duration.ToString()); if (v_ip_call_infor.status != null) v_us.strSTATUS = v_ip_call_infor.status; if (v_ip_call_infor.error_code != null) v_us.strERROR_CODE = v_ip_call_infor.error_code; if (v_ip_call_infor.error_desc != null) v_us.strERROR_DESC = v_ip_call_infor.error_desc; if (v_ip_call_infor.datetime_response != null) v_us.datDATETIME_RESPOND = Convert.ToDateTime(v_ip_call_infor.datetime_response); if (v_ip_call_infor.ringtime != null) v_us.dcRINGTIME = CIPConvert.ToDecimal(v_ip_call_infor.ringtime.ToString()); v_us.datTHOI_DIEM_GOI = System.DateTime.Now; v_us.dcID_DAT_HANG = m_us.dcID; v_us.strCUOC_GOI_VAO_YN = "Y"; v_us.Insert(); }