SetPathDlg.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // SetPathDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "SetPathDlg.h"
  6. #include "mysqldata.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // SetPathDlg dialog IDC_psw
  14. SetPathDlg::SetPathDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(SetPathDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(SetPathDlg)
  18. m_account = _T("");
  19. m_addr = _T("");
  20. m_name = _T("");
  21. m_phone = _T("");
  22. m_psw = _T("");
  23. m_qq = _T("");
  24. m_remark = _T("");
  25. m_mode=0;
  26. //}}AFX_DATA_INIT
  27. }
  28. void SetPathDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CDialog::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(SetPathDlg)
  32. DDX_Text(pDX, IDC_account, m_account);
  33. DDX_Text(pDX, IDC_addr, m_addr);
  34. DDX_Text(pDX, IDC_name, m_name);
  35. DDX_Text(pDX, IDC_phone, m_phone);
  36. DDX_Text(pDX, IDC_psw, m_psw);
  37. DDX_Text(pDX, IDC_qq, m_qq);
  38. DDX_Text(pDX, IDC_remark, m_remark);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(SetPathDlg, CDialog)
  42. //{{AFX_MSG_MAP(SetPathDlg)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // SetPathDlg message handlers
  47. BOOL SetPathDlg::OnInitDialog()
  48. {
  49. CDialog::OnInitDialog();
  50. // TODO: Add extra initialization here
  51. if(m_mode==1)
  52. {
  53. SetWindowText("¿Í»§×ÊÁÏÐÞ¸Ä");
  54. // GetDlgItem(IDC_psw)->EnableWindow(0);
  55. //MyLock lock("msgaccessdb");
  56. CRstClientInfo rsSt;
  57. rsSt.m_strFilter ="account='"+m_account+"'";
  58. rsSt.Open();
  59. if(!rsSt.IsEOF())
  60. {
  61. m_name=rsSt.m_name ;
  62. m_phone=rsSt.m_phone ;
  63. m_qq=rsSt.m_qq ;
  64. m_addr=rsSt.m_addr ;
  65. m_remark=rsSt.m_remark ;
  66. m_psw=rsSt.m_psw;
  67. }
  68. rsSt.Close();
  69. }
  70. else
  71. {
  72. CString account;
  73. while( IsAccountExist(account) || account.IsEmpty () )
  74. {
  75. while(account.GetLength ()<6)
  76. {
  77. CString temp;
  78. temp.Format ("%d", ::GetTickCount ());
  79. account+=temp;
  80. }
  81. account=account.Right (6);
  82. }
  83. m_account=account;
  84. }
  85. UpdateData(false);
  86. CenterWindow(g_pMainWnd);
  87. return TRUE; // return TRUE unless you set the focus to a control
  88. // EXCEPTION: OCX Property Pages should return FALSE
  89. }
  90. void SetPathDlg::OnOK()
  91. {
  92. // TODO: Add extra validation here
  93. }
  94. BOOL SetPathDlg::IsAccountExist(CString account)
  95. {
  96. CRecordset myset(&g_db);
  97. CString sql="select count(*) as cot from clientinfo where [account]='"+account+"'";
  98. myset.Open (CRecordset::forwardOnly, sql);
  99. myset.GetFieldValue ("cot", sql);
  100. myset.Close();
  101. if(atoi(sql))return 1;
  102. return 0;
  103. }