Psw.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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);if(g_bSendOK==0)return;
  57. CDialog::OnOK();
  58. }
  59. BOOL Psw::OnInitDialog()
  60. {
  61. CDialog::OnInitDialog();
  62. // TODO: Add extra initialization here
  63. g_sendhead.bsql=0;
  64. g_sendhead.code[0]=23;
  65. g_sendhead.tabcount=1;
  66. CString sql;
  67. sql="name='"+g_user.name+"'";
  68. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return 1;
  69. DataToArray(&m_List1array);
  70. if(m_List1array.GetSize ()==0)
  71. {
  72. CDialog::OnCancel ();
  73. return true;
  74. }
  75. m_account=m_List1array.ElementAt (0).ElementAt (0);
  76. UpdateData(false);
  77. this->CenterWindow (g_pMainWnd);
  78. return TRUE; // return TRUE unless you set the focus to a control
  79. // EXCEPTION: OCX Property Pages should return FALSE
  80. }