123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- // UseMemberCard.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "UseMemberCard.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // UseMemberCard dialog
- UseMemberCard::UseMemberCard(CWnd* pParent /*=NULL*/)
- : CDialog(UseMemberCard::IDD, pParent)
- {
- //{{AFX_DATA_INIT(UseMemberCard)
- m_money1 = _T("");
- m_money2 = _T("");
- m_point1 = _T("");
- m_point2 = _T("");
- //}}AFX_DATA_INIT
- }
- void UseMemberCard::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(UseMemberCard)
- DDX_Control(pDX, IDC_EDIT2, m_editctrl2);
- DDX_Control(pDX, IDC_EDIT1, m_editctrl1);
- DDX_Text(pDX, IDC_EDIT1, m_money1);
- DDX_Text(pDX, IDC_EDIT3, m_money2);
- DDX_Text(pDX, IDC_EDIT2, m_point1);
- DDX_Text(pDX, IDC_EDIT4, m_point2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(UseMemberCard, CDialog)
- //{{AFX_MSG_MAP(UseMemberCard)
- ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
- ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // UseMemberCard message handlers
- BOOL UseMemberCard::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void UseMemberCard::OnChangeEdit1()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CDialog::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- UpdateData();
- float rate=atof(g_cominfoarray.ElementAt (0).ElementAt (38))/100.0;
- m_point1.Format ("%0.2f", atof(m_money1)/rate);
- UpdateData(false);
- // TODO: Add your control notification handler code here
-
- }
- void UseMemberCard::OnChangeEdit2()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CDialog::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- UpdateData();
- float rate=atof(g_cominfoarray.ElementAt (0).ElementAt (38))/100.0;
- m_money1.Format ("%0.2f", atof(m_point1)*rate);
- UpdateData(false);
- // TODO: Add your control notification handler code here
-
- }
- void UseMemberCard::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- if(atof(m_money1)<=0)
- {
- AfxMessageBox("输入错误!");
- return;
- }
- if(atof(m_money1)>atof(m_money2))
- {
- AfxMessageBox("积分不足!");
- return;
- }
- CString sql;
-
- CString date=g_date;
- sql="insert into [memberreg2]([memberno],[dindanid],[money],[point],[date])values('"+m_memberno+"','"+m_id+"','"+m_money1+"','"+m_point1+"','"+date+"')";
- sql+="***refresh balance memberreg2";
- sql+=m_memberno;
- sql+=";";
- sql+=m_id;
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if(g_bSendOK==0)
- {
- CDialog::OnOK();
- return;
- }
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- CDialog::OnOK();
- }
|