// NotFindDlg.cpp : implementation file // #include "stdafx.h" #include "uphonebox.h" #include "NotFindDlg.h" #include "AddClient.h" #include "UPhoneBoxDlg.h" #include "YesNoDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // NotFindDlg dialog NotFindDlg::NotFindDlg(CWnd* pParent /*=NULL*/) : CDialog(NotFindDlg::IDD, pParent) { //{{AFX_DATA_INIT(NotFindDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_bClosed = 0; m_linepos = 0; m_bSave = 0; m_bSaveToClient = -1; } void NotFindDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(NotFindDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(NotFindDlg, CDialog) //{{AFX_MSG_MAP(NotFindDlg) ON_WM_LBUTTONDOWN() ON_WM_TIMER() //}}AFX_MSG_MAP ON_MESSAGE(WM_USER + 111, OnCloseWin) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // NotFindDlg message handlers BOOL NotFindDlg::OnInitDialog() { CDialog::OnInitDialog(); SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); g_hwnd[m_linepos] = this->m_hWnd; // TODO: Add extra initialization here SetDlgItemText(IDC_STATIC2, m_phone); // ::SetForegroundWindow (m_hWnd); SetTimer(1, 1000, NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } LRESULT NotFindDlg::OnCloseWin(WPARAM wParam, LPARAM lParam) { // TODO: Add your message handler code here and/or call default m_bClosed = 1; m_bSave = wParam; if (m_bSaveToClient != -1) { if (::PathFileExists(g_recordpath[m_linepos])) m_frompath = g_recordpath[m_linepos]; if (m_bSaveToClient) SaveToClient(); else SaveToUnknown(); DestroyWindow(); return 1; } if (::PathFileExists(g_recordpath[m_linepos])) m_frompath = g_recordpath[m_linepos]; CString newpath = m_frompath.Left(m_frompath.ReverseFind('\\') + 1); newpath += CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"); newpath += ".mp3"; try { CFile::Rename(m_frompath, newpath); } catch (...) { WriteLogin("改文件名时出错"); } m_frompath = newpath; return 1; } void NotFindDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y)); CDialog::OnLButtonDown(nFlags, point); } void NotFindDlg::OnOK() { // TODO: Add extra validation here } void NotFindDlg::OnCancel() { // TODO: Add extra cleanup here } void NotFindDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code h ere and/or call default KillTimer(1); //AfxMessageBox("7");return; YesNoDlg yesnodlg; if (yesnodlg.DoModal() != IDOK) { m_bSaveToClient = 0; if (m_bClosed == 0)return; SaveToUnknown(); DestroyWindow(); m_bSaveToClient = -1; return; } AddClient dlg; dlg.m_phone1 = this->m_phone; if (dlg.DoModal() == IDOK) { m_name = dlg.m_name1; m_bSaveToClient = 1; if (m_bClosed == 0)return; SaveToClient(); DestroyWindow(); m_bSaveToClient = -1; return; } m_bSaveToClient = 0; if (m_bClosed == 0)return; SaveToUnknown(); DestroyWindow(); m_bSaveToClient = -1; } extern int g_nYearpos; extern BOOL g_bReturned2; extern CUPhoneBoxDlg *g_pMainWnd; void NotFindDlg::SaveToUnknown() { if (m_bSave) { if (m_frompath.IsEmpty() == 0) { CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"); CString sql, sql2; sql.Format("insert into [unknownphonerecord]([phone],[datetime])values(\ '%s','%s')", m_phone, datetime); if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(90))) { CString content = g_cominfoarray.ElementAt(0).ElementAt(93); if (content != "" && CheckExist(m_phone) == 0) { CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"); int count = GetLengthEx(content) / 70; if (GetLengthEx(content) % 70) count++; CString scount; scount.Format("%d", count); CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\ ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')"; sql += sql2; } } g_sendhead.bsql = 1; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2(sql); int i; for ( i = 0; i < 20; i++) { if (g_bReturned2)break; ::Sleep(500); } if (i >= 20) { nNeedConn2 = 1; return; } datetime.Replace(":", ""); ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话", NULL); ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话\\" + m_phone, NULL); CString m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话\\" + m_phone + "\\" + datetime + ".mp3"; if (::PathFileExists(m_frompath)) { ::CopyFile(m_frompath, m_savepath, 0); } } } else { CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"); CString sql, sql2; sql.Format("insert into [misscallrecord]([phone],[datetime],[name],[type])values(\ '%s','%s','%s','%s')", m_phone, datetime, "", "未知电话来电"); if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(90))) { CString content = g_cominfoarray.ElementAt(0).ElementAt(93); if (content != "" && CheckExist(m_phone) == 0) { CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"); int count = GetLengthEx(content) / 70; if (GetLengthEx(content) % 70) count++; CString scount; scount.Format("%d", count); CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\ ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')"; sql += sql2; } } g_sendhead.bsql = 1; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2(sql); int i; for ( i = 0; i < 20; i++) { if (g_bReturned2)break; ::Sleep(500); } if (i >= 20) { nNeedConn2 = 1; return; } } ::DeleteFile(m_frompath); } void NotFindDlg::SaveToClient() { if (m_bSave) { if (m_frompath.IsEmpty() == 0) { CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"); CString sql, sql2; sql.Format("insert into [client2phonerecord]([phone],[datetime])values(\ '%s','%s')", m_phone, datetime); if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(89))) { CString content = g_cominfoarray.ElementAt(0).ElementAt(92); if (content != "" && CheckExist(m_phone) == 0) { CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"); int count = GetLengthEx(content) / 70; if (GetLengthEx(content) % 70) count++; CString scount; scount.Format("%d", count); CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\ ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')"; sql += sql2; } } g_sendhead.bsql = 1; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2(sql); int i; for ( i = 0; i < 20; i++) { if (g_bReturned2)break; ::Sleep(500); } if (i >= 20) { nNeedConn2 = 1; return; } datetime.Replace(":", ""); ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户", NULL); ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户\\" + m_phone, NULL); CString m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户\\" + m_phone + "\\" + datetime + ".mp3"; if (::PathFileExists(m_frompath)) { ::CopyFile(m_frompath, m_savepath, 0); } } } else { CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"); CString sql, sql2; sql.Format("insert into [misscallrecord]([phone],[datetime],[name],[type])values(\ '%s','%s','%s','%s')", m_phone, datetime, m_name, "意向客户来电"); if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(89))) { CString content = g_cominfoarray.ElementAt(0).ElementAt(92); if (content != "" && CheckExist(m_phone) == 0) { CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"); int count = GetLengthEx(content) / 70; if (GetLengthEx(content) % 70) count++; CString scount; scount.Format("%d", count); CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\ ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')"; sql += sql2; } } g_sendhead.bsql = 1; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2(sql); int i; for ( i = 0; i < 20; i++) { if (g_bReturned2)break; ::Sleep(500); } if (i >= 20) { nNeedConn2 = 1; return; } } ::DeleteFile(m_frompath); }