WorkerDlg.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // WorkerDlg.cpp : implementa tion file
  2. //
  3. #include "stdafx.h"
  4. #include "uphonebox.h"
  5. #include "WorkerDlg.h"
  6. #include "UPhoneBoxDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // WorkerDlg dialog
  14. WorkerDlg::WorkerDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(WorkerDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(WorkerDlg)
  18. m_phone = _T("");
  19. m_name = _T("");
  20. m_sex = _T("");
  21. m_bm = _T("");
  22. //}}AFX_DATA_INIT
  23. m_linepos = 0;
  24. }
  25. void WorkerDlg::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(WorkerDlg)
  29. DDX_Text(pDX, IDC_EDIT1, m_phone);
  30. DDX_Text(pDX, IDC_EDIT2, m_name);
  31. DDX_Text(pDX, IDC_EDIT3, m_sex);
  32. DDX_Text(pDX, IDC_EDIT4, m_bm);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(WorkerDlg, CDialog)
  36. //{{AFX_MSG_MAP(WorkerDlg)
  37. ON_MESSAGE(WM_USER + 111, OnCloseWin)
  38. ON_WM_LBUTTONDOWN()
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // WorkerDlg message handlers
  43. BOOL WorkerDlg::OnInitDialog()
  44. {
  45. CDialog::OnInitDialog();
  46. SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
  47. g_hwnd[m_linepos] = this->m_hWnd;
  48. // TODO: Add extra initialization here
  49. ::SetForegroundWindow(m_hWnd);
  50. return TRUE; // return TRUE unless you set the focus to a control
  51. // EXCEPTION: OCX Property Pages should return FALSE
  52. }
  53. extern int g_nYearpos;
  54. extern BOOL g_bReturned2;
  55. extern CUPhoneBoxDlg *g_pMainWnd;
  56. LRESULT WorkerDlg::OnCloseWin(WPARAM wParam, LPARAM lParam)
  57. {
  58. // TODO: Add your message handler code here and/or call default
  59. if (wParam)
  60. {
  61. if (::PathFileExists(g_recordpath[m_linepos]))
  62. {
  63. CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
  64. CString sql, sql2;
  65. sql.Format("insert into [employeephonerecord]([name],[datetime])values(\
  66. '%s','%s')", m_name, datetime);
  67. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(91)))
  68. {
  69. CString content = g_cominfoarray.ElementAt(0).ElementAt(94);
  70. if (content != "" && CheckExist(m_phone) == 0)
  71. {
  72. CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  73. int count = GetLengthEx(content) / 70;
  74. if (GetLengthEx(content) % 70)
  75. count++;
  76. CString scount;
  77. scount.Format("%d", count);
  78. CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\
  79. ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  80. sql += sql2;
  81. }
  82. }
  83. g_sendhead.bsql = 1;
  84. g_nYearpos = -1;
  85. g_pMainWnd->ProcessChatMessageRequest2(sql);
  86. int i;
  87. for ( i = 0; i < 20; i++)
  88. {
  89. if (g_bReturned2)break;
  90. ::Sleep(500);
  91. }
  92. if (i >= 20)
  93. {
  94. nNeedConn2 = 1;
  95. // CDialog::OnCancel ();
  96. DestroyWindow();
  97. return 1;
  98. }
  99. datetime.Replace(":", "");
  100. ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话", NULL);
  101. ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话\\" + m_name, NULL);
  102. CString m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话\\" + m_name + "\\" + datetime + ".mp3";
  103. if (::PathFileExists(g_recordpath[m_linepos]))
  104. {
  105. ::CopyFile(g_recordpath[m_linepos], m_savepath, 0);
  106. }
  107. }
  108. }
  109. else
  110. {
  111. CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
  112. CString sql, sql2;
  113. sql.Format("insert into [misscallrecord]([phone],[datetime],[name],[type])values(\
  114. '%s','%s','%s','%s')", m_phone, datetime, m_name, "员工来电");
  115. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(88)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(91)))
  116. {
  117. CString content = g_cominfoarray.ElementAt(0).ElementAt(94);
  118. if (content != "" && CheckExist(m_phone) == 0)
  119. {
  120. CString timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  121. int count = GetLengthEx(content) / 70;
  122. if (GetLengthEx(content) % 70)
  123. count++;
  124. CString scount;
  125. scount.Format("%d", count);
  126. CString sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values\
  127. ('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  128. sql += sql2;
  129. }
  130. }
  131. g_sendhead.bsql = 1;
  132. g_nYearpos = -1;
  133. g_pMainWnd->ProcessChatMessageRequest2(sql);
  134. int i;
  135. for ( i = 0; i < 20; i++)
  136. {
  137. if (g_bReturned2)break;
  138. ::Sleep(500);
  139. }
  140. if (i >= 20)
  141. {
  142. nNeedConn2 = 1;
  143. // CDialog::OnCancel ();
  144. DestroyWindow();
  145. return 1;
  146. }
  147. }
  148. ::DeleteFile(g_recordpath[m_linepos]);
  149. // CDialog::OnCancel ();
  150. DestroyWindow();
  151. }
  152. void WorkerDlg::OnLButtonDown(UINT nFlags, CPoint point)
  153. {
  154. // TODO: Add your message handler code here and/or call default
  155. SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
  156. CDialog::OnLButtonDown(nFlags, point);
  157. }
  158. void WorkerDlg::OnOK()
  159. {
  160. // TODO: Add extra hevalidationre
  161. }
  162. void WorkerDlg::OnCancel()
  163. {
  164. // TODO: Add extra cleanup here
  165. }