ShowMemberMsg.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. return true;
  163. }
  164. void ShowMemberMsg::OnButton1()
  165. {
  166. // TODO: Add your control notification handler code here
  167. UpdateData();
  168. FillGrid();
  169. }
  170. void ShowMemberMsg::GetData()
  171. {
  172. UpdateData();
  173. g_sendhead.bsql=0;
  174. g_sendhead.code[0]=68;
  175. g_sendhead.tabcount=1;
  176. g_pMainWnd->ProcessChatMessageRequest2(1);
  177. if(g_bSendOK==0)
  178. {
  179. return;
  180. }
  181. DataToArray(&m_List1array);
  182. FillGrid();
  183. }
  184. void ShowMemberMsg::OnButton20()
  185. {
  186. // TODO: Add your control notification handler code here
  187. POSITION pos;
  188. pos=m_List1.GetFirstSelectedItemPosition();
  189. if(pos==NULL)
  190. {
  191. AfxMessageBox("请先选中您要发送短信的会员!", MB_ICONINFORMATION);
  192. return;
  193. }
  194. int iItem;
  195. CStringArray array;
  196. while (pos)
  197. {
  198. iItem = m_List1.GetNextSelectedItem(pos);
  199. if(!m_List1.GetItemText (iItem, 4).IsEmpty ())
  200. array.Add (m_List1.GetItemText (iItem, 4));
  201. }
  202. SendMsgDlg dlg;
  203. dlg.m_mode=1;
  204. dlg.m_pArray=&array;
  205. dlg.DoModal ();
  206. }
  207. void ShowMemberMsg::OnButton2()
  208. {
  209. // TODO: Add your control notification handler code here
  210. for(int i=0; i<m_List1.GetItemCount (); i++)
  211. m_List1.SetItemState (i, LVIS_SELECTED, LVIS_SELECTED);
  212. }
  213. void ShowMemberMsg::OnButton3()
  214. {
  215. // TODO: Add your control notification handler code here
  216. SelMsgContent3 dlg;
  217. dlg.DoModal ();
  218. }