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