Psw.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Psw.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.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_account = _T("");
  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_EDITaccount, m_account);
  28. DDX_Text(pDX, IDC_EDITpsw, m_psw);
  29. DDX_Text(pDX, IDC_EDITpsw2, m_psw2);
  30. DDX_Text(pDX, IDC_EDITpsw3, m_psw3);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(Psw, CDialog)
  34. //{{AFX_MSG_MAP(Psw)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Psw message handlers
  39. void Psw::OnOK()
  40. {
  41. // TODO: Add extra validation here
  42. UpdateData();
  43. if (m_psw != m_List1array.ElementAt(0).ElementAt(2))
  44. {
  45. AfxMessageBox("旧密码错误!", MB_ICONINFORMATION);
  46. return;
  47. }
  48. if (m_psw3 != m_psw2)
  49. {
  50. AfxMessageBox("新密码不一至!", MB_ICONINFORMATION);
  51. return;
  52. }
  53. CString sql;
  54. sql = "update [user] set [psw]='" + m_psw3 + "' where [account]='" + m_account + "'";
  55. g_sendhead.bsql = 1;
  56. g_pMainWnd->ProcessChatMessageRequest2(sql);
  57. if (g_bSendOK == 0)return;
  58. CDialog::OnOK();
  59. }
  60. BOOL Psw::OnInitDialog()
  61. {
  62. CDialog::OnInitDialog();
  63. // TODO: Add extra initialization here
  64. g_sendhead.bsql = 0;
  65. g_sendhead.code[0] = 23;
  66. g_sendhead.tabcount = 1;
  67. CString sql;
  68. sql = "name='" + g_user.name + "'";
  69. g_pMainWnd->ProcessChatMessageRequest2(sql);
  70. if (g_bSendOK == 0)return 1;
  71. DataToArray(&m_List1array);
  72. if (m_List1array.GetSize() == 0)
  73. {
  74. CDialog::OnCancel();
  75. return true;
  76. }
  77. m_account = m_List1array.ElementAt(0).ElementAt(0);
  78. UpdateData(false);
  79. this->CenterWindow(g_pMainWnd);
  80. return TRUE; // return TRUE unless you set the focus to a control
  81. // EXCEPTION: OCX Property Pages should return FALSE
  82. }