?? rephistorydlg.cpp
字號:
// RepHistoryDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tvnews.h"
#include "RepHistoryDlg.h"
#include "News.h"
#include "RepHInfoDlg.h"
#include "NewsAudit.h"
#include "NewsSerch.h"
#include "SendFile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRepHistoryDlg dialog
extern CTVNewsApp theApp;
CRepHistoryDlg::CRepHistoryDlg(CWnd* pParent /*=NULL*/)
: CDialog(CRepHistoryDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRepHistoryDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CRepHistoryDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRepHistoryDlg)
DDX_Control(pDX, IDC_HISTORY_LCINFO, m_lcInfo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRepHistoryDlg, CDialog)
//{{AFX_MSG_MAP(CRepHistoryDlg)
ON_BN_CLICKED(IDC_BTNMORE_HINFO, OnBtnMoreHInfo)
ON_NOTIFY(NM_CLICK, IDC_HISTORY_LCINFO, OnClickHistoryLcinfo)
ON_WM_SHOWWINDOW()
ON_BN_CLICKED(IDC_BTNUPDATE_QUERY, OnBtnupdateQuery)
ON_BN_CLICKED(IDC_BTNCANCEL_RINFO, OnBtncancelRinfo)
ON_NOTIFY(NM_DBLCLK, IDC_HISTORY_LCINFO, OnDblclkHistoryLcinfo)
ON_BN_CLICKED(IDC_BTNUPDATE_REFRESH, OnBtnupdateRefresh)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRepHistoryDlg message handlers
void CRepHistoryDlg::OnBtnMoreHInfo()
{
// 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();
}
BOOL CRepHistoryDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
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,200);
m_lcInfo.InsertColumn(2,_T("文件名"));
m_lcInfo.SetColumnWidth(2,200);
m_lcInfo.InsertColumn(3,_T("文件大小"));
m_lcInfo.SetColumnWidth(3,100);
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);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRepHistoryDlg::OnClickHistoryLcinfo(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
//-- Get the number of selected rows
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;
return;
}
void CRepHistoryDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
Refresh();
}
void CRepHistoryDlg::OnBtnupdateQuery()
{
// TODO: Add your control notification handler code here
CNewsSerch NewsSerch;
NewsSerch.DoModal();
CString strCondition = NewsSerch.strSQL;
// CNews news;
// CUIntArray allNewsItem;
// news.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID(),0,strCondition);
Refresh(strCondition);
}
void CRepHistoryDlg::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(),0);
//////////////////////////////////////////
unsigned short nPort;//服務器端口號
CString Server_IP;//服務器IP地址
CString FileName ;//服務器上文件名稱,絕對路徑
News.GetServerInfByNewsID(m_SelectID,FileName,nPort,Server_IP);
char pErrorString[256];//錯誤提示信息
if(!DeleteNewsFile(Server_IP, nPort,FileName,pErrorString))
MessageBox(pErrorString);
////////////////////////////////////////////////
Refresh();
}
}
}
void CRepHistoryDlg::OnDblclkHistoryLcinfo(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));
}
OnBtnMoreHInfo() ;
*pResult = 0;
}
void CRepHistoryDlg::Refresh(CString strCondition)
{
CNews news;
CUIntArray allNewsItem;
news.GetAllNewsByUserID(allNewsItem,theApp.m_user.GetUID(),0,strCondition);
int i;
m_lcInfo.DeleteAllItems();
for(i=0;i<allNewsItem.GetSize();i++)
{
news.ShowListByNewsID(m_lcInfo,allNewsItem.GetAt(i));
}
}
void CRepHistoryDlg::OnBtnupdateRefresh()
{
// TODO: Add your control notification handler code here
Refresh();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -