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

📄 auditcolumupdlg.cpp

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

#include "stdafx.h"
#include "tvnews.h"
#include "AuditColumUpDlg.h"
#include "Users.h"
#include "NewsAudit.h"
#include "Role.h"
#include "UserChannel.h"
#include "News.h"
#include "Users.h"
#include "SendFile.h"
#include "ServerPC.h"
#include "Channel.h"


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

/////////////////////////////////////////////////////////////////////////////
// CAuditColumUpDlg dialog

extern CTVNewsApp theApp;
CAuditColumUpDlg::CAuditColumUpDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAuditColumUpDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAuditColumUpDlg)
	m_strDesc = _T("");
	m_strTime = _T("");
	m_strTitle = _T("");
	m_strType = _T("");
	//}}AFX_DATA_INIT
}


void CAuditColumUpDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAuditColumUpDlg)
	DDX_Control(pDX, IDC_COMBO2, m_cmbAuditMust);
	DDX_Control(pDX, IDC_COLUMNUP_CMBTYPE, m_cmbType);
	DDX_Text(pDX, IDC_COLUMNUP_EDITDESC, m_strDesc);
	DDX_Text(pDX, IDC_COLUMNUP_EDITTIME, m_strTime);
	DDX_Text(pDX, IDC_COLUMNUP_EDITTITLE, m_strTitle);
	DDX_CBString(pDX, IDC_COLUMNUP_CMBTYPE, m_strType);
	DDX_Control(pDX, IDC_OCX1, m_wmplayer);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAuditColumUpDlg, CDialog)
	//{{AFX_MSG_MAP(CAuditColumUpDlg)
	ON_WM_CANCELMODE()
	ON_BN_CLICKED(IDC_COLUMNUP_BTNUP, OnColumnupBtnup)
	ON_BN_CLICKED(IDC_COLUMNUP_BTNFAIL, OnColumnupBtnfail)
	ON_BN_CLICKED(IDC_BTNCANCEL_RINFO, OnBtncancelRinfo)
	ON_BN_CLICKED(IDC_BUTTON2, OnButtonPlay)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAuditColumUpDlg message handlers

BOOL CAuditColumUpDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
		 
	//初始化评审
	CUsers user=theApp.m_user;
	CNews news;
	news.GetData(NewsID);
	m_strTitle=news.GetTitle();
	m_strTime=news.GetSendTime();
	CStringArray allAuditMust;
	CUsers Users;
	CString strSQL=" AND Users.RoleID >2 ";
	Users.GetNames(allAuditMust,strSQL);
	m_cmbAuditMust.ResetContent();

	m_cmbAuditMust.AddString("无");
	for(int i=0;i<allAuditMust.GetSize();i++)
	{
		m_cmbAuditMust.AddString(_T(allAuditMust.GetAt(i)));	
	}
	if(user.GetRoleID()==2)
	{
		m_cmbType.AddString("频道总监");
	}
	else if(user.GetRoleID()==3)
	{
		m_cmbType.AddString("台长");
	}

	
	if(user.GetRoleID()==2)
	{
		m_cmbAuditMust.EnableWindow(TRUE); 
		m_cmbAuditMust.SetCurSel(0);
	}
	else
	{
		CUsers user1;
		user1.GetData(news.GetMustAuditID());
		m_cmbAuditMust.EnableWindow(FALSE); 
		if(news.GetMustAuditID()==0)
		{
			m_cmbAuditMust.SelectString(-1, "无");
			m_cmbType.AddString("总串服务器");
		}
		else
		{
					
			m_cmbAuditMust.SelectString(-1, user1.GetName());
			if(user1.GetRoleID()<=user.GetRoleID())
				m_cmbType.AddString("总串服务器");
		}
	}

	
	

	UpdateData(false);
	m_cmbType.SetCurSel(0);
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAuditColumUpDlg::OnCancelMode() 
{
	CDialog::OnCancelMode();
	
	// TODO: Add your message handler code here
	
}

