123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- // ShowCard2Reg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "ShowCard2Reg.h"
- #include "InputCard2Dlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // ShowCard2Reg dialog
- ShowCard2Reg::ShowCard2Reg(CWnd* pParent /*=NULL*/)
- : CDialog(ShowCard2Reg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(ShowCard2Reg)
- // NOTE: the ClassWizard will add member initialization here
- m_mode = 0;
- //}}AFX_DATA_INIT
- }
- void ShowCard2Reg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ShowCard2Reg)
- DDX_Control(pDX, IDC_LIST1, m_List1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(ShowCard2Reg, CDialog)
- //{{AFX_MSG_MAP(ShowCard2Reg)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ShowCard2Reg message handlers
- BOOL ShowCard2Reg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- m_List1.SetHeadings("主卡号,100;副卡号,100;发放日期,100");
- CenterWindow();
- m_List1.DeleteAllItems2();
- int ii = 0;
- m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1);
- int count = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(g_List1array.ElementAt(ii));
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii = count;
- m_List1.m_LabelCount = ii;
- m_List1.SetItemCountEx(ii);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void ShowCard2Reg::OnButton1()
- {
- // TODO: Add your control notification handler code here
- CDialog::OnCancel();
- }
- void ShowCard2Reg::OnButton2()
- {
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要删除的副卡记录!");
- return;
- }
- if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString memberno = m_List1.GetItemText(iItem, 0);
- CString no = m_List1.GetItemText(iItem, 1);
- CString sql;
- if (m_mode)
- sql = "delete from membercard2blue where [memberno]='" + memberno + "' and [card2no]='" + no + "'";
- else
- sql = "delete from membercard2 where [memberno]='" + memberno + "' and [card2no]='" + no + "'";
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- m_List1.DeleteItem2(iItem);
- }
- void ShowCard2Reg::OnButton3()
- {
- // TODO: Add your control notification handler code here
- InputCard2Dlg dlg;
- dlg.m_mode = 1;
- dlg.m_bAddOne = 1;
- dlg.m_name = m_name;
- dlg.m_no = m_memberno;
- if (dlg.DoModal() != IDOK)return;
- CString filter = "[memberno]='" + m_memberno + "'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 131;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return;
- }
- DataToArray(&g_List1array);
- m_List1.DeleteAllItems2();
- int ii = 0;
- m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1);
- int count = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(g_List1array.ElementAt(ii));
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii = count;
- m_List1.m_LabelCount = ii;
- m_List1.SetItemCountEx(ii);
- }
|