C#无限栏目分级程序代码分享 好东西第1/3页

时间:2021-05-20

数据库表的结构必须有以下字段:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://ent.omeweb.com/book/admin/arti_ad/eWebEditor/UploadFile/200612278462542.gif');}" alt="" src="http://ent.omeweb.com/book/admin/arti_ad/eWebEditor/UploadFile/200612278462542.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
各个字段的说明:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://ent.omeweb.com/book/admin/arti_ad/eWebEditor/UploadFile/200612278595784.gif');}" alt="" src="http://ent.omeweb.com/book/admin/arti_ad/eWebEditor/UploadFile/200612278595784.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
3,本示例核心为idb.cs,db.cs和action.cs,分别说明下作用
idb.cs:数据库操作类的接口,代码如下:usingSystem;
usingSystem.Data;

namespacecatalog
{
///<summary>
///idb的摘要说明。
///</summary>
interfaceidb
{
//
//voidopen();构造函数当然不能在接口里声明

System.Data.IDbConnectiongetcon
{
get;
//set;
}

stringconstr
{
get;
}

System.Data.IDbCommandcommand(stringsql);

intexesql(stringsql);

objectgetvalue(stringsql);

voidclose();

DataTablegetdata(stringsql);

System.Data.IDataReadergetdr(stringsql);
}
}





db.cs实例这个接口:usingSystem;
usingSystem.Data;
usingSystem.Data.OleDb;
usingSystem.Data.SqlClient;
usingSystem.Configuration;
//usingSystem.Web;

namespacecatalog
{
///<summary>
///db的摘要说明。
///</summary>
publicclassdb:idb
{
privateIDbConnectioncon;
privateIDbCommandcm;
privatestringdbtype="access";

publicdb()
{
//
//TODO:在此处添加构造函数逻辑
//
dbtype=ConfigurationSettings.AppSettings["dbtype"];
if(dbtype==null)
dbtype="";
if(dbtype.ToLower()=="sqlserver")
{
con=newSqlConnection();
cm=newSqlCommand();
}
else
{
con=newOleDbConnection();
cm=newOleDbCommand();
}

stringcnstring=ConfigurationSettings.AppSettings["cnstr"];
con.ConnectionString=cnstring;

open();
cm.Connection=con;
}

publicdb(stringconstr)
{
//
//TODO:在此处添加构造函数逻辑
//
dbtype=ConfigurationSettings.AppSettings["dbtype"];
if(dbtype==null)
dbtype="";
if(dbtype.ToLower()=="sqlserver")
{
con=newSqlConnection();
cm=newSqlCommand();
}
else
{
con=newOleDbConnection();
cm=newOleDbCommand();
}

con.ConnectionString=constr;
open();
cm.Connection=con;
}

privatevoidopen()
{
con.Open();
}

publicSystem.Data.IDbConnectiongetcon
{
get{returncon;}
//set{};
}

publicintexesql(stringsql)
{
cm.CommandText=sql;
returncm.ExecuteNonQuery();
}

publicobjectgetvalue(stringsql)
{
cm.CommandText=sql;
//returncm.ExecuteScalar();
objecto=cm.ExecuteScalar();
returno;
}

publicvoidclose()
{
cm.Dispose();
con.Close();
con.Dispose();
con=null;
}

publicDataTablegetdata(stringsql)
{
DataTabledt=newDataTable();
if(dbtype.ToLower()=="sqlserver")
{
SqlDataAdapteradapter=newSqlDataAdapter();
cm.CommandText=sql;
adapter.SelectCommand=(SqlCommand)cm;
adapter.Fill(dt);
}
else
{
OleDbDataAdapteradapter=newOleDbDataAdapter();
cm.CommandText=sql;
adapter.SelectCommand=(OleDbCommand)cm;
adapter.Fill(dt);
}
returndt;
}

publicIDataReadergetdr(stringsql)
{
cm.CommandText=sql;
returncm.ExecuteReader();

}

publicstringconstr
{
get{returnConfigurationSettings.AppSettings["cnstr"];}
}

publicSystem.Data.IDbCommandcommand(stringsql)
{
cm.CommandText=sql;
returncm;
}
}
}
C#无限栏目分级程序代码分享[2]核心类说明

本程序采用C#为脚本编写,同时支持ACCESS/SQLSERVER数据库。
本程序功能:栏目无限分级,栏目的移动,添加,排序,删除(栏目树),操作方便,部署、使用更为简单,提供统一的接口程序。
本程序才开发完毕,难免有错误或者BUG,欢迎提出,不甚感激。

核心类文件方法调用说明
publicvoiddeleteAllCatalog(stringtable)//清空栏目表
publicintdownClass(stringtable,intclassid)//栏目向下移动一位
publicintupClass(stringtable,intclassid)//栏目向上移动一位
publicintmoveClass(stringtable,intclassid,inttarget)//栏目的移动
publicintdeleteTree(stringtable,intclassid)//删除栏目树
publicDataTablelist(stringtable)//用于列出栏目列表
publicintgetClassidOrderNum(stringtable,intclassid)//得到栏目的排序ID
publicboolcheckExist(stringtable,intclassid)//检查栏目是否存在
publicstringgetChildren(stringtable,intclassid)//列出一个栏目所有的子栏目
publicintmodiClass(stringtable,intclassid,stringclassname)//修改栏目
publicstringclassMap(stringtable,intclassid)//栏目导航,地图
publicstringgetClassName(stringtable,intclassid)//得到栏目名称
publicintreset(stringtable)//重新置位全部类别为一级栏目
publicintdeleteClass(stringtable,intclassid)//删除栏目
publicstaticvoiditemcreated(ObjectSender,System.Web.UI.WebControls.RepeaterItemEventArgse,stringctlname,stringctlname2)//列栏目的时候的repeater的事件
publicstaticstringgetOptions(stringtable,inttype,intselected)//用于select的options
publicobjectaddClass(stringtable,stringclassname,intparentid)//添加类别123下一页阅读全文

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章