Psw.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Psw.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "Psw.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // Psw dialog
  13. Psw::Psw(CWnd* pParent /*=NULL*/)
  14. : CDialog(Psw::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(Psw)
  17. m_oldpsw = _T("fdaseer");
  18. m_psw = _T("");
  19. m_psw2 = _T("");
  20. m_psw3 = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. void Psw::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(Psw)
  27. DDX_Text(pDX, IDC_EDITpsw, m_psw);
  28. DDX_Text(pDX, IDC_EDITpsw2, m_psw2);
  29. DDX_Text(pDX, IDC_EDITpsw3, m_psw3);
  30. //}}AFX_DATA_MAP
  31. }
  32. BEGIN_MESSAGE_MAP(Psw, CDialog)
  33. //{{AFX_MSG_MAP(Psw)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Psw message handlers
  38. void Psw::OnOK()
  39. {
  40. // TODO: Add extra validation here
  41. UpdateData();
  42. if(m_psw!=m_oldpsw)
  43. {
  44. AfxMessageBox("旧密码错误!", MB_ICONINFORMATION);
  45. return;
  46. }
  47. if(m_psw3!=m_psw2)
  48. {
  49. AfxMessageBox("新密码不一至!", MB_ICONINFORMATION);
  50. return;
  51. }
  52. CString sql;
  53. sql="update psw set psw='"+m_psw3+"'";
  54. MyExecuteSQL(&g_db, sql);
  55. AfxMessageBox("修改成功!", MB_ICONINFORMATION);
  56. CDialog::OnOK();
  57. }
  58. BOOL Psw::OnInitDialog()
  59. {
  60. CDialog::OnInitDialog();
  61. // TODO: Add extra initialization here
  62. CRecordset myset(&g_db);
  63. CString sql="select psw from psw";
  64. myset.Open (CRecordset::forwardOnly, sql);
  65. myset.GetFieldValue ("psw", m_oldpsw);
  66. myset.Close();
  67. this->CenterWindow (g_pMainWnd);
  68. return TRUE; // return TRUE unless you set the focus to a control
  69. // EXCEPTION: OCX Property Pages should return FALSE
  70. }