?? auditdlg.cpp
字號:
// AuditDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tvnews.h"
#include "AuditDlg.h"
#include "AuditColumnListDlg.h"
#include "AuditTodayDlg.h"
#include "AuditHistoryDlg.h"
#include "NewsAudit.h"
#include "UserChannel.h"
#include "Column.h"
#include "Channel.h"
#include "NewsAudit.h"
#include "News.h"
#include "Message.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WM_ICON_NOTIFY WM_USER+10
/////////////////////////////////////////////////////////////////////////////
// CAuditDlg dialog
extern CTVNewsApp theApp;
CAuditDlg::CAuditDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAuditDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAuditDlg)
m_strDesc = _T("");
m_strLogTime = _T("");
m_strUserInf = _T("");
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
}
void CAuditDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAuditDlg)
DDX_Control(pDX, IDC_TAB1, m_tab);
DDX_Text(pDX, IDC_STATIC_DESC, m_strDesc);
DDX_Text(pDX, IDC_STATIC_LOGTIME, m_strLogTime);
DDX_Text(pDX, IDC_STATIC_USERINF, m_strUserInf);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAuditDlg, CDialog)
//{{AFX_MSG_MAP(CAuditDlg)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
ON_WM_CLOSE()
ON_WM_TIMER()
ON_COMMAND(IDR_DEMO, OnDemo)
ON_MESSAGE(WM_ICON_NOTIFY, OnTrayNotification)
ON_COMMAND(IDR_EXIT, OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAuditDlg message handlers
BOOL CAuditDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetTimer(1,1000,NULL);
m_tab.InsertItem(0," 評審列表");
m_tab.InsertItem(1," 當天新聞列表");
m_tab.InsertItem(2," 歷史新聞查詢");
RoleID=theApp.m_user.GetRoleID();
CUsers User;
int UserID=theApp.m_user.GetUID();
User.GetData(UserID);
CUserChannel userChannel;
CChannel Channel;
CColumn Column;
CString ChannelName,ColumnName;
int ChannelID = userChannel.GetChannelIDByUserID(UserID);
int ColumnID = userChannel.GetColumnIDByUserID(UserID);
if(0==ChannelID)
{
ChannelName="";
}
else
{
Channel.GetData(ChannelID);
ChannelName = Channel.GetName();
}
if(0==ColumnID)
{
ColumnName="";
}
else
{
Column.GetData(ChannelID);
ColumnName = Column.GetName();
}
if(2==User.GetRoleID())
{
m_strUserInf="責任編輯:"+User.GetName()+"您好!您現在處于"+ChannelName+"頻道下的"+ColumnName+"欄目!!!";
}
if(3==User.GetRoleID())
{
m_strUserInf="頻道總監:"+User.GetName()+"您好!您現在處于"+ChannelName+"頻道!!!";
}
if(4==User.GetRoleID())
{
m_strUserInf="責任臺長:"+User.GetName()+"您好!";
}
SYSTEMTIME st;
CString strDate;
GetLocalTime(&st);
strDate.Format("%4d-%2d-%2d %2d:%2d",st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute);
m_strLogTime="登陸時間:" + strDate;
//建立屬性頁各頁
AuditColumnListDlg.Create(IDD_COLUMN_NEWSLIST,GetDlgItem(IDC_TAB1));
AuditTodayDlg.Create(IDD_AUDIT_TODAY,GetDlgItem(IDC_TAB1));
AuditHistoryDlg.Create(IDD_AUDIT_HISTORY,GetDlgItem(IDC_TAB1));
//設置頁面的位置在m_tab控件范圍內
CRect rs;
m_tab.GetClientRect(rs);
rs.top+=20;
rs.bottom-=4;
rs.left+=4;
rs.right-=4;
AuditColumnListDlg.MoveWindow(rs);
AuditTodayDlg.MoveWindow(rs);
AuditHistoryDlg.MoveWindow(rs);
AuditColumnListDlg.ShowWindow(TRUE);
m_tab.SetCurSel(0);
CNewsAudit newsAudit;
CUIntArray allNewsItem;
int i = newsAudit.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID()," AND NewsAudit.state = 1 ");
CString strNum;
strNum.Format("%d",i);
m_strDesc="您還有"+strNum+"條記錄等待處理!";
UpdateData(false);
m_TrayIcon.Create(this,WM_ICON_NOTIFY,"鼠標指向時顯示",m_hIcon,IDR_MENU); //構造
m_TrayIcon.SetIcon(IDI_MYICON);
Flg=0;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAuditDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int CurSel;
CurSel=m_tab.GetCurSel();
switch(CurSel)
{
case 0:
AuditColumnListDlg.ShowWindow(TRUE);
AuditTodayDlg.ShowWindow(FALSE);
AuditHistoryDlg.ShowWindow(FALSE);
break;
case 1:
AuditColumnListDlg.ShowWindow(FALSE);
AuditTodayDlg.ShowWindow(TRUE);
AuditHistoryDlg.ShowWindow(FALSE);
break;
case 2:
AuditColumnListDlg.ShowWindow(FALSE);
AuditTodayDlg.ShowWindow(FALSE);
AuditHistoryDlg.ShowWindow(TRUE);
break;
default: ;
}
*pResult = 0;
}
void CAuditDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
ShowWindow(SW_HIDE); //隱藏窗口
}
void CAuditDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CNewsAudit newsAudit;
CUIntArray allNewsItem;
int i = newsAudit.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID()," AND NewsAudit.state = 1 ");
CString strNum;
strNum.Format("%d",i);
m_strDesc="您還有"+strNum+"條記錄等待處理!";
UpdateData(false);
CUIntArray allNewNewsItem;
CNewsAudit NewsAudit;
CNews News;
CString cMessage;
if((NewsAudit.GetNewNews(allNewNewsItem,theApp.m_user.GetUID()))&&(Flg==0))
{
CMessage Message;
int i;
for( i=0;i<allNewNewsItem.GetSize();i++)
{
Flg=1;
// NewsAudit.ShowNewNews(allNewNewsItem.GetAt(i),cMessage);
Message.NewsItem.Add(allNewNewsItem.GetAt(i));
}
// Message.m_strMessage=cMessage;
// Message.m_NewsID=allNewNewsItem.GetAt(i);
Message.m_Type=1;
Message.m_AuditID=theApp.m_user.GetUID();
Message.DoModal();
Flg=0;
}
CDialog::OnTimer(nIDEvent);
}
LRESULT CAuditDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
return m_TrayIcon.OnTrayNotification(wParam,lParam);
}
void CAuditDlg::OnDemo()
{
// TODO: Add your command handler code here
ShowWindow(SW_SHOW);
}
void CAuditDlg::OnExit()
{
// TODO: Add your command handler code here
m_TrayIcon.RemoveIcon();
KillTimer(1);
CUsers User;
long iFlg;
CString cMessage;
int UserID=theApp.m_user.GetUID();
User.LogOut(UserID,iFlg,cMessage);
OnCancel();
}
BOOL CAuditDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN)
{
return true;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -