123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- // WorkerDlg.cpp : implementa tion file
- //
- #include "stdafx.h"
- #include "uphonebox.h"
- #include "WorkerDlg.h"
- #include "UPhoneBoxDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // WorkerDlg dialog
- WorkerDlg::WorkerDlg(CWnd* pParent /*=NULL*/)
- : CDialog(WorkerDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(WorkerDlg)
- m_phone = _T("");
- m_name = _T("");
- m_sex = _T("");
- m_bm = _T("");
- //}}AFX_DATA_INIT
- m_linepos = 0;
- }
- void WorkerDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(WorkerDlg)
- DDX_Text(pDX, IDC_EDIT1, m_phone);
- DDX_Text(pDX, IDC_EDIT2, m_name);
- DDX_Text(pDX, IDC_EDIT3, m_sex);
- DDX_Text(pDX, IDC_EDIT4, m_bm);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(WorkerDlg, CDialog)
- //{{AFX_MSG_MAP(WorkerDlg)
- ON_MESSAGE(WM_USER + 111, OnCloseWin)
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // WorkerDlg message handlers
- BOOL WorkerDlg::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
- ::SetForegroundWindow(m_hWnd);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- extern int g_nYearpos;
- extern BOOL g_bReturned2;
- extern CUPhoneBoxDlg *g_pMainWnd;
- LRESULT WorkerDlg::OnCloseWin(WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your message handler code here and/or call default
- if (wParam)
- {
- if (::PathFileExists(g_recordpath[m_linepos]))
- {
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql, sql2;
- sql.Format("insert into [employeephonerecord]([name],[datetime])values(\
- '%s','%s')", m_name, datetime);
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(91)))
- {
- CString content = g_cominfoarray.ElementAt(0).ElementAt(94);
- 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;
- // CDialog::OnCancel ();
- DestroyWindow();
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话\\" + m_name, NULL);
- CString m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话\\" + m_name + "\\" + datetime + ".mp3";
- if (::PathFileExists(g_recordpath[m_linepos]))
- {
- ::CopyFile(g_recordpath[m_linepos], 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(91)))
- {
- CString content = g_cominfoarray.ElementAt(0).ElementAt(94);
- 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;
- // CDialog::OnCancel ();
- DestroyWindow();
- return 1;
- }
- }
- ::DeleteFile(g_recordpath[m_linepos]);
- // CDialog::OnCancel ();
- DestroyWindow();
- }
- void WorkerDlg::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 WorkerDlg::OnOK()
- {
- // TODO: Add extra hevalidationre
- }
- void WorkerDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- }
|