UseMemberCard.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // UseMemberCard.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "UseMemberCard.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // UseMemberCard dialog
  13. UseMemberCard::UseMemberCard(CWnd* pParent /*=NULL*/)
  14. : CDialog(UseMemberCard::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(UseMemberCard)
  17. m_money1 = _T("");
  18. m_money2 = _T("");
  19. m_point1 = _T("");
  20. m_point2 = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. void UseMemberCard::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(UseMemberCard)
  27. DDX_Control(pDX, IDC_EDIT2, m_editctrl2);
  28. DDX_Control(pDX, IDC_EDIT1, m_editctrl1);
  29. DDX_Text(pDX, IDC_EDIT1, m_money1);
  30. DDX_Text(pDX, IDC_EDIT3, m_money2);
  31. DDX_Text(pDX, IDC_EDIT2, m_point1);
  32. DDX_Text(pDX, IDC_EDIT4, m_point2);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(UseMemberCard, CDialog)
  36. //{{AFX_MSG_MAP(UseMemberCard)
  37. ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
  38. ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // UseMemberCard message handlers
  43. BOOL UseMemberCard::OnInitDialog()
  44. {
  45. CDialog::OnInitDialog();
  46. // TODO: Add extra initialization here
  47. return TRUE; // return TRUE unless you set the focus to a control
  48. // EXCEPTION: OCX Property Pages should return FALSE
  49. }
  50. void UseMemberCard::OnChangeEdit1()
  51. {
  52. // TODO: If this is a RICHEDIT control, the control will not
  53. // send this notification unless you override the CDialog::OnInitDialog()
  54. // function and call CRichEditCtrl().SetEventMask()
  55. // with the ENM_CHANGE flag ORed into the mask.
  56. UpdateData();
  57. float rate=atof(g_cominfoarray.ElementAt (0).ElementAt (38))/100.0;
  58. m_point1.Format ("%0.2f", atof(m_money1)/rate);
  59. UpdateData(false);
  60. // TODO: Add your control notification handler code here
  61. }
  62. void UseMemberCard::OnChangeEdit2()
  63. {
  64. // TODO: If this is a RICHEDIT control, the control will not
  65. // send this notification unless you override the CDialog::OnInitDialog()
  66. // function and call CRichEditCtrl().SetEventMask()
  67. // with the ENM_CHANGE flag ORed into the mask.
  68. UpdateData();
  69. float rate=atof(g_cominfoarray.ElementAt (0).ElementAt (38))/100.0;
  70. m_money1.Format ("%0.2f", atof(m_point1)*rate);
  71. UpdateData(false);
  72. // TODO: Add your control notification handler code here
  73. }
  74. void UseMemberCard::OnOK()
  75. {
  76. // TODO: Add extra validation here
  77. UpdateData();
  78. if(atof(m_money1)<=0)
  79. {
  80. AfxMessageBox("输入错误!");
  81. return;
  82. }
  83. if(atof(m_money1)>atof(m_money2))
  84. {
  85. AfxMessageBox("积分不足!");
  86. return;
  87. }
  88. CString sql;
  89. CString date=g_date;
  90. sql="insert into [memberreg2]([memberno],[dindanid],[money],[point],[date])values('"+m_memberno+"','"+m_id+"','"+m_money1+"','"+m_point1+"','"+date+"')";
  91. sql+="***refresh balance memberreg2";
  92. sql+=m_memberno;
  93. sql+=";";
  94. sql+=m_id;
  95. g_sendhead.bsql=1;
  96. g_pMainWnd->ProcessChatMessageRequest2(sql);
  97. if(g_bSendOK==0)
  98. {
  99. CDialog::OnOK();
  100. return;
  101. }
  102. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  103. CDialog::OnOK();
  104. }