//更新分类栏信息 public bool EditBBSCatalog(BBSCatalog BBSCatalog) { // @catalog_id int, : 分栏ID // @catalog_name varchar(300), : 分栏名称 // @catalog_description varchar(300) : 分栏介绍 // 给存储过程传递参数 Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@catalog_id", SqlDbType.Int, 4, BBSCatalog.CatalogID), data.MakeInParam("@catalog_name", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@catalog_description", SqlDbType.VarChar, 300, BBSCatalog.CatalogDescription), }; try { data.RunProc("sp_BBS_UpdateCatalogInfo", prams); return(true); } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("BBS类别编缉错误!", ex); } }
private void cmdOK_ServerClick(object sender, System.EventArgs e) { if (m_Action == "AddCatalog" ) { //�������� BBSClass BBS = new BBSClass(); BBSCatalog Catalog = new BBSCatalog(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = Server.UrlDecode(Request.Cookies["UserName"].Value); //try { Catalog.CatalogName = TxtCatalogName.Value; Catalog.CatalogDescription = TxtCatalogDescription.Value; BBS.AddBBSCatalog(Catalog); Server.Transfer("Catalog.aspx?classID="+classid); } //catch (Exception ex) { // UDS.Components.Error.Log(ex.ToString()); // Server.Transfer("../../Error.aspx"); } //finally { BBS = null; Catalog = null; } } else if (m_Action == "ModifyCatalog") { //�༩��� BBSClass BBS = new BBSClass(); BBSCatalog Catalog = new BBSCatalog(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = Server.UrlDecode(Request.Cookies["UserName"].Value); //try { Catalog.CatalogID = Int32.Parse(m_CatalogID); Catalog.CatalogName = this.TxtCatalogName.Value; Catalog.CatalogDescription = this.TxtCatalogDescription.Value; BBS.EditBBSCatalog (Catalog); Server.Transfer("Catalog.aspx?classID="+classid); } //catch (Exception ex) { // UDS.Components.Error.Log(ex.ToString()); // Server.Transfer("../../Error.aspx"); } //finally { BBS = null; Catalog = null; } } }
private void cmdOK_ServerClick(object sender, System.EventArgs e) { if (m_Action == "AddCatalog") { //新增分类 BBSClass BBS = new BBSClass(); BBSCatalog Catalog = new BBSCatalog(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = UserCookie.Value.ToString(); //try { Catalog.CatalogName = TxtCatalogName.Value; Catalog.CatalogDescription = TxtCatalogDescription.Value; BBS.AddBBSCatalog(Catalog); Server.Transfer("Catalog.aspx?classID=" + classid); } //catch (Exception ex) { // UDS.Components.Error.Log(ex.ToString()); // Server.Transfer("../../Error.aspx"); } //finally { BBS = null; Catalog = null; } } else if (m_Action == "ModifyCatalog") { //编缉类别 BBSClass BBS = new BBSClass(); BBSCatalog Catalog = new BBSCatalog(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = UserCookie.Value.ToString(); //try { Catalog.CatalogID = Int32.Parse(m_CatalogID); Catalog.CatalogName = this.TxtCatalogName.Value; Catalog.CatalogDescription = this.TxtCatalogDescription.Value; BBS.EditBBSCatalog(Catalog); Server.Transfer("Catalog.aspx?classID=" + classid); } //catch (Exception ex) { // UDS.Components.Error.Log(ex.ToString()); // Server.Transfer("../../Error.aspx"); } //finally { BBS = null; Catalog = null; } } }
//string CatalogName,string CatalogDescription //��uds_bbs_catalog��,������¼ public bool AddBBSCatalog(BBSCatalog BBSCatalog) { //���� CatalogName ��ʾBBS�е�title , ���� CatalogDescription ��ʾBBS�е�content //���洢���̴��ݲ��� Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@content", SqlDbType.NText, 16, BBSCatalog.CatalogDescription), }; data.RunProc ("sp_BBS_AddCatalog",prams); return true; }
//给uds_bbs_catalog表,新增记录 public bool AddBBSCatalog(BBSCatalog BBSCatalog) //string CatalogName,string CatalogDescription { //参数 CatalogName 表示BBS中的title , 参数 CatalogDescription 表示BBS中的content //给存储过程传递参数 Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@content", SqlDbType.NText, 16, BBSCatalog.CatalogDescription), }; data.RunProc("sp_BBS_AddCatalog", prams); return(true); }
//string CatalogName,string CatalogDescription //给uds_bbs_catalog表,新增记录 public bool AddBBSCatalog(BBSCatalog BBSCatalog) { //参数 CatalogName 表示BBS中的title , 参数 CatalogDescription 表示BBS中的content //给存储过程传递参数 Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@content", SqlDbType.NText, 16, BBSCatalog.CatalogDescription), }; try { data.RunProc("sp_BBS_AddCatalog", prams); } finally { if (data != null) { data.Close(); data.Dispose(); } } return true; }
/// <summary> /// 显示数据 /// </summary> private void PopulateData() { #region 初始化数据 DataTable dataTable_catalog = new DataTable(); DataTable dataTable_board = new DataTable(); DataTable dataTable_boardmaster = new DataTable(); DataSet ds = new DataSet(); SqlDataReader dr_catalog = null; SqlDataReader dr_board = null; SqlDataReader dr_boardmaster = null; BBSClass bbsclass = new BBSClass(); BBSCatalog catalog = new BBSCatalog(); //分类 BBSBoard board = new BBSBoard(); //板块 BBSForumItem item = new BBSForumItem(); //贴子的信息 BBSBoardmaster master = new BBSBoardmaster(); //斑竹信息 BBSReplay replay = new BBSReplay(); //回复信息 #endregion //try //判断权限 Admin = bbsclass.AdminBBS(Username, Int32.Parse(classid)); ViewState["Admin"] = Admin; Bulletin = bbsclass.AdminSysBulletin(Username, Int32.Parse(classid)); ViewState["Bulletin"] = Bulletin; A1.Visible = Admin; //得到类别信息 dr_catalog = bbsclass.GetBBSCatalog(); if (Admin) { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "1"); Response.Cookies.Add(cookie); } else { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "0"); Response.Cookies.Add(cookie); } if (Bulletin) { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "1"); Response.Cookies.Add(cookie1); } else { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "0"); Response.Cookies.Add(cookie1); } dataTable_catalog = Tools.ConvertDataReaderToDataTable(dr_catalog); dataTable_catalog.TableName = "catalogTable"; ds.Tables.Add(dataTable_catalog); //得到板块信息 if (Admin) { dr_board = bbsclass.GetAllBBSBoard(); } else { dr_board = bbsclass.GetBBSBoard((string)Username); } dataTable_board = Tools.ConvertDataReaderToDataTable(dr_board); dataTable_board.TableName = "boardTable"; ds.Tables.Add(dataTable_board); //得到斑竹信息 dr_boardmaster = bbsclass.GetBoardMaster(); dataTable_boardmaster = Tools.ConvertDataReaderToDataTable(dr_boardmaster); dataTable_boardmaster.TableName = "boardmasterTable"; ds.Tables.Add(dataTable_boardmaster); //对子表进行数据绑定 ds.Relations.Add("catolog_board", ds.Tables["catalogTable"].Columns["catalog_id"], ds.Tables["boardTable"].Columns["catalog_id"], false); ds.Relations.Add("board_boardmaster", ds.Tables["boardTable"].Columns["board_id"], ds.Tables["boardmasterTable"].Columns["board_id"], false); rpt_catalog.DataSource = ds.Tables["catalogTable"].DefaultView; Page.DataBind(); }
//���·�������Ϣ public bool EditBBSCatalog(BBSCatalog BBSCatalog) { // @catalog_id int, : ����ID // @catalog_name varchar(300), : �������� // @catalog_description varchar(300) : �������� // ���洢���̴��ݲ��� Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@catalog_id", SqlDbType.Int, 4, BBSCatalog.CatalogID), data.MakeInParam("@catalog_name", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@catalog_description", SqlDbType.VarChar ,300, BBSCatalog.CatalogDescription), }; try { data.RunProc ("sp_BBS_UpdateCatalogInfo",prams); return true; } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("BBS���༩����!",ex); } }
/// <summary> /// ��ʾ���� /// </summary> private void PopulateData() { #region ��ʼ������ DataTable dataTable_catalog = new DataTable(); DataTable dataTable_board = new DataTable(); DataTable dataTable_boardmaster = new DataTable(); DataSet ds = new DataSet(); SqlDataReader dr_catalog = null; SqlDataReader dr_board = null; SqlDataReader dr_boardmaster = null; BBSClass bbsclass = new BBSClass(); BBSCatalog catalog = new BBSCatalog();//���� BBSBoard board = new BBSBoard();//��� BBSForumItem item = new BBSForumItem();//���ӵ���Ϣ BBSBoardmaster master = new BBSBoardmaster();//������Ϣ BBSReplay replay = new BBSReplay();//�ظ���Ϣ #endregion try { //try //�ж�Ȩ�� Admin = bbsclass.AdminBBS(Username, Int32.Parse(classid)); ViewState["Admin"] = Admin; Bulletin = bbsclass.AdminSysBulletin(Username, Int32.Parse(classid)); ViewState["Bulletin"] = Bulletin; A1.Visible = Admin; //�õ������Ϣ dr_catalog = bbsclass.GetBBSCatalog(); if (Admin) { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "1"); Response.Cookies.Add(cookie); } else { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "0"); Response.Cookies.Add(cookie); } if (Bulletin) { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "1"); Response.Cookies.Add(cookie1); } else { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "0"); Response.Cookies.Add(cookie1); } dataTable_catalog = Tools.ConvertDataReaderToDataTable(dr_catalog); dataTable_catalog.TableName = "catalogTable"; ds.Tables.Add(dataTable_catalog); //�õ������Ϣ if (Admin) dr_board = bbsclass.GetAllBBSBoard(); else dr_board = bbsclass.GetBBSBoard((string)Username); dataTable_board = Tools.ConvertDataReaderToDataTable(dr_board); dataTable_board.TableName = "boardTable"; ds.Tables.Add(dataTable_board); //�õ�������Ϣ dr_boardmaster = bbsclass.GetBoardMaster(); dataTable_boardmaster = Tools.ConvertDataReaderToDataTable(dr_boardmaster); dataTable_boardmaster.TableName = "boardmasterTable"; ds.Tables.Add(dataTable_boardmaster); //���ӱ�������ݰ� ds.Relations.Add("catolog_board", ds.Tables["catalogTable"].Columns["catalog_id"], ds.Tables["boardTable"].Columns["catalog_id"], false); ds.Relations.Add("board_boardmaster", ds.Tables["boardTable"].Columns["board_id"], ds.Tables["boardmasterTable"].Columns["board_id"], false); rpt_catalog.DataSource = ds.Tables["catalogTable"].DefaultView; Page.DataBind(); } finally { dr_board.Close(); dr_boardmaster.Close(); dr_catalog.Close(); } }
//更新分类栏信息 public bool EditBBSCatalog(BBSCatalog BBSCatalog) { // @catalog_id int, : 分栏ID // @catalog_name varchar(300), : 分栏名称 // @catalog_description varchar(300) : 分栏介绍 // 给存储过程传递参数 Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@catalog_id", SqlDbType.Int, 4, BBSCatalog.CatalogID), data.MakeInParam("@catalog_name", SqlDbType.VarChar, 300, BBSCatalog.CatalogName), data.MakeInParam("@catalog_description", SqlDbType.VarChar ,300, BBSCatalog.CatalogDescription), }; try { data.RunProc("sp_BBS_UpdateCatalogInfo", prams); return true; } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("BBS类别编缉错误!", ex); } finally { if (data != null) { data.Close(); data.Dispose(); } } }