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

📄 audittodaydlg.cpp

📁 一个电视台专用的信息管理软件源代码
💻 CPP
字号:
// AuditTodayDlg.cpp : implementation file
//

#include "stdafx.h"
#include "tvnews.h"
#include "AuditTodayDlg.h"
#include "News.h"
#include "RepHInfoDlg.h"
#include "SendFile.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAuditTodayDlg dialog

extern CTVNewsApp theApp;
CAuditTodayDlg::CAuditTodayDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAuditTodayDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAuditTodayDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CAuditTodayDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAuditTodayDlg)
	DDX_Control(pDX, IDC_TODAY_LCINFO, m_lcInfo);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAuditTodayDlg, CDialog)
	//{{AFX_MSG_MAP(CAuditTodayDlg)
	ON_NOTIFY(NM_CLICK, IDC_TODAY_LCINFO, OnClickTodayLcinfo)
	ON_BN_CLICKED(IDC_BTNMORE_RINFO, OnBtnmoreRinfo)
	ON_WM_SHOWWINDOW()
	ON_BN_CLICKED(IDC_BTNCANCEL_RINFO, OnBtncancelRinfo)
	ON_NOTIFY(NM_DBLCLK, IDC_TODAY_LCINFO, OnDblclkTodayLcinfo)
//	ON_BN_CLICKED(IDC_BTNUPDATE_REFRESH, OnBtnupdateRefresh)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAuditTodayDlg message handlers

BOOL CAuditTodayDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
// TODO: Add extra initialization here
	SetTimer(1,5000,NULL); 

	m_lcInfo.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
	m_lcInfo.InsertColumn(0,_T("ID"),LVCFMT_LEFT|LVCFMT_IMAGE);
	m_lcInfo.SetColumnWidth(0,0);
	m_lcInfo.InsertColumn(1,_T("新闻标题"));
	m_lcInfo.SetColumnWidth(1,100);
	m_lcInfo.InsertColumn(2,_T("文件名"));
	m_lcInfo.SetColumnWidth(2,200);
	m_lcInfo.InsertColumn(3,_T("文件大小"));
	m_lcInfo.SetColumnWidth(3,200);
	m_lcInfo.InsertColumn(4,_T("评审状态"));
	m_lcInfo.SetColumnWidth(4,100);
	m_lcInfo.InsertColumn(5,_T("上传时间"));
	m_lcInfo.SetColumnWidth(5,100);
	m_lcInfo.InsertColumn(6,_T("通过时间"));
	m_lcInfo.SetColumnWidth(6,100);
	m_lcInfo.InsertColumn(7,_T("作者"));
	m_lcInfo.SetColumnWidth(7,100);
	m_lcInfo.InsertColumn(8,_T("频道"));
	m_lcInfo.SetColumnWidth(8,100);
	m_lcInfo.InsertColumn(9,_T("栏目"));
	m_lcInfo.SetColumnWidth(9,100);
	m_lcInfo.InsertColumn(10,_T("必审人员"));
	m_lcInfo.SetColumnWidth(10,100);

	SYSTEMTIME st;
	CString strDate1,strDate2;
	GetLocalTime(&st);
	strDate1.Format("%4d-%2d-%2d",st.wYear,st.wMonth,st.wDay);
	strDate2.Format("%4d-%2d-%2d",st.wYear,st.wMonth,st.wDay+1);

	strSQL = " AND (( SendTime BETWEEN '"+ strDate1 + "' AND '" + strDate2 + "') OR ( PassTime BETWEEN '" + strDate1 + "' AND '" + strDate2 + "') OR ( AuditTime BETWEEN '" + strDate1 + "' AND '" + strDate2 + "'))";

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAuditTodayDlg::OnClickTodayLcinfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	int nSelRows = m_lcInfo.GetSelectedCount();

	if(!nSelRows) //-- If there are no rows selected,jump out here
		return;

	//-- Get the position of the first selected row
	POSITION pos =m_lcInfo.GetFirstSelectedItemPosition();

	//-- Get the index of next selected row
	int i = m_lcInfo.GetNextSelectedItem(pos);

	if (i != -1) //-- Execute this loop as long as GetNextSelectedItem() returns -1
	{
		m_SelectID= atoi(m_lcInfo.GetItemText(i, 0));
	}		
	
	
	*pResult = 0;
}