void CAuditColumUpDlg::OnColumnupBtnup() 
{
	// TODO: Add your control notification handler code here

	long iFlg;
	CString cMessage;
	CUsers user=theApp.m_user;
	CNews News;
	UpdateData(true);
	int iType;
	if(m_strType=="总串服务器")
	{
		iType=2;
	}
	else
	{
		iType=0;
	}
	//应该是iType=2才做下面的
//////////////////////////////////////////////////////////////////////////// 
	if(iType==2)
	{
		News.GetData(NewsID);
		CServerPC SrcServerPC;
		int SrcUID = SrcServerPC.GetIDByIPStr(News.GetIPStr());
		SrcServerPC.GetData(SrcUID);
		CString        SrcIP = SrcServerPC.GetIPStr(); //"10.1.3.25";
		unsigned short SrcPort = SrcServerPC.GetPort(); //7707;
		CString        SrcFileName = News.GetFilePath(); //"e:\\news\\频道1\\20060529\\All in All.lrc";

		CServerPC DstServerPC;
		DstServerPC.GetUploadInf(1,0);

		CString        DstIP = DstServerPC.GetIPStr(); //"10.1.3.27";	
		unsigned short DstPort =DstServerPC.GetPort(); //7707;	
		CString        DstFileName =DstServerPC.GetPSDir(); //"d:\\news\\频道1";
		CChannel Channel;
		Channel.GetData(theApp.m_user.GetChannelID());
		DstFileName += Channel.GetName();

	///////////////////////////////////////////////////////////////////////////	
		char           szErrorString[256];

		if(!CopySvrFile(SrcIP, SrcPort, SrcFileName,
			DstIP, DstPort,	DstFileName,
			false, szErrorString))
		{
			MessageBox(szErrorString);
			return;
		}
		else
		{
			MessageBox("上传到总串服务器成功");
		}
	}
	////////////////////////////////////////////////////////////////////////////

	
	//必审
	CString strbsName;
	CUsers Users;
	long bsUID;
	int iSel=m_cmbAuditMust.GetCurSel();
	m_cmbAuditMust.GetLBText(iSel,strbsName);
	bsUID=Users.getIDByName(strbsName);
	
	m_strDesc.TrimRight();
	m_strDesc.TrimLeft();
	News.AuditNews(NewsID,user.GetUID(),m_strDesc,bsUID,iType,iFlg,cMessage);

	if(iFlg==1)
	{
		CDialog::OnOK();
	}
	else
	{
		MessageBox(cMessage) ;
	}


}

void CAuditColumUpDlg::OnColumnupBtnfail() 
{
	// TODO: Add your control notification handler code here
	CUsers user=theApp.m_user;
	CNews News;
	UpdateData(true);
	long iFlg;
	CString cMessage;

		//必审
	CString strbsName;
	CUsers Users;
	long bsUID;
	int iSel=m_cmbAuditMust.GetCurSel();
	m_cmbAuditMust.GetLBText(iSel,strbsName);
	bsUID=Users.getIDByName(strbsName);
	
	m_strDesc.TrimRight();
	m_strDesc.TrimLeft();

	News.AuditNews(NewsID,user.GetUID(),m_strDesc,bsUID,1,iFlg,cMessage);	
	if(iFlg==1)
	{
		CDialog::OnOK();
	}
	else
	{
		MessageBox(cMessage) ;
	}
	
}

void CAuditColumUpDlg::OnBtncancelRinfo() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
	
}

BOOL CAuditColumUpDlg::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)   
           {   
			    CWnd   *pWnd   =   GetFocus();   
                if(pWnd->GetDlgCtrlID()==IDC_COLUMNUP_BTNUP)
				{
					OnColumnupBtnup();
				}
				else if(pWnd->GetDlgCtrlID()==IDC_COLUMNUP_BTNFAIL)
				{
					OnColumnupBtnfail();
				}
				else if(pWnd->GetDlgCtrlID()==IDC_BTNCANCEL_RINFO)
				{
					OnBtncancelRinfo();
				}
				else
				{
					NextDlgCtrl();
					return true;
				}
            }   
       }    

	
	return CDialog::PreTranslateMessage(pMsg);
}

void CAuditColumUpDlg::OnButtonPlay() 
{
	// TODO: Add your control notification handler code here
	CNews News;
	News.GetData(NewsID);
	CString cIPStr,cFilePath,cWebPath;
	cIPStr=News.GetIPStr();
	cFilePath=News.GetFilePath();

	cFilePath.Replace(":","_web");
	cFilePath.Replace("\\","//");
	cWebPath="http://"+cIPStr+"//"+cFilePath;

	m_wmplayer.openPlayer(cWebPath);////////////////////////////////////////
	
}

⌨️ 快捷键说明

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