⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auditdlg.cpp

📁 一个电视台专用的信息管理软件源代码
💻 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 + -