MsgReg2.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. // MsgReg2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "MsgReg2.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "NeroDlg.h"
  11. #include "ClientRequirement.h"
  12. #include "./helper/ffsco.h"
  13. #include "ClientRequirement.h"
  14. #include "MsgCode.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. #pragma comment(lib, "Shlwapi.lib")
  21. /////////////////////////////////////////////////////////////////////////////
  22. // MsgReg2
  23. IMPLEMENT_DYNCREATE(MsgReg2, MyFormView)
  24. MsgReg2::MsgReg2()
  25. : MyFormView(MsgReg2::IDD)
  26. {
  27. //{{AFX_DATA_INIT(MsgReg2)
  28. //}}AFX_DATA_INIT
  29. g_nYearposTemp = g_nYearpos;
  30. }
  31. MsgReg2::~MsgReg2()
  32. {
  33. g_nYearpos = g_nYearposTemp;
  34. }
  35. void MsgReg2::DoDataExchange(CDataExchange* pDX)
  36. {
  37. MyFormView::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(MsgReg2)
  39. DDX_Control(pDX, IDC_LIST6, m_List3);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(MsgReg2, MyFormView)
  44. //{{AFX_MSG_MAP(MsgReg2)
  45. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  46. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  47. ON_BN_CLICKED(IDC_BUTshowphoto, OnDelMsg)
  48. ON_NOTIFY(NM_DBLCLK, IDC_LIST6, OnDblclkList6)
  49. ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // MsgReg2 diagnostics
  54. #ifdef _DEBUG
  55. void MsgReg2::AssertValid() const
  56. {
  57. MyFormView::AssertValid();
  58. }
  59. void MsgReg2::Dump(CDumpContext& dc) const
  60. {
  61. MyFormView::Dump(dc);
  62. }
  63. #endif //_DEBUG
  64. /////////////////////////////////////////////////////////////////////////////
  65. // MsgReg2 message handlers
  66. void MsgReg2::OnInitialUpdate()
  67. {
  68. MyFormView::OnInitialUpdate();
  69. if (IsHasRights2new(49))
  70. {
  71. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(1);
  72. }
  73. else
  74. {
  75. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(0);
  76. GetDlgItem(IDC_BUTburncd)->EnableWindow(0);
  77. }
  78. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(49)))
  79. // GetDlgItem(IDC_RADIO9)->ShowWindow (SW_SHOW);
  80. // TODO: Add your specialized code here and/or call the base class
  81. CMyMdi Mdi;
  82. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  83. // Here we create the outbar control using the splitter as its parent
  84. // and setting its id to the first pane.
  85. CRect rc2;
  86. GetWindowRect(rc2);
  87. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  88. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  89. m_static1.SetFont(&g_titlefont);
  90. m_List3.SetHeadings("客人,100;电话,100;内容,200;时间,150;解释,200");
  91. m_List3.LoadColumnInfo(251);
  92. OnButton1();
  93. }
  94. void MsgReg2::FillGrid()
  95. {
  96. UpdateData();
  97. m_List3.DeleteAllItems2();
  98. int ii = 0;
  99. m_List3.m_arLabels.SetSize(m_List3array.GetSize(), 1);
  100. int count = 0;
  101. for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++)
  102. {
  103. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  104. }
  105. m_List3.m_arLabels.SetSize(count, 1);
  106. ii = count;
  107. m_List3.m_LabelCount = ii;
  108. m_List3.SetItemCountEx(ii);
  109. }
  110. void MsgReg2::OnBUTclose()
  111. {
  112. // TODO: Add your control notification handler code here
  113. GetParent()->SendMessage(WM_CLOSE);
  114. }
  115. BOOL MsgReg2::PreTranslateMessage(MSG* pMsg)
  116. {
  117. // TODO: Add your specialized code here and/or call the base class
  118. try
  119. {
  120. if (pMsg->message == WM_KEYDOWN)
  121. {
  122. switch (pMsg->wParam)
  123. {
  124. case 0x43: // copy
  125. if ((GetKeyState(VK_CONTROL) & 0x80))
  126. {
  127. GetFocus()->SendMessage(WM_COPY);
  128. return TRUE;
  129. }
  130. break;
  131. case 0x56: //Ctrl + V:
  132. if ((GetKeyState(VK_CONTROL) & 0x80))
  133. {
  134. GetFocus()->SendMessage(WM_PASTE);
  135. return TRUE;
  136. }
  137. break;
  138. case 0x58: // cut
  139. if ((GetKeyState(VK_CONTROL) & 0x80))
  140. {
  141. GetFocus()->SendMessage(WM_CUT);
  142. return TRUE;
  143. }
  144. break;
  145. case 0x5A: //undo
  146. case 0x59: //redo
  147. if ((GetKeyState(VK_CONTROL) & 0x80))
  148. {
  149. GetFocus()->SendMessage(WM_UNDO);
  150. return TRUE;
  151. }
  152. break;
  153. }
  154. }
  155. return MyFormView::PreTranslateMessage(pMsg);
  156. }
  157. catch (...)
  158. {
  159. }
  160. }
  161. void MsgReg2::OnButton1()
  162. {
  163. // TODO: Add your control notification handler code here
  164. g_sendhead.bsql = 0;
  165. g_sendhead.code[0] = 214;
  166. g_sendhead.tabcount = 1;
  167. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  168. DataToArray(&m_List3array);
  169. FillGrid();
  170. }
  171. void MsgReg2::OnDelMsg()
  172. {
  173. // TODO: Add your control notification handler code here
  174. if (IsHasRights2new(49) == 0)return;
  175. UpdateData();
  176. {
  177. POSITION pos;
  178. pos = m_List3.GetFirstSelectedItemPosition();
  179. if (pos == NULL)
  180. {
  181. AfxMessageBox("请先选中您要删除的短信!");
  182. return;
  183. }
  184. if (AfxMessageBox("提醒, 删除后将无法恢复, 是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  185. int iItem = m_List3.GetNextSelectedItem(pos);
  186. CString time = m_List3.GetItemText(iItem, 3);
  187. CString content = m_List3.GetItemText(iItem, 2);
  188. CString sql = "delete from sendregreceive where [timestamp]='" + time + "' and [content]='" + content + "'";
  189. g_sendhead.bsql = 1;
  190. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  191. OnButton1();
  192. }
  193. }
  194. void MsgReg2::OnDblclkList6(NMHDR* pNMHDR, LRESULT* pResult)
  195. {
  196. // TODO: Add your control notification handler code here
  197. POSITION pos;
  198. pos = m_List3.GetFirstSelectedItemPosition();
  199. if (pos == NULL)
  200. {
  201. return;
  202. }
  203. int iItem = m_List3.GetNextSelectedItem(pos);
  204. CString time = m_List3.GetItemText(iItem, 3);
  205. CString content = m_List3.GetItemText(iItem, 2);
  206. CString filter = "[timestamp]='" + time + "' and [content]='" + content + "'";
  207. g_sendhead.bsql = 0;
  208. g_sendhead.code[0] = 119;
  209. g_sendhead.tabcount = 1;
  210. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  211. DataToArray(&g_List1array);
  212. if (g_List1array.GetSize())
  213. {
  214. CClientRequirement dlg;
  215. dlg.m_bSave = 0;
  216. dlg.m_nMode = 1;
  217. dlg.m_bz2 = g_List1array.ElementAt(0).ElementAt(2);
  218. dlg.DoModal();
  219. }
  220. *pResult = 0;
  221. }
  222. void MsgReg2::OnBUTburncd()
  223. {
  224. // TODO: Add your control notification handler code here
  225. MsgCode dlg;
  226. dlg.DoModal();
  227. }