// SetPathDlg.cpp : implementation file // #include "stdafx.h" #include "LYFZIPManage.h" #include "SetPathDlg.h" #include "mysqldata.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // SetPathDlg dialog IDC_psw SetPathDlg::SetPathDlg(CWnd* pParent /*=NULL*/) : CDialog(SetPathDlg::IDD, pParent) { //{{AFX_DATA_INIT(SetPathDlg) m_account = _T(""); m_addr = _T(""); m_name = _T(""); m_phone = _T(""); m_psw = _T(""); m_qq = _T(""); m_remark = _T(""); m_mode=0; //}}AFX_DATA_INIT } void SetPathDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(SetPathDlg) DDX_Text(pDX, IDC_account, m_account); DDX_Text(pDX, IDC_addr, m_addr); DDX_Text(pDX, IDC_name, m_name); DDX_Text(pDX, IDC_phone, m_phone); DDX_Text(pDX, IDC_psw, m_psw); DDX_Text(pDX, IDC_qq, m_qq); DDX_Text(pDX, IDC_remark, m_remark); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(SetPathDlg, CDialog) //{{AFX_MSG_MAP(SetPathDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SetPathDlg message handlers BOOL SetPathDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here if(m_mode==1) { SetWindowText("客户资料修改"); // GetDlgItem(IDC_psw)->EnableWindow(0); //MyLock lock("msgaccessdb"); CRstClientInfo rsSt; rsSt.m_strFilter ="account='"+m_account+"'"; rsSt.Open(); if(!rsSt.IsEOF()) { m_name=rsSt.m_name ; m_phone=rsSt.m_phone ; m_qq=rsSt.m_qq ; m_addr=rsSt.m_addr ; m_remark=rsSt.m_remark ; m_psw=rsSt.m_psw; } rsSt.Close(); } else { CString account; while( IsAccountExist(account) || account.IsEmpty () ) { while(account.GetLength ()<6) { CString temp; temp.Format ("%d", ::GetTickCount ()); account+=temp; } account=account.Right (6); } m_account=account; } UpdateData(false); CenterWindow(g_pMainWnd); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void SetPathDlg::OnOK() { // TODO: Add extra validation here } BOOL SetPathDlg::IsAccountExist(CString account) { CRecordset myset(&g_db); CString sql="select count(*) as cot from clientinfo where [account]='"+account+"'"; myset.Open (CRecordset::forwardOnly, sql); myset.GetFieldValue ("cot", sql); myset.Close(); if(atoi(sql))return 1; return 0; }