ShowMemberMsg.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. // ShowMemberMsg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowMemberMsg.h"
  6. #include "MyMdi.H"
  7. #include "SendMsgDlg.h"
  8. #include "SelMsgContent3.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // ShowMemberMsg
  16. IMPLEMENT_DYNCREATE(ShowMemberMsg, MyFormView)
  17. ShowMemberMsg::ShowMemberMsg()
  18. : MyFormView(ShowMemberMsg::IDD)
  19. {
  20. //{{AFX_DATA_INIT(ShowMemberMsg)
  21. m_point1 = 0;
  22. m_point2 = 0;
  23. //}}AFX_DATA_INIT
  24. }
  25. ShowMemberMsg::~ShowMemberMsg()
  26. {
  27. }
  28. void ShowMemberMsg::DoDataExchange(CDataExchange* pDX)
  29. {
  30. MyFormView::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(ShowMemberMsg)
  32. DDX_Control(pDX, IDC_EDIT16, m_editnum2);
  33. DDX_Control(pDX, IDC_EDIT15, m_editnum1);
  34. DDX_Control(pDX, IDC_LIST2, m_List1);
  35. DDX_Control(pDX, IDC_STATIC1, m_static1);
  36. DDX_Text(pDX, IDC_EDIT15, m_point1);
  37. DDX_Text(pDX, IDC_EDIT16, m_point2);
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(ShowMemberMsg, MyFormView)
  41. //{{AFX_MSG_MAP(ShowMemberMsg)
  42. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  43. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  44. ON_BN_CLICKED(IDC_BUTTON20, OnButton20)
  45. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  46. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // ShowMemberMsg diagnostics
  51. #ifdef _DEBUG
  52. void ShowMemberMsg::AssertValid() const
  53. {
  54. MyFormView::AssertValid();
  55. }
  56. void ShowMemberMsg::Dump(CDumpContext& dc) const
  57. {
  58. MyFormView::Dump(dc);
  59. }
  60. #endif //_DEBUG
  61. /////////////////////////////////////////////////////////////////////////////
  62. // ShowMemberMsg message handlers
  63. void ShowMemberMsg::OnInitialUpdate()
  64. {
  65. MyFormView::OnInitialUpdate();
  66. // TODO: Add your specialized code here and/or call the base class
  67. CMyMdi Mdi;
  68. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  69. // Here we create the outbar control using the splitter as its parent
  70. // and setting its id to the first pane.
  71. CRect rc2;
  72. GetWindowRect(rc2);
  73. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  74. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  75. m_static1.SetFont (&g_titlefont);
  76. m_List1.SetHeadings("id,0;卡号,100;姓名,100;性别,100;电话,100;QQ,100;地址,100;职业,100;生日,100;积分,100;开卡日期,100" );
  77. m_List1.LoadColumnInfo (190);
  78. GetData();
  79. }
  80. void ShowMemberMsg::FillGrid()
  81. {
  82. m_List1.DeleteAllItems2 ();
  83. int ii=0;
  84. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  85. int count=0;
  86. if(m_point1==0 && m_point2==0)
  87. {
  88. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  89. {
  90. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  91. }
  92. }
  93. else
  94. {
  95. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  96. {
  97. if(atoi(m_List1array.ElementAt (ii).ElementAt (9))>=m_point1 && atoi(m_List1array.ElementAt (ii).ElementAt (9))<=m_point2)
  98. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  99. }
  100. }
  101. m_List1.m_arLabels.SetSize(count, 1);
  102. ii=count;
  103. m_List1.m_LabelCount=ii;
  104. m_List1.SetItemCountEx (ii);
  105. CString str;
  106. str.Format ("项目:%d 积分:", ii);
  107. SetDlgItemText(IDC_STATIC2, str);
  108. }
  109. void ShowMemberMsg::OnBUTclose()
  110. {
  111. // TODO: Add your control notification handler code here
  112. GetParent()->SendMessage(WM_CLOSE);
  113. }
  114. BOOL ShowMemberMsg::PreTranslateMessage(MSG* pMsg)
  115. {
  116. // TODO: Add your specialized code here and/or call the base class
  117. try
  118. {
  119. if(pMsg->message==WM_KEYDOWN)
  120. {
  121. switch (pMsg->wParam)
  122. {
  123. case VK_RETURN:
  124. OnButton1();
  125. return 1;
  126. case 0x43: // copy
  127. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  128. {
  129. GetFocus()->SendMessage(WM_COPY);
  130. return TRUE;
  131. }
  132. break;
  133. case 0x56: //Ctrl + V:
  134. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  135. {
  136. GetFocus()->SendMessage(WM_PASTE);
  137. return TRUE;
  138. }
  139. break;
  140. case 0x58: // cut
  141. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  142. {
  143. GetFocus()->SendMessage(WM_CUT);
  144. return TRUE;
  145. }
  146. break;
  147. case 0x5A: //undo
  148. case 0x59: //redo
  149. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  150. {
  151. GetFocus()->SendMessage(WM_UNDO);
  152. return TRUE;
  153. }
  154. break;
  155. }
  156. }
  157. return MyFormView::PreTranslateMessage(pMsg);
  158. }
  159. catch(...)
  160. {
  161. }
  162. }
  163. void ShowMemberMsg::OnButton1()
  164. {
  165. // TODO: Add your control notification handler code here
  166. UpdateData();
  167. FillGrid();
  168. }
  169. void ShowMemberMsg::GetData()
  170. {
  171. UpdateData();
  172. g_sendhead.bsql=0;
  173. g_sendhead.code[0]=68;
  174. g_sendhead.tabcount=1;
  175. g_pMainWnd->ProcessChatMessageRequest2(1);
  176. if(g_bSendOK==0)
  177. {
  178. return;
  179. }
  180. DataToArray(&m_List1array);
  181. FillGrid();
  182. }
  183. void ShowMemberMsg::OnButton20()
  184. {
  185. // TODO: Add your control notification handler code here
  186. POSITION pos;
  187. pos=m_List1.GetFirstSelectedItemPosition();
  188. if(pos==NULL)
  189. {
  190. AfxMessageBox("请先选中您要发送短信的会员!", MB_ICONINFORMATION);
  191. return;
  192. }
  193. int iItem;
  194. CStringArray array;
  195. while (pos)
  196. {
  197. iItem = m_List1.GetNextSelectedItem(pos);
  198. if(!m_List1.GetItemText (iItem, 4).IsEmpty ())
  199. array.Add (m_List1.GetItemText (iItem, 4));
  200. }
  201. SendMsgDlg dlg;
  202. dlg.m_mode=1;
  203. dlg.m_pArray=&array;
  204. dlg.DoModal ();
  205. }
  206. void ShowMemberMsg::OnButton2()
  207. {
  208. // TODO: Add your control notification handler code here
  209. for(int i=0; i<m_List1.GetItemCount (); i++)
  210. m_List1.SetItemState (i, LVIS_SELECTED, LVIS_SELECTED);
  211. }
  212. void ShowMemberMsg::OnButton3()
  213. {
  214. // TODO: Add your control notification handler code here
  215. SelMsgContent3 dlg;
  216. dlg.DoModal ();
  217. }