void CAuditTodayDlg::OnBtnmoreRinfo() 
{
	// TODO: Add your control notification handler code here
	if(m_lcInfo.GetSelectedCount()==0)
	{
		MessageBox("请选择要查看的行!");
		return;
	}
	CRepHInfoDlg repHInfoDlg;
	//传递变量
	//MessageBox(m_SelectID);
	repHInfoDlg.newsID=m_SelectID;
	repHInfoDlg.DoModal();
	Refresh();
}

void CAuditTodayDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
	Refresh();
	
}

void CAuditTodayDlg::OnBtncancelRinfo() 
{
	// TODO: Add your control notification handler code here
	if(m_lcInfo.GetSelectedCount()==0)
	{
		MessageBox("请选择要撤单的新闻!");
		return;
	}
	if(MessageBox("你确定要撤消该新闻吗?","询问信息", MB_YESNO ) == IDYES)
	{
		CNews News;
		long iFlg;
		CString cMessage;
		News.CancleNews(m_SelectID,theApp.m_user.GetUID(),iFlg,cMessage);

		if(0==iFlg)
		{
			MessageBox(cMessage);
		}
		else
		{
			CUIntArray allNewsItem;
			News.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID(),1,strSQL);

			//////////////////////////////////////////
			CString FileName ;//服务器上文件名称,绝对路径
			unsigned short nPort;//服务器端口号
			CString Server_IP;//服务器IP地址
			

			News.GetServerInfByNewsID(m_SelectID,FileName,nPort,Server_IP);			
			
			char pErrorString[256];//错误提示信息

			if(!DeleteNewsFile(Server_IP, nPort,FileName,pErrorString))
				MessageBox(pErrorString);

            ////////////////////////////////////////////////
			Refresh();
		}
	}
	
}

void CAuditTodayDlg::OnDblclkTodayLcinfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here

	int nSelRows = m_lcInfo.GetSelectedCount();

	if(!nSelRows) //-- If there are no rows selected,jump out here
		return;

	//-- Get the position of the first selected row
	POSITION pos =m_lcInfo.GetFirstSelectedItemPosition();

	//-- Get the index of next selected row
	int i = m_lcInfo.GetNextSelectedItem(pos);

	if (i != -1) //-- Execute this loop as long as GetNextSelectedItem() returns -1
	{
		m_SelectID= atoi(m_lcInfo.GetItemText(i, 0));
	}		
	OnBtnmoreRinfo() ;

	
	*pResult = 0;
}

void CAuditTodayDlg::Refresh()
{
	CNews news;
	CUIntArray allNewsItem;
	if(4==theApp.m_user.GetRoleID())
	{
		news.GetAllNews(allNewsItem, strSQL);
		int i;
		m_lcInfo.DeleteAllItems();
		for(i=0;i<allNewsItem.GetSize();i++)
		{
			news.ShowListByNewsID(m_lcInfo,allNewsItem.GetAt(i));
		}
	}
	else
	{
		news.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID(),1, strSQL);
		int i;
		m_lcInfo.DeleteAllItems();
		for(i=0;i<allNewsItem.GetSize();i++)
		{
			news.ShowListByNewsID(m_lcInfo,allNewsItem.GetAt(i));
		}
	}
}


void CAuditTodayDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CNews news;
	CUIntArray allNewsItem;
	if(4==theApp.m_user.GetRoleID())
	{
		news.GetAllNews(allNewsItem, strSQL);
		int i;
		m_lcInfo.DeleteAllItems();
		for(i=0;i<allNewsItem.GetSize();i++)
		{
			news.ShowListByNewsID(m_lcInfo,allNewsItem.GetAt(i));
		}
	}
	
	CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -