PayOutSet.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // PayOutSet.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "PayOutSet.h"
  6. #include "mysqldata.h"
  7. #include "InputPsw.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // PayOutSet dialog
  15. PayOutSet::PayOutSet(CWnd* pParent /*=NULL*/)
  16. : CDialog(PayOutSet::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(PayOutSet)
  19. m_edit1 = _T("");
  20. //}}AFX_DATA_INIT
  21. }
  22. void PayOutSet::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(PayOutSet)
  26. DDX_Control(pDX, IDC_LIST1, m_List1);
  27. DDX_Text(pDX, IDC_EDIT1, m_edit1);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(PayOutSet, CDialog)
  31. //{{AFX_MSG_MAP(PayOutSet)
  32. ON_BN_CLICKED(IDC_BUTadd, OnBUTadd)
  33. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // PayOutSet message handlers
  38. BOOL PayOutSet::OnInitDialog()
  39. {
  40. CDialog::OnInitDialog();
  41. // TODO: Add extra initialization here
  42. CRect rc;
  43. m_List1.GetClientRect (rc);
  44. CString strHeadings;
  45. m_List1.SetHeadings("影楼名称,150;单数,150;刷新时间,150;远程控制,150" );
  46. m_List1.LoadColumnInfo (_T("101"));
  47. FillGrid();
  48. this->CenterWindow (g_pMainWnd);
  49. return TRUE; // return TRUE unless you set the focus to a control
  50. // EXCEPTION: OCX Property Pages should return FALSE
  51. }
  52. void PayOutSet::FillGrid()
  53. {
  54. CRecordset myset(&g_db);
  55. CString sql="select count(*) as cot from unauth";
  56. myset.Open (CRecordset::forwardOnly, sql);
  57. myset.GetFieldValue ("cot", sql);
  58. myset.Close();
  59. m_List1array.SetSize(atol(sql) , 1 );
  60. CRstunauth rsSt;
  61. rsSt.Open();
  62. DWORD ii=0;
  63. while(!rsSt.IsEOF())
  64. {
  65. m_List1array.ElementAt (ii).RemoveAll ();
  66. m_List1array.ElementAt (ii).Add(rsSt.m_name) ;
  67. m_List1array.ElementAt (ii).Add(rsSt.m_dindan) ;
  68. m_List1array.ElementAt (ii).Add(rsSt.m_datetime) ;
  69. m_List1array.ElementAt (ii).Add(rsSt.m_execute) ;
  70. ii++;
  71. rsSt.MoveNext();if(m_List1array.GetSize ()<=ii)break;
  72. }
  73. rsSt.Close();m_List1array.SetSize(ii , 1 );
  74. m_List1.DeleteAllItems2 ();
  75. ii=0;
  76. {
  77. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  78. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  79. m_List1.m_arLabels.ElementAt (ii).Copy (m_List1array.ElementAt (ii));
  80. }
  81. m_List1.m_LabelCount=ii;
  82. m_List1.SetItemCountEx (ii);
  83. }
  84. void PayOutSet::OnBUTadd()
  85. {
  86. // TODO: Add your control notification handler code here
  87. POSITION pos;
  88. pos=m_List1.GetFirstSelectedItemPosition();
  89. if(pos==NULL)
  90. {
  91. AfxMessageBox("请先选中您要控制的项目!", MB_ICONINFORMATION);
  92. return;
  93. }
  94. int iItem=m_List1.GetNextSelectedItem(pos);
  95. CString name=m_List1.GetItemText (iItem, 0);
  96. InputPsw dlg;
  97. if(dlg.DoModal()!=IDOK)return;
  98. CString sql;
  99. sql.Format("update [unauth] set [execute]='%s' where [name]='%s'", "停止运行", name);
  100. MyExecuteSQL(&g_db, sql);
  101. FillGrid();
  102. }
  103. void PayOutSet::OnBUTdel()
  104. {
  105. // TODO: Add your control notification handler code here
  106. }