// BookingPage2.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "BookingPage2.h" #include "Booking2.h" #include "ShowHistoryClient.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // BookingPage2 dialog BookingPage2::BookingPage2(CWnd* pParent /*=NULL*/) : CDialog(BookingPage2::IDD, pParent) { //{{AFX_DATA_INIT(BookingPage2) // NOTE: the ClassWizard will add member initialization here m_addr1 = _T(""); m_addr2 = _T(""); m_name1 = _T(""); m_name2 = _T(""); m_occupation1 = _T(""); m_occupation2 = _T(""); m_phone1 = _T(""); m_phone2 = _T(""); m_qq1 = _T(""); m_qq2 = _T(""); m_birthday1 = _T(""); m_birthday2 = _T(""); m_time3 = _T(""); m_area = _T(""); m_area2 = _T(""); m_check1 = FALSE; m_check2 = FALSE; m_check3 = FALSE; m_bInit=0; m_nIntentionPos = -1; //}}AFX_DATA_INIT } void BookingPage2::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(BookingPage2) // NOTE: the ClassWizard will add DDX and DDV calls here DDX_Control(pDX, IDC_COMBOarea2, m_comboarea2); DDX_Control(pDX, IDC_COMBOarea, m_comboarea); DDX_Control(pDX, IDC_EDITtime3, m_datectrl3); DDX_Control(pDX, IDC_EDITBirthday2, m_datectrl2); DDX_Control(pDX, IDC_EDITBirthday, m_datectrl1); DDX_Text(pDX, IDC_EDITaddr, m_addr1); DDX_Text(pDX, IDC_EDITaddr2, m_addr2); DDX_Text(pDX, IDC_EDITname, m_name1); DDX_Text(pDX, IDC_EDITname2, m_name2); DDX_Text(pDX, IDC_EDITOccupation, m_occupation1); DDX_Text(pDX, IDC_EDITOccupation2, m_occupation2); DDX_Text(pDX, IDC_EDITphone, m_phone1); DDX_Text(pDX, IDC_EDITphone2, m_phone2); DDX_Text(pDX, IDC_EDITqq, m_qq1); DDX_Text(pDX, IDC_EDITqq2, m_qq2); DDX_Text(pDX, IDC_EDITBirthday, m_birthday1); DDX_Text(pDX, IDC_EDITBirthday2, m_birthday2); DDX_Text(pDX, IDC_EDITtime3, m_time3); DDX_CBString(pDX, IDC_COMBOarea, m_area); DDX_CBString(pDX, IDC_COMBOarea2, m_area2); DDX_Check(pDX, IDC_CHECK1, m_check1); DDX_Check(pDX, IDC_CHECK2, m_check2); DDX_Check(pDX, IDC_CHECK3, m_check3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(BookingPage2, CDialog) //{{AFX_MSG_MAP(BookingPage2) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_EN_CHANGE(IDC_EDITname, OnChangeEDITname) ON_EN_CHANGE(IDC_EDITname2, OnChangeEDITname2) ON_EN_CHANGE(IDC_EDITphone, OnChangeEDITphone) ON_EN_CHANGE(IDC_EDITphone2, OnChangeEDITphone2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // BookingPage2 message handlers void BookingPage2::OnCancel() { // TODO: Add extra cleanup here } void BookingPage2::OnOK() { // TODO: Add extra validation here } extern BOOL CALLBACK EnumChildProc3(HWND hwnd,LPARAM lParam); BOOL BookingPage2::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here #ifdef LYFZ_VERSION GetDlgItem(IDC_STATIC1)->SetWindowText("老总姓名:"); GetDlgItem(IDC_STATIC2)->SetWindowText("影楼名称:"); GetDlgItem(IDC_STATIC3)->SetWindowText("快递单号:"); GetDlgItem(IDC_STATIC4)->SetWindowText("短信账号:"); GetDlgItem(IDC_STATIC5)->SetWindowText("域名:"); GetDlgItem(IDC_STATIC6)->SetWindowText("座机:"); #endif CRect rc2; GetWindowRect(rc2); MoveWindow(m_rc); g_WidthScale2 = (float)m_rc.Width()/(float)rc2.Width(); // new/Old g_HeightScale2 = (float)m_rc.Height()/(float)rc2.Height(); EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc3,0); m_comboarea.GetWindowRect (rc2); ScreenToClient(rc2); rc2.bottom +=200; m_comboarea.MoveWindow (rc2); m_comboarea2.GetWindowRect (rc2); ScreenToClient(rc2); rc2.bottom +=200; m_comboarea2.MoveWindow (rc2); for(int i=0; im_bModify) { if(m_comboarea.FindString (0, m_area)==-1) m_comboarea.AddString (m_area); if(m_comboarea2.FindString (0, m_area2)==-1) m_comboarea2.AddString (m_area2); m_comboarea.SetCurSel (m_comboarea.FindString (0, m_area)); m_comboarea2.SetCurSel (m_comboarea2.FindString (0, m_area2)); } GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE); m_bInit=1; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL BookingPage2::CheckOK() { UpdateData(); if(m_name1.IsEmpty () && m_name2.IsEmpty ()) { return 0; } if(m_phone1.IsEmpty () && m_phone2.IsEmpty ()) { return 0; } if(m_name1.Find("*")!=-1 || m_name2.Find("*")!=-1 ) { AfxMessageBox("客人名字中不能有*号!", MB_ICONINFORMATION); return 0; } if(!CheckDateOK(m_birthday1))return 0; if(!CheckDateOK(m_birthday2))return 0; if(!CheckDateOK(m_time3))return 0; m_phone1.TrimLeft (); m_phone1.TrimRight (); m_phone2.TrimLeft (); m_phone2.TrimRight (); if(!m_phone1.IsEmpty ()) { if(m_phone1.Left (1)=="1") { if(CheckPhoneType(m_phone1)==-1) { AfxMessageBox("手机号码:"+m_phone1+"错误!", MB_ICONINFORMATION); return 0; } } } if(!m_phone2.IsEmpty ()) { if(m_phone2.Left (1)=="1") { if(CheckPhoneType(m_phone2)==-1) { AfxMessageBox("手机号码:"+m_phone2+"错误!", MB_ICONINFORMATION); return 0; } } } int pos=m_comboarea.GetCurSel(); if(pos!=-1) m_comboarea.GetLBText(pos, m_area); else m_area.Empty(); pos=m_comboarea2.GetCurSel(); if(pos!=-1) m_comboarea2.GetLBText(pos, m_area2); else m_area2.Empty(); return 1; } void BookingPage2::NewDan() { m_addr1 = _T(""); m_addr2 = _T(""); m_name1 = _T(""); m_name2 = _T(""); m_occupation1 = _T(""); m_occupation2 = _T(""); m_phone1 = _T(""); m_phone2 = _T(""); m_qq1 = _T(""); m_qq2 = _T(""); m_birthday1 = _T(""); m_birthday2 = _T(""); m_time3 = _T(""); m_area = _T(""); m_area2 = _T(""); m_check1 = FALSE; m_check2 = FALSE; m_check3 = FALSE; UpdateData(0); m_comboarea.SetCurSel (-1); m_comboarea2.SetCurSel (-1); } void BookingPage2::OnChangeEDITname() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. CompareClient(); // TODO: Add your control notification handler code here } void BookingPage2::OnChangeEDITname2() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. CompareClient(); // TODO: Add your control notification handler code here } void BookingPage2::OnChangeEDITphone() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. CompareClient(); // TODO: Add your control notification handler code here } void BookingPage2::OnChangeEDITphone2() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. CompareClient(); // TODO: Add your control notification handler code here } void BookingPage2::CompareClient() { if(m_bInit==0)return; UpdateData(); int cot=0; BOOL bExistsIntentionCustomer = FALSE; m_oldclientarray.RemoveAll(); for(int i=0; iShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_SHOW); } else { GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE); } } void BookingPage2::OnButton2() // 查看详情; { // TODO: Add your control notification handler code here ShowHistoryClient dlg; dlg.m_poldclientarray=&m_oldclientarray; if(dlg.DoModal()!=IDOK)return; int pos=m_oldclientarray.ElementAt(dlg.m_pos); m_name1 = g_oldclientarray.ElementAt(pos).ElementAt(1); m_name2 = g_oldclientarray.ElementAt(pos).ElementAt(2); m_phone1 = g_oldclientarray.ElementAt(pos).ElementAt(3); m_phone2 = g_oldclientarray.ElementAt(pos).ElementAt(4); m_qq1 = g_oldclientarray.ElementAt(pos).ElementAt(5); m_qq2 = g_oldclientarray.ElementAt(pos).ElementAt(6); m_addr1 = g_oldclientarray.ElementAt(pos).ElementAt(7); if ( g_oldclientarray.ElementAt(pos).ElementAt(20) == _T("老顾客") ) { m_addr2 = g_oldclientarray.ElementAt(pos).ElementAt(8); m_occupation1 = g_oldclientarray.ElementAt(pos).ElementAt(9); m_occupation2 = g_oldclientarray.ElementAt(pos).ElementAt(10); m_birthday1 = g_oldclientarray.ElementAt(pos).ElementAt(11); } else if ( g_oldclientarray.ElementAt(pos).ElementAt(20) == _T("系统意向") ) { m_nIntentionPos = pos; //m_addr2 = g_oldclientarray.ElementAt(pos).ElementAt(8);//已用于意向顾客状态; //m_occupation1 = g_oldclientarray.ElementAt(pos).ElementAt(9);//已用于意向顾客业务员; //m_occupation2 = g_oldclientarray.ElementAt(pos).ElementAt(10);//已用于意向顾客记录生成日期; //m_birthday1 = g_oldclientarray.ElementAt(pos).ElementAt(11);//已用于意向顾客备注; } m_birthday2 = g_oldclientarray.ElementAt(pos).ElementAt(12); m_area = g_oldclientarray.ElementAt(pos).ElementAt(13); m_area2 = g_oldclientarray.ElementAt(pos).ElementAt(14); m_check1 = atoi(g_oldclientarray.ElementAt(pos).ElementAt(15)); m_check2 = atoi(g_oldclientarray.ElementAt(pos).ElementAt(16)); m_check3 = atoi(g_oldclientarray.ElementAt(pos).ElementAt(17)); m_time3 = g_oldclientarray.ElementAt(pos).ElementAt(18); if(m_comboarea.FindString (0, m_area)==-1) m_comboarea.AddString (m_area); if(m_comboarea2.FindString (0, m_area2)==-1) m_comboarea2.AddString (m_area2); m_comboarea.SetCurSel (m_comboarea.FindString (0, m_area)); m_comboarea2.SetCurSel (m_comboarea2.FindString (0, m_area2)); UpdateData(0); }