123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- // MyAccount.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "MyAccount.h"
- #include "mysqldata.h"
- #include "InputPsw.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // MyAccount IDC_STATIC2
- IMPLEMENT_DYNCREATE(MyAccount, CFormView)
- MyAccount::MyAccount()
- : CFormView(MyAccount::IDD)
- {
- //{{AFX_DATA_INIT(MyAccount)
- //}}AFX_DATA_INIT
- }
- MyAccount::~MyAccount()
- {
- }
- void MyAccount::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(MyAccount)
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(MyAccount, CFormView)
- //{{AFX_MSG_MAP(MyAccount)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // MyAccount diagnostics
- #ifdef _DEBUG
- void MyAccount::AssertValid() const
- {
- CFormView::AssertValid();
- }
- void MyAccount::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // MyAccount message handlers
- void MyAccount::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
-
- // Here we create the outbar control using the splitter as its parent
- // and setting its id to the first pane.
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
- EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
- OnButton2();
- }
- BOOL MyAccount::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- try
- {
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case 0x43: // copy
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- return CFormView::PreTranslateMessage(pMsg);
- }
- catch(...)
- {
- }
- }
- int g_iLeft=0;
- int g_iUsed=0;
- int g_nQuery=-1;
- void MyAccount::OnButton2()
- {
- // TODO: Add your control notification handler code here
- GetDlgItem(IDC_STATIC4)->ShowWindow(SW_SHOW);
- g_nQuery=1;
- SetTimer(1, 1000, NULL);
- }
- void MyAccount::QueryOK()
- {
- GetDlgItem(IDC_STATIC4)->ShowWindow(SW_HIDE);
- CString mystr;
- if (g_iLeft >= 0)
- {
- CRecordset myset(&g_db);
- CString count1="0";
- CString sql="select sum([balance]) as cot from clientinfo";
- myset.Open (CRecordset::forwardOnly, sql);
- if(!myset.IsEOF())
- {
- myset.GetFieldValue ("cot", count1);
- if(atoi(count1)>g_iLeft)
- AfxMessageBox("我方账户可发信息数小于客户申请的信息数, 请尽快向经销商冲值!", MB_ICONSTOP);
- }
- myset.Close();
-
- mystr.Format("查询余额成功,剩余:%d 我方客户申请数:%s",g_iLeft,count1);
- }
- else
- mystr.Format("查询余额失败,返回:%d",g_iLeft);
- GetDlgItem(IDC_STATIC2)->SetWindowText(mystr);
- if (g_iUsed > 0)
- mystr.Format("查询使用成功,已用:%d",g_iUsed);
- else
- mystr.Format("查询使用失败,返回:%d",g_iUsed);
- GetDlgItem(IDC_STATIC3)->SetWindowText(mystr);
- }
- void MyAccount::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- if(nIDEvent==1)
- {
- if(g_nQuery==0)
- {
- KillTimer(1);
- QueryOK();
- }
- }
- }
|