// SetLoginBan.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "SetLoginBan.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // SetLoginBan dialog SetLoginBan::SetLoginBan(CWnd* pParent /*=NULL*/) : CDialog(SetLoginBan::IDD, pParent) { //{{AFX_DATA_INIT(SetLoginBan) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pos=0; } void SetLoginBan::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(SetLoginBan) DDX_Control(pDX, IDC_LIST1, m_List1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(SetLoginBan, CDialog) //{{AFX_MSG_MAP(SetLoginBan) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SetLoginBan message handlers BOOL SetLoginBan::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here g_sendhead.bsql=0; g_sendhead.code[0]=97; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(2);if(g_bSendOK==0)return false; DataToArray(&g_List1array); m_List1.InitStyle(); m_List1.InsertColumn(0,_T("姓名"),LVCFMT_LEFT,100); m_List1.InsertColumn(1,_T("星期日"),LVCFMT_LEFT,100); m_List1.InsertColumn(2,_T("星期一"),LVCFMT_LEFT,100); m_List1.InsertColumn(3,_T("星期二"),LVCFMT_LEFT,100); m_List1.InsertColumn(4,_T("星期三"),LVCFMT_LEFT,100); m_List1.InsertColumn(5,_T("星期四"),LVCFMT_LEFT,100); m_List1.InsertColumn(6,_T("星期五"),LVCFMT_LEFT,100); m_List1.InsertColumn(7,_T("星期六"),LVCFMT_LEFT,100); GetTimeRange(); CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void SetLoginBan::GetTimeRange() { CTime tm(atoi(g_date.Mid (0,4)),atoi(g_date.Mid (5,2)),atoi(g_date.Mid (8,2)),0,0,0);//=CTime::GetCurrentTime (); if(m_pos) { CTimeSpan sp(abs(m_pos)*7, 0, 0, 0); if(m_pos>0) tm+=sp; else tm-=sp; } int nDayWeek = tm.GetDayOfWeek()-1; int days1=nDayWeek; int days2=6-nDayWeek; CTime tm2,tm3; CTimeSpan sp(days1, 0, 0, 0); tm2=tm-sp; CTimeSpan sp2(days2, 0, 0, 0); tm3=tm+sp2; CString str; str.Format ("时间段:%04d-%02d-%02d 至 %04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay (), tm3.GetYear (), tm3.GetMonth (), tm3.GetDay () ); SetDlgItemText(IDC_STATIC1, str); m_scurdate.Format ("%04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay () ); ShowLoginData(); } void SetLoginBan::OnButton1() { // TODO: Add your control notification handler code here m_pos--; GetTimeRange(); } void SetLoginBan::OnButton2() { // TODO: Add your control notification handler code here m_pos++; GetTimeRange(); } void SetLoginBan::ShowLoginData() {//m_scurdate CString filter="weekname='"+m_scurdate+"'"; g_sendhead.code[0]=107; g_sendhead.tabcount=1; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; CArrayList1array; DataToArray(&List1array); m_List1.DeleteAllItems (); for(int i=0; iProcessChatMessageRequest2(pData, length); g_nSendCode=0; delete []pData; if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); } void SetLoginBan::OnButton3() { // TODO: Add your control notification handler code here CFileDialog fdlg(false, NULL,"ban1", OFN_ALLOWMULTISELECT,"排班文件(*.ban)|*.ban||"); if(fdlg.DoModal ()!=IDOK)return; CStringArray array; for(int i=0; i