PhoneMsgSet.cpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. // PhoneMsgSet.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "PhoneMsgSet.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // PhoneMsgSet dialog
  13. PhoneMsgSet::PhoneMsgSet(CWnd* pParent /*=NULL*/)
  14. : CDialog(PhoneMsgSet::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(PhoneMsgSet)
  17. m_msgcheck8 = FALSE;
  18. m_msgcheck9 = FALSE;
  19. m_msgcheck10 = FALSE;
  20. m_msgcontent8 = _T("");
  21. m_msgcontent9 = _T("");
  22. m_msgcontent10 = _T("");
  23. //}}AFX_DATA_INIT
  24. }
  25. void PhoneMsgSet::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(PhoneMsgSet)
  29. DDX_Check(pDX, IDC_CHECK8, m_msgcheck8);
  30. DDX_Check(pDX, IDC_CHECK9, m_msgcheck9);
  31. DDX_Check(pDX, IDC_CHECK10, m_msgcheck10);
  32. DDX_Text(pDX, IDC_EDITcontent8, m_msgcontent8);
  33. DDV_MaxChars(pDX, m_msgcontent8, 1000);
  34. DDX_Text(pDX, IDC_EDITcontent9, m_msgcontent9);
  35. DDV_MaxChars(pDX, m_msgcontent9, 1000);
  36. DDX_Text(pDX, IDC_EDITcontent10, m_msgcontent10);
  37. DDV_MaxChars(pDX, m_msgcontent10, 1000);
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(PhoneMsgSet, CDialog)
  41. //{{AFX_MSG_MAP(PhoneMsgSet)
  42. ON_EN_CHANGE(IDC_EDITcontent8, OnChangeEDITcontent8)
  43. ON_EN_CHANGE(IDC_EDITcontent9, OnChangeEDITcontent9)
  44. ON_EN_CHANGE(IDC_EDITcontent10, OnChangeEDITcontent10)
  45. //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. // PhoneMsgSet message handlers
  49. BOOL PhoneMsgSet::OnInitDialog()
  50. {
  51. CDialog::OnInitDialog();
  52. // TODO: Add extra initialization here
  53. g_sendhead.bsql=0;
  54. g_sendhead.code[0]=24;
  55. g_sendhead.tabcount=1;
  56. int g_nYearposTemp=g_nYearpos;
  57. g_nYearpos=-1;
  58. g_pMainWnd->ProcessChatMessageRequest2(1);
  59. g_nYearpos=g_nYearposTemp;
  60. if(g_bSendOK==0)
  61. {
  62. CDialog::OnCancel ();
  63. return 1;
  64. }
  65. DataToArray(&g_cominfoarray);
  66. m_msgcheck8 = atoi(g_cominfoarray.ElementAt(0).ElementAt(89));
  67. m_msgcheck9 = atoi(g_cominfoarray.ElementAt(0).ElementAt(90));
  68. m_msgcheck10 = atoi(g_cominfoarray.ElementAt(0).ElementAt(91));
  69. m_msgcontent8 = g_cominfoarray.ElementAt(0).ElementAt(92);
  70. m_msgcontent9 = g_cominfoarray.ElementAt(0).ElementAt(93);
  71. m_msgcontent10 = g_cominfoarray.ElementAt(0).ElementAt(94);
  72. UpdateData(false);
  73. CenterWindow();
  74. return TRUE; // return TRUE unless you set the focus to a control
  75. // EXCEPTION: OCX Property Pages should return FALSE
  76. }
  77. void PhoneMsgSet::OnOK()
  78. {
  79. // TODO: Add extra validation here
  80. UpdateData();
  81. m_msgcontent8.TrimLeft ();
  82. m_msgcontent8.TrimRight ();
  83. m_msgcontent9.TrimLeft ();
  84. m_msgcontent9.TrimRight ();
  85. m_msgcontent10.TrimLeft ();
  86. m_msgcontent10.TrimRight ();
  87. if(CheckBadWords(m_msgcontent8)==0 || CheckBadWords2(m_msgcontent8)==0)
  88. {
  89. AfxMessageBox("信息服务商禁止的非法字符:("+g_temp+")希望您谅解!");
  90. return;
  91. }
  92. if(CheckBadWords(m_msgcontent9)==0 || CheckBadWords2(m_msgcontent9)==0)
  93. {
  94. AfxMessageBox("信息服务商禁止的非法字符:("+g_temp+")希望您谅解!");
  95. return;
  96. }
  97. if(CheckBadWords(m_msgcontent10)==0 || CheckBadWords2(m_msgcontent10)==0)
  98. {
  99. AfxMessageBox("信息服务商禁止的非法字符:("+g_temp+")希望您谅解!");
  100. return;
  101. }
  102. CString sql;
  103. sql.Format("update version set [msgcontent8]='"+m_msgcontent8+"',[msgcontent9]='"+m_msgcontent9+"',[msgcontent10]='"+m_msgcontent10+"',[msgcheck8]='%d',[msgcheck9]='%d',[msgcheck10]='%d'",m_msgcheck8, m_msgcheck9, m_msgcheck10 );
  104. g_sendhead.bsql=1;
  105. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  106. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  107. g_sendhead.bsql=0;
  108. g_sendhead.code[0]=24;
  109. g_sendhead.tabcount=1;
  110. int g_nYearposTemp=g_nYearpos;
  111. g_nYearpos=-1;
  112. g_pMainWnd->ProcessChatMessageRequest2(1);
  113. g_nYearpos=g_nYearposTemp;
  114. if(g_bSendOK)
  115. DataToArray(&g_cominfoarray);
  116. CDialog::OnOK ();
  117. }
  118. void PhoneMsgSet::OnChangeEDITcontent8()
  119. {
  120. // TODO: If this is a RICHEDIT control, the control will not
  121. // send this notification unless you override the CDialog::OnInitDialog()
  122. // function and call CRichEditCtrl().SetEventMask()
  123. // with the ENM_CHANGE flag ORed into the mask.
  124. UpdateData();
  125. m_msgcontent8.Replace ("'", "'");
  126. m_msgcontent8.Replace ("(", "(");
  127. m_msgcontent8.Replace (")", ")");
  128. UpdateData(false);
  129. CString str;
  130. int count=0;
  131. int leng=GetLengthEx(m_msgcontent8);
  132. count+=(leng/MSG_LENGTH);
  133. if(leng%MSG_LENGTH)
  134. count+=1;
  135. str.Format ("%d字/条,现%d字,共%d条)", MSG_LENGTH, leng,count);
  136. GetDlgItem(IDC_STATIC8)->SetWindowText(str);
  137. // TODO: Add your control notification handler code here
  138. }
  139. void PhoneMsgSet::OnChangeEDITcontent9()
  140. {
  141. // TODO: If this is a RICHEDIT control, the control will not
  142. // send this notification unless you override the CDialog::OnInitDialog()
  143. // function and call CRichEditCtrl().SetEventMask()
  144. // with the ENM_CHANGE flag ORed into the mask.
  145. UpdateData();
  146. m_msgcontent9.Replace ("'", "'");
  147. m_msgcontent9.Replace ("(", "(");
  148. m_msgcontent9.Replace (")", ")");
  149. UpdateData(false);
  150. CString str;
  151. int count=0;
  152. int leng=GetLengthEx(m_msgcontent9);
  153. count+=(leng/MSG_LENGTH);
  154. if(leng%MSG_LENGTH)
  155. count+=1;
  156. str.Format ("%d字/条,现%d字,共%d条)", MSG_LENGTH,leng,count);
  157. GetDlgItem(IDC_STATIC9)->SetWindowText(str);
  158. // TODO: Add your control notification handler code here
  159. }
  160. void PhoneMsgSet::OnChangeEDITcontent10()
  161. {
  162. // TODO: If this is a RICHEDIT control, the control will not
  163. // send this notification unless you override the CDialog::OnInitDialog()
  164. // function and call CRichEditCtrl().SetEventMask()
  165. // with the ENM_CHANGE flag ORed into the mask.
  166. UpdateData();
  167. m_msgcontent10.Replace ("'", "'");
  168. m_msgcontent10.Replace ("(", "(");
  169. m_msgcontent10.Replace (")", ")");
  170. UpdateData(false);
  171. CString str;
  172. int count=0;
  173. int leng=GetLengthEx(m_msgcontent10);
  174. count+=(leng/MSG_LENGTH);
  175. if(leng%MSG_LENGTH)
  176. count+=1;
  177. str.Format ("%d字/条,现%d字,共%d条)", MSG_LENGTH,leng,count);
  178. GetDlgItem(IDC_STATIC10)->SetWindowText(str);
  179. // TODO: Add your control notification handler code here
  180. }