ClientIPForm.cpp 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. // ClientIPFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZSendMsg.h"
  5. #include "ClientIPForm.h"
  6. #include "MyMdi.H"
  7. //#include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. //#include "TakeStautsSel.h"
  10. #include "mysqldata.h"
  11. #include "InputPsw.h"
  12. #include "ReCharge.h"
  13. #include "ShowHistoryReg.h"
  14. #include "SetClientIPDlg.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. // ClientIPFrom IDC_STATIC2
  23. IMPLEMENT_DYNCREATE(ClientIPFrom, CFormView)
  24. ClientIPFrom::ClientIPFrom()
  25. : CFormView(ClientIPFrom::IDD)
  26. {
  27. //{{AFX_DATA_INIT(ClientIPFrom)
  28. m_filter = _T("");
  29. //}}AFX_DATA_INIT
  30. }
  31. ClientIPFrom::~ClientIPFrom()
  32. {
  33. }
  34. void ClientIPFrom::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CFormView::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(ClientIPFrom)
  38. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  39. DDX_Control(pDX, IDC_LIST2, m_List1);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(ClientIPFrom, CFormView)
  45. //{{AFX_MSG_MAP(ClientIPFrom)
  46. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  47. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  48. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  49. ON_WM_TIMER()
  50. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  51. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  52. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  53. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  54. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  55. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  56. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  57. ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2)
  58. //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60. /////////////////////////////////////////////////////////////////////////////
  61. // ClientIPFrom diagnostics
  62. #ifdef _DEBUG
  63. void ClientIPFrom::AssertValid() const
  64. {
  65. CFormView::AssertValid();
  66. }
  67. void ClientIPFrom::Dump(CDumpContext& dc) const
  68. {
  69. CFormView::Dump(dc);
  70. }
  71. #endif //_DEBUG
  72. /////////////////////////////////////////////////////////////////////////////
  73. // ClientIPFrom message handlers
  74. void ClientIPFrom::OnInitialUpdate()
  75. {
  76. CFormView::OnInitialUpdate();
  77. // TODO: Add your specialized code here and/or call the base class
  78. CMyMdi Mdi;
  79. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  80. // Here we create the outbar control using the splitter as its parent
  81. // and setting its id to the first pane.
  82. CRect rc2;
  83. GetWindowRect(rc2);
  84. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  85. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  86. m_static1.SetFont (&g_titlefont);
  87. m_List1.SetHeadings("企业名,150;店名,150;域名,150;IP,150;刷新时间,150;备注,200;申请日期,100;类别,100;权限,100" );
  88. m_List1.LoadColumnInfo (_T("104"));
  89. m_combo1.GetWindowRect (rc2);
  90. ScreenToClient(rc2);
  91. rc2.bottom +=200;
  92. m_combo1.MoveWindow (rc2);
  93. m_combo1.AddString ("余额不足");
  94. OnButton1();
  95. }
  96. void ClientIPFrom::FillGrid(BOOL bStatus)
  97. {
  98. m_List1.DeleteAllItems2 ();
  99. int ii=0;
  100. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  101. int count=0;
  102. if(m_filter.IsEmpty ())
  103. {
  104. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  105. {
  106. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  107. }
  108. }
  109. else
  110. {
  111. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  112. {
  113. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 \
  114. ||m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 \
  115. || m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 \
  116. || m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 \
  117. || m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 \
  118. || m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1 )
  119. {
  120. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  121. }
  122. }
  123. }
  124. m_List1.m_arLabels.SetSize(count, 1);
  125. ii=count;
  126. m_List1.m_LabelCount=ii;
  127. m_List1.SetItemCountEx (ii);
  128. CString str;
  129. str.Format ("域名:%d", ii);
  130. SetDlgItemText(IDC_STATIC2, str);
  131. }
  132. void ClientIPFrom::OnBUTclose()
  133. {
  134. // TODO: Add your control notification handler code here
  135. GetParent()->SendMessage(WM_CLOSE);
  136. }
  137. void ClientIPFrom::OnSelchangeCombo1()
  138. {
  139. // TODO: Add your control notification handler code here
  140. SetTimer(1, 100, NULL);
  141. }
  142. void ClientIPFrom::OnTimer(UINT nIDEvent)
  143. {
  144. // TODO: Add your message handler code here and/or call default
  145. KillTimer(nIDEvent);
  146. OnButton1();
  147. }
  148. BOOL ClientIPFrom::PreTranslateMessage(MSG* pMsg)
  149. {
  150. // TODO: Add your specialized code here and/or call the base class
  151. try
  152. {
  153. if(pMsg->message==WM_KEYDOWN)
  154. {
  155. switch (pMsg->wParam)
  156. {
  157. case VK_RETURN:
  158. OnButton1();
  159. return 1;
  160. case 0x43: // copy
  161. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  162. {
  163. GetFocus()->SendMessage(WM_COPY);
  164. return TRUE;
  165. }
  166. break;
  167. case 0x56: //Ctrl + V:
  168. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  169. {
  170. GetFocus()->SendMessage(WM_PASTE);
  171. return TRUE;
  172. }
  173. break;
  174. case 0x58: // cut
  175. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  176. {
  177. GetFocus()->SendMessage(WM_CUT);
  178. return TRUE;
  179. }
  180. break;
  181. case 0x5A: //undo
  182. case 0x59: //redo
  183. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  184. {
  185. GetFocus()->SendMessage(WM_UNDO);
  186. return TRUE;
  187. }
  188. break;
  189. }
  190. }
  191. return CFormView::PreTranslateMessage(pMsg);
  192. }
  193. catch(...)
  194. {
  195. }
  196. }
  197. void ClientIPFrom::OnBUTmoney()
  198. {
  199. // TODO: Add your control notification handler code here
  200. }
  201. void ClientIPFrom::OnBTNaddsp()
  202. {
  203. }
  204. void ClientIPFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  205. {
  206. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  207. // TODO: Add your control notification handler code here
  208. *pResult = 0;
  209. }
  210. extern void ConvertToPrice(CString &str);
  211. void ClientIPFrom::OnButton1()
  212. {
  213. // TODO: Add your control notification handler code here
  214. CRecordset myset(&g_db);
  215. CString sql="select count(*) as cot from clientip";
  216. myset.Open (CRecordset::forwardOnly, sql);
  217. myset.GetFieldValue ("cot", sql);
  218. myset.Close();
  219. m_List1array.SetSize(atol(sql) , 1 );
  220. CRstClientIP rsSt;
  221. rsSt.Open();
  222. DWORD ii=0;
  223. while(!rsSt.IsEOF())
  224. {
  225. m_List1array.ElementAt (ii).RemoveAll ();
  226. m_List1array.ElementAt (ii).Add(rsSt.m_enterprisename) ;
  227. m_List1array.ElementAt (ii).Add(rsSt.m_branchname) ;
  228. m_List1array.ElementAt (ii).Add(rsSt.m_name) ;
  229. m_List1array.ElementAt (ii).Add(rsSt.m_ip) ;
  230. m_List1array.ElementAt (ii).Add(rsSt.m_datetime) ;
  231. m_List1array.ElementAt (ii).Add(rsSt.m_bz) ;
  232. m_List1array.ElementAt (ii).Add(rsSt.m_applydate) ;
  233. m_List1array.ElementAt (ii).Add(rsSt.m_bmain) ;
  234. m_List1array.ElementAt (ii).Add(rsSt.m_rights) ;
  235. ii++;
  236. rsSt.MoveNext();if(m_List1array.GetSize ()<=ii)break;
  237. }
  238. rsSt.Close();m_List1array.SetSize(ii , 1 );
  239. UpdateData();
  240. m_filter.TrimLeft ();
  241. m_filter.TrimRight ();
  242. FillGrid();
  243. }
  244. void ClientIPFrom::OnBUTshowphoto() //历史冲值
  245. {
  246. }
  247. void ClientIPFrom::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  248. {
  249. // TODO: Add your control notification handler code here
  250. POSITION pos;
  251. pos=m_List1.GetFirstSelectedItemPosition();
  252. if(pos==NULL)
  253. {
  254. return;
  255. }
  256. int iItem=m_List1.GetNextSelectedItem(pos);
  257. CString m_name=m_List1.GetItemText (iItem, 2);
  258. CString ip=m_List1.GetItemText (iItem, 3);
  259. SetClientIPDlg dlg;
  260. dlg.m_mode =1;
  261. dlg.m_name =m_name;
  262. dlg.m_ip =ip;
  263. if(dlg.DoModal ()==IDOK)
  264. OnButton1();
  265. *pResult = 0;
  266. }
  267. void ClientIPFrom::OnBUTimportphoto() //添加客户
  268. {
  269. // TODO: Add your control notification handler code here
  270. SetClientIPDlg dlg;
  271. POSITION pos;
  272. pos=m_List1.GetFirstSelectedItemPosition();
  273. if(pos!=NULL)
  274. {
  275. int iItem=m_List1.GetNextSelectedItem(pos);
  276. dlg.m_enterprisename=m_List1.GetItemText (iItem, 0);
  277. dlg.m_branchname=m_List1.GetItemText (iItem, 1);
  278. dlg.m_name=m_List1.GetItemText (iItem, 2);
  279. }
  280. if(dlg.DoModal ()==IDOK)
  281. OnButton1();
  282. }
  283. void ClientIPFrom::OnBUTimportphoto2()
  284. {
  285. }
  286. void ClientIPFrom::OnButton2()
  287. {
  288. }