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

📄 admchanneldlg.cpp

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

#include "stdafx.h"
#include "tvnews.h"
#include "AdmChannelDlg.h"
#include "Channel.h"
#include "ChannelInfDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAdmChannelDlg dialog


CAdmChannelDlg::CAdmChannelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAdmChannelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAdmChannelDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CAdmChannelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAdmChannelDlg)
	DDX_Control(pDX, IDC_LIST1, m_ChannelList);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAdmChannelDlg, CDialog)
	//{{AFX_MSG_MAP(CAdmChannelDlg)
	ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
	ON_BN_CLICKED(IDC_BTNUPDATE_RINFO, OnBtnupdateEdt)
	ON_BN_CLICKED(IDC_BTNUPDATE_RINFO2, OnBtnupdateIns)
	ON_BN_CLICKED(IDC_BTNUPDATE_RINFO3, OnBtnupdateRinfo3)
	ON_WM_SHOWWINDOW()
	ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAdmChannelDlg message handlers

BOOL CAdmChannelDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_ChannelList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
	m_ChannelList.InsertColumn(0,_T(""));
	m_ChannelList.SetColumnWidth(0,0);
	m_ChannelList.InsertColumn(1,_T("频道名称"));
	m_ChannelList.SetColumnWidth(1,150);
	m_ChannelList.InsertColumn(2,_T("描述"));
	m_ChannelList.SetColumnWidth(2,150);
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAdmChannelDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	//-- Get the number of selected rows
	int nSelRows = m_ChannelList.GetSelectedCount();

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

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

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

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

void CAdmChannelDlg::OnBtnupdateEdt() 
{
	// TODO: Add your control notification handler code here
	if(m_ChannelList.GetSelectedCount()==0)
	{
		MessageBox("请选择要编辑的行!");
		return;
	}
	CChannelInfDlg ChannelInfDlg;
	ChannelInfDlg.Type=1;
	ChannelInfDlg.iUID=selectID;
	ChannelInfDlg.DoModal();
    
	CChannel Channel;
	Channel.ShowList(m_ChannelList," AND UID<>0 ");
	
}

void CAdmChannelDlg::OnBtnupdateIns() 
{
	// TODO: Add your control notification handler code here
	
	CChannelInfDlg ChannelInfDlg;
	ChannelInfDlg.Type=0;

	ChannelInfDlg.DoModal();
	CChannel Channel;
	Channel.ShowList(m_ChannelList," AND UID<>0 ");
	
}

void CAdmChannelDlg::OnBtnupdateRinfo3() 
{
	// TODO: Add your control notification handler code here
	if(m_ChannelList.GetSelectedCount()==0)
	{
		MessageBox("请选择要删除的行!");
		return;
	}
	if(MessageBox("删除频道将同时删除该频道下的所有栏目,你确定要删除该频道吗?","询问信息", MB_YESNO ) == IDYES)

	{
		long iFlg;
		CString cMessage;

		CChannel Channel;
		Channel.sql_delete(selectID,iFlg,cMessage);
		if(1==iFlg)
		{

			Channel.ShowList(m_ChannelList," AND UID<>0 ");
		}
		else
		{
			MessageBox(cMessage);
		}
		
	}
	
	
}

void CAdmChannelDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
	CChannel Channel;
	Channel.ShowList(m_ChannelList," AND UID<>0 ");
	
}

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

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

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

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

	if (i != -1) //-- Execute this loop as long as GetNextSelectedItem() returns -1
	{
		selectID= atoi(m_ChannelList.GetItemText(i, 0));
	}
	CChannelInfDlg ChannelInfDlg;
	ChannelInfDlg.Type=1;
	ChannelInfDlg.iUID=selectID;

	ChannelInfDlg.DoModal();
    
	CChannel Channel;
	Channel.ShowList(m_ChannelList," AND UID<>0 ");
	
	*pResult = 0;
}

⌨️ 快捷键说明

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