123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- // AddOldClient2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "UPhoneBox.h"
- #include "AddOldClient2.h"
- #include "UPhoneBoxDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // AddOldClient2 dialog IDC_EDITdate
- AddOldClient2::AddOldClient2(CWnd* pParent /*=NULL*/)
- : CDialog(AddOldClient2::IDD, pParent)
- {
- //{{AFX_DATA_INIT(AddOldClient2)
- m_date = _T("");
- m_taoxijiage = _T("");
- m_taoxiname = _T("");
- m_bAdd = 1;
- m_check1 = FALSE;
- m_birthday1 = _T("");
- m_name1 = _T("");
- m_name2 = _T("");
- m_phone1 = _T("");
- m_qq1 = _T("");
- //}}AFX_DATA_INIT
- }
- void AddOldClient2::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(AddOldClient2)
- DDX_Control(pDX, IDC_COMBOsex, m_combosex);
- DDX_Control(pDX, IDC_COMBO1, m_combotaoxiname);
- DDX_Text(pDX, IDC_EDITdate, m_date);
- DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage);
- DDX_CBString(pDX, IDC_COMBO1, m_taoxiname);
- DDX_Check(pDX, IDC_CHECK1, m_check1);
- DDX_Text(pDX, IDC_EDITBirthday, m_birthday1);
- DDX_Text(pDX, IDC_EDITname, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITphone, m_phone1);
- DDX_Text(pDX, IDC_EDITqq, m_qq1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(AddOldClient2, CDialog)
- //{{AFX_MSG_MAP(AddOldClient2)
- //}}AFX_MSG_MAP
- ON_MESSAGE(WM_USER + 111, OnCloseWin)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // AddOldClient2 message handlers
- extern int g_nYearpos;
- extern BOOL g_bReturned2;
- extern CUPhoneBoxDlg *g_pMainWnd;
- extern void DataToArray(CArray<CStringArray, CStringArray>*List1array);
- BOOL AddOldClient2::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
- /* g_sendhead.bsql=0;
- g_sendhead.code[0]=138;
- g_sendhead.tabcount=1;
- CString filter;
- CString addareaphone="%"+m_phone;
- filter="phone like '"+addareaphone+"' or phone2 like '"+addareaphone+"'";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- for(int i=0; i<20; i++)
- {
- if(g_bReturned2)break;
- ::Sleep (500);
- }
- if(i>=20)
- {
- nNeedConn2=1; CDialog::OnCancel ();
- return 0;
- }
- DataToArray( &m_List1array);*/
- GetListData(138, &m_List1array, m_phone, 0, 0);
- m_combosex.AddString("男");
- m_combosex.AddString("女");
- m_combosex.AddString("");
- if (m_List1array.GetSize())
- {
- m_name1 = m_List1array.ElementAt(0).ElementAt(1);
- m_name2 = m_List1array.ElementAt(0).ElementAt(2);
- m_sex = m_List1array.ElementAt(0).ElementAt(3);
- m_phone1 = m_List1array.ElementAt(0).ElementAt(4);
- m_qq1 = m_List1array.ElementAt(0).ElementAt(5);
- m_birthday1 = m_List1array.ElementAt(0).ElementAt(6);
- m_taoxiname = m_List1array.ElementAt(0).ElementAt(7);
- m_taoxijiage = m_List1array.ElementAt(0).ElementAt(8);
- m_date = m_List1array.ElementAt(0).ElementAt(9);
- m_check1 = atoi(m_List1array.ElementAt(0).ElementAt(14));
- UpdateData(0);
- m_combosex.SetCurSel(m_combosex.FindString(0, m_sex));
- }
- this->CenterWindow(g_pMainWnd);
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void AddOldClient2::OnOK()
- {
- // TODO: Add extra validation here
- }
- LRESULT AddOldClient2::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 [client3phonerecord]([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;
- // CDialog::OnCancel ();
- DestroyWindow();
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户\\" + m_phone, NULL);
- CString m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户\\" + m_phone + "\\" + datetime + ".mp3";
- if (::PathFileExists(g_recordpath[m_linepos]))
- {
- ::CopyFile(g_recordpath[m_linepos], m_savepath, 0);
- ::DeleteFile(g_recordpath[m_linepos]);
- }
- }
- }
- else
- {
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql, sql2;
- CString m_name;
- m_name = m_name1 + "," + m_name2;
- m_name.TrimRight(",");
- 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;
- // CDialog::OnCancel ();
- DestroyWindow();
- return 1;
- }
- }
- // CDialog::OnCancel ();
- DestroyWindow();
- }
- void AddOldClient2::OnCancel()
- {
- // TODO: Add extra cleanup here
- }
|