ShowCard2Reg.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // ShowCard2Reg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowCard2Reg.h"
  6. #include "InputCard2Dlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // ShowCard2Reg dialog
  14. ShowCard2Reg::ShowCard2Reg(CWnd* pParent /*=NULL*/)
  15. : CDialog(ShowCard2Reg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(ShowCard2Reg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. m_mode = 0;
  20. //}}AFX_DATA_INIT
  21. }
  22. void ShowCard2Reg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(ShowCard2Reg)
  26. DDX_Control(pDX, IDC_LIST1, m_List1);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(ShowCard2Reg, CDialog)
  30. //{{AFX_MSG_MAP(ShowCard2Reg)
  31. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  32. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  33. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // ShowCard2Reg message handlers
  38. BOOL ShowCard2Reg::OnInitDialog()
  39. {
  40. CDialog::OnInitDialog();
  41. // TODO: Add extra initialization here
  42. m_List1.SetHeadings("主卡号,100;副卡号,100;发放日期,100");
  43. CenterWindow();
  44. m_List1.DeleteAllItems2();
  45. int ii = 0;
  46. m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1);
  47. int count = 0;
  48. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  49. {
  50. m_List1.m_arLabels.ElementAt(count++).Copy(g_List1array.ElementAt(ii));
  51. }
  52. m_List1.m_arLabels.SetSize(count, 1);
  53. ii = count;
  54. m_List1.m_LabelCount = ii;
  55. m_List1.SetItemCountEx(ii);
  56. return TRUE; // return TRUE unless you set the focus to a control
  57. // EXCEPTION: OCX Property Pages should return FALSE
  58. }
  59. void ShowCard2Reg::OnButton1()
  60. {
  61. // TODO: Add your control notification handler code here
  62. CDialog::OnCancel();
  63. }
  64. void ShowCard2Reg::OnButton2()
  65. {
  66. // TODO: Add your control notification handler code here
  67. POSITION pos;
  68. pos = m_List1.GetFirstSelectedItemPosition();
  69. if (pos == NULL)
  70. {
  71. AfxMessageBox("请先选中您要删除的副卡记录!");
  72. return;
  73. }
  74. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  75. int iItem = m_List1.GetNextSelectedItem(pos);
  76. CString memberno = m_List1.GetItemText(iItem, 0);
  77. CString no = m_List1.GetItemText(iItem, 1);
  78. CString sql;
  79. if (m_mode)
  80. sql = "delete from membercard2blue where [memberno]='" + memberno + "' and [card2no]='" + no + "'";
  81. else
  82. sql = "delete from membercard2 where [memberno]='" + memberno + "' and [card2no]='" + no + "'";
  83. g_sendhead.bsql = 1;
  84. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  85. m_List1.DeleteItem2(iItem);
  86. }
  87. void ShowCard2Reg::OnButton3()
  88. {
  89. // TODO: Add your control notification handler code here
  90. InputCard2Dlg dlg;
  91. dlg.m_mode = 1;
  92. dlg.m_bAddOne = 1;
  93. dlg.m_name = m_name;
  94. dlg.m_no = m_memberno;
  95. if (dlg.DoModal() != IDOK)return;
  96. CString filter = "[memberno]='" + m_memberno + "'";
  97. g_sendhead.bsql = 0;
  98. g_sendhead.code[0] = 131;
  99. g_sendhead.tabcount = 1;
  100. g_pMainWnd->ProcessChatMessageRequest2(filter);
  101. if (g_bSendOK == 0)
  102. {
  103. CDialog::OnCancel();
  104. return;
  105. }
  106. DataToArray(&g_List1array);
  107. m_List1.DeleteAllItems2();
  108. int ii = 0;
  109. m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1);
  110. int count = 0;
  111. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  112. {
  113. m_List1.m_arLabels.ElementAt(count++).Copy(g_List1array.ElementAt(ii));
  114. }
  115. m_List1.m_arLabels.SetSize(count, 1);
  116. ii = count;
  117. m_List1.m_LabelCount = ii;
  118. m_List1.SetItemCountEx(ii);
  119. }