信息发布系统源代码.docx
《信息发布系统源代码.docx》由会员分享,可在线阅读,更多相关《信息发布系统源代码.docx(86页珍藏版)》请在冰豆网上搜索。
信息发布系统源代码
usingSystem;
usingSystem.Data;
usingFuYang.Web.Class.Business;
namespaceFuYang.Web.InfoPub.Business
{
///
///ClassPublishTree的摘要说明。
///
publicclassClassPublishTree
{
privateFunkeLab.MyTreeViewTreeView1;
privatestringtargetFrame="";
privatestringlinkUrl="";
publicClassPublishTree(FunkeLab.MyTreeViewMyTreeView)
{
//
//TODO:
在此处添加构造函数逻辑
//
TreeView1=MyTreeView;
FunkeLab.MyTreeView.ImagesFolder=FuYang.Config.ModuleConfig.GetSettings().ImagePath;
}
///
///显示树节点,Item.Remark=templateName,Item.OtherInfo=templateId
///
///
publicvoidShowNode(FunkeLab.MyTreeViewItemItem,DataTabledataTable)
{
if(dataTable.Rows.Count==0)
{
TreeView1.Items.Clear();
FunkeLab.MyTreeViewItemitem=newFunkeLab.MyTreeViewItem("栏目列表","","","");
item.Id=-1;
TreeView1.Items.Add(item);
return;
}
FunkeLab.MyTreeViewItemchildItem=null;
FunkeLab.MyTreeViewItemCollectionitemCollection=null;
if(Item==null)
{
TreeView1.Items.Clear();
itemCollection=TreeView1.Items;
}
else
{
if((Item.Items.Count!
=1)||(Item.Items[0].Id!
=-1))
{
return;
}
Item.Items.Clear();
itemCollection=Item.Items;
}
foreach(DataRowdataRowindataTable.Rows)
{
FunkeLab.MyTreeViewItemitem=newFunkeLab.MyTreeViewItem(dataRow["name"].ToString(),"","","");
item.Id=int.Parse(dataRow["id"].ToString());
item.Name=dataRow["name"].ToString();
item.Describe=dataRow["describe"].ToString();
item.Remark=dataRow["templateName"].ToString();
item.OtherInfo=(dataRow["templateId"].ToString()==""?
"-1":
dataRow["templateId"].ToString())+";"+(dataRow["docTemplateId"].ToString()==""?
"-1":
dataRow["docTemplateId"].ToString())+";"+(dataRow["classDeptId"].ToString()==""?
"-1":
dataRow["classDeptId"].ToString())+";";
item.Abbreviate=(dataRow["itemNumber"].ToString()==""?
"0":
dataRow["itemNumber"].ToString());
item.Enabled=(dataRow["enabled"].ToString()=="True"?
true:
false);
item.Value=dataRow["classType"].ToString();
//item.Image=(item.Enabled?
FunkeLab.MyTreeView.ImagesFolder+"Node_Enable.gif":
FunkeLab.MyTreeView.ImagesFolder+"Node_Disable.gif");
if(newClasses().GetChildClassesCountById(int.Parse(dataRow["id"].ToString()))>0)
{
childItem=newFunkeLab.MyTreeViewItem("","","","");
childItem.Id=-1;
item.Items.Add(childItem);
}
else
{
item.Selector=FunkeLab.MyTreeViewItem.SelectionMode.CheckBox;
}
itemCollection.Add(item);
}
}
///
///通过站点ID得到该站点所有栏目
///
publicboolGetClassBySiteId(intsiteId)
{
TreeView1.Items.Clear();
DataTabledataTable=newClasses().GetClassesBySiteId(siteId);
ShowNode(null,dataTable);
returntrue;
}
///
///判断当前节点是否叶节点.是:
返回1:
不是:
0;无选中节点:
-1
///
publicintisLeafNode()
{
if(System.Web.HttpContext.Current.Session["ClassId"]==null)
{
return-1;
}
intid=int.Parse(System.Web.HttpContext.Current.Session["ClassId"].ToString());
if(TreeView1.GetNodeById(id).Items.Count>0)
{
return0;
}
return1;
}
///
///设置targetFrame.Item请传为null
///
publicvoidSetTargetFrame(stringnewTargetFrame,stringnewLinkUrl,FunkeLab.MyTreeViewItemItem)
{
targetFrame=newTargetFrame;
linkUrl=newLinkUrl;
FunkeLab.MyTreeViewItemCollectionitemCollection;
if(Item==null)
{
itemCollection=TreeView1.Items;
}
else
{
itemCollection=Item.Items;
}
for(inti=0;i{
itemCollection[i].TargetFrame=targetFrame;
itemCollection[i].Link=newLinkUrl+"?
ClassId="+itemCollection[i].Id.ToString()+"';";
if(itemCollection[i].Items.Count>0)
SetTargetFrame(newTargetFrame,linkUrl,itemCollection[i]);
}
}
}
}
usingSystem;
usingSystem.Net;
usingSystem.IO;
usingSystem.Text;
usingSystem.Net.Sockets;
usingSystem.Diagnostics;
usingSystem.Runtime.Remoting;
usingSystem.Runtime.Remoting.Messaging;
/*
*FTPClientlibraryinC#
*Author:
JaimonMathew
*mailto:
***************************
*
*
*AddaptedforusebyDanGlass07/03/03
*/
namespaceFTPClient
{
publicclassFtpClient
{
publicclassFtpException:
Exception
{
publicFtpException(stringmessage):
base(message){}
publicFtpException(stringmessage,ExceptioninnerException):
base(message,innerException){}
}
privatestaticintBUFFER_SIZE=512;
privatestaticEncodingASCII=Encoding.ASCII;
privateboolverboseDebugging=false;
//defaults
privatestringserver="localhost";
privatestringremotePath=".";
privatestringusername="anonymous";
privatestringpassword="***********************";
privatestringmessage=null;
privatestringresult=null;
privateintport=21;
privateintbytes=0;
privateintresultCode=0;
privateboolloggedin=false;
privateboolbinMode=false;
privateByte[]buffer=newByte[BUFFER_SIZE];
privateSocketclientSocket=null;
privateinttimeoutSeconds=10;
///
///Defaultcontructor
///
publicFtpClient()
{
}
///
///
///
///
///
///
publicFtpClient(stringserver,stringusername,stringpassword)
{
this.server=server;
this.username=username;
this.password=password;
}
///
///
///
///
///
///
///
///
publicFtpClient(stringserver,stringusername,stringpassword,inttimeoutSeconds,intport)
{
this.server=server;
this.username=username;
this.password=password;
this.timeoutSeconds=timeoutSeconds;
this.port=port;
}
///
///Displayallcommunicationstothedebuglog
///
publicboolVerboseDebugging
{
get
{
returnthis.verboseDebugging;
}
set
{
this.verboseDebugging=value;
}
}
///
///Remoteserverport.TypicallyTCP21
///
publicintPort
{
get
{
returnthis.port;
}
set
{
this.port=value;
}
}
///
///Timeoutwaitingforaresponsefromserver,inseconds.
///
publicintTimeout
{
get
{
returnthis.timeoutSeconds;
}
set
{
this.timeoutSeconds=value;
}
}
///
///GetsandSetsthenameoftheFTPserver.
///
///
publicstringServer
{
get
{
returnthis.server;
}
set
{
this.server=value;
}
}
///
///GetsandSetstheportnumber.
///
///
publicintRemotePort
{
get
{
returnthis.port;
}
set
{
this.port=value;
}
}
///
///GetSandSetstheremotedirectory.
///
publicstringRemotePath
{
get
{
returnthis.remotePath;
}
set
{
this.remotePath=value;
}
}
///
///GetsandSetstheusername.
///
publicstringUsername
{
get
{
returnthis.username;
}
set
{
this.username=value;
}
}
///
///GetsandSetthepassword.
///
publicstringPassword
{
get
{
returnthis.password;
}
set
{
this.password=value;
}
}
///
///Ifthevalueofmodeistrue,setbinarymodefordownloads,else,Asciimode.
///
publicboolBinaryMode
{
get
{
returnthis.binMode;
}
set
{
if(this.binMode==value)return;
if(value)
sendCommand("TYPEI");
else
sendCommand("TYPEA");
if(this.resultCode!
=200)thrownewFtpException(result.Substring(4));
}
}
///
///Logintotheremoteserver.
///
publicvoidLogin()
{
if(this.loggedin)this.Close();
Debug.WriteLine("Openingconnectionto"+this.server,"FtpClient");
IPAddressaddr=null;
IPEndPointep=null;
try
{
this.clientSocket=newSocket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
addr=Dns.Resolve(this.server).AddressList[0];
ep=newIPEndPoint(addr,this.port);
this.clientSocket.Connect(ep);
}
catch(Exceptionex)
{
//doubtfull
if(this.clientSocket!
=null&&this.clientSocket.Connected)this.clientSocket.Close();
thrownewFtpException("Couldn'tconnecttoremoteserver",ex);
}
this.readResponse();
if(this.resultCode!
=220)
{
this.Close();
thrownewFtpException(this.result.Substring(4));
}
this.sendCommand("USER"+username);
if(!
(this.resultCode==331||this.resultCode==230))
{
this.cleanup();
thrownewFtpException(this.result.Substring(4));
}
if(this.resultCode!
=230)
{
this.sendCommand("PASS"+password);
if(!
(this.resultCode==230||this.resultCode==202))
{
this.cleanup();
thrownewFtpException(this.result.Substring(4));
}
}
this.loggedin=true;
Debug.WriteLine("Connectedto"+this.server,"FtpClient");
this.ChangeDir(this.remotePath);
}
///
///ClosetheFTPconnection.
///
publicvoi