本文来源:网站建设-网站制作|网络营销专家慧云科技-抢滩登陆2009-7-17 17:27:18
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Aof.Quick;
using Aof.WebIntelli.Common;
using Aof.WebIntelli.Core;
//using BoyunBase;
public partial class ColumnOperate : System.Web.UI.Page
{
private string opType, siteName, colPath, newName, newTitle, colName, pagePath, ctrlId;
private ColumnManage columns;
protected void Page_Load( object sender, EventArgs e )
{
opType = NowRequest.Get( "optype", true );
siteName = NowRequest.Get( "sitename" );
try {
if( string.IsNullOrEmpty( opType ) || string.IsNullOrEmpty( siteName ) )
throw new Exception( "栏目操作出错,参数错误!" );
WebSite ws = SiteManage.Sites[siteName];
if( ws == null )
throw new Exception( "栏目操作出错,没有找到站点!" );
columns = ws.Columns;
colName = NowRequest.Get( "colname" );
colPath = NowRequest.Get( "path" );
newName = NowRequest.Get( "newname" );
newTitle = NowRequest.Get( "newtitle" );
bool isOK = false;
switch( opType ) {
case "addcolumn": // 添加 栏目
Column col = columns.CreateColumn( colPath, newName, newTitle );
if( col == null )
throw new Exception( "添加栏目失败,内部错误!" );
break;
case "addcolset": // 添加 栏目集
isOK = columns.CreateColumnSet( colPath, newName, newTitle );
if( !isOK ) throw new Exception( "添加栏目集失败,内部错误!" );
break;
case "rencolumn": // 重命名 栏目
isOK = columns.RenameColumn( colName, newTitle );
if( !isOK ) throw new Exception( "重命名栏目失败,内部错误!" );
break;
case "rencolset": // 重命名 栏目集
isOK = columns.RenameColumnSet( colPath, newTitle );
if( !isOK ) throw new Exception( "重命名栏目集失败,内部错误!" );
break;
case "delcolumn": // 删除 栏目
isOK = columns.DeleteColumn( colName );
if( !isOK ) throw new Exception( "删除栏目失败,内部错误!" );
break;
case "delcolset": // 删除 栏目集
isOK = columns.DeleteColumnSet( colPath );
if( !isOK ) throw new Exception( "删除栏目集失败,内部错误!" );
break;
case "bindaddcolumn": // 部件邦定栏目时,添加 栏目
pagePath = NowRequest.Get( "pagepath" );
ctrlId = NowRequest.Get( "ctrlid" );
CtrlBindColumn BindCol = new CtrlBindColumn( ws, pagePath, ctrlId );
Todo.DebugOut( "bindaddcolumn.NewColumn:colPath=" + colPath + " newName=" + newName + ", newTitle= " + newTitle + " pagePath=" + pagePath + " ctrlId=" + ctrlId );
BindCol.NewColumn( colPath, newName, newTitle );
Todo.DebugOut( "bindaddcolumn.NewColumn end" );
break;
}
Response.Write( "ok;" );
}
catch( InnerAppExp ex ) {
Response.Write( "error; " + ex.Output );
}
catch( Exception ex ) {
Response.Write( "error; " + ex.Message );
}
finally {
Response.End();
}
}
}