/// <summary> /// 删除附件 /// </summary> public void DelAttachment(string attachmentmd) { UDS.Components.Database data = new UDS.Components.Database(); //删除所有回复附件 //得到所有回复 UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); SqlDataReader dr1 = null; dr1 = bbs.ReadBBSForumItemReplay(this); while (dr1.Read()) { BBSReplay replay = new BBSReplay(); replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString()); replay.DelAttachment(attachmentmd); } //删除贴子本身附件 SqlParameter[] prams = { data.MakeInParam("@itemid", SqlDbType.Int, 4, this.ItemID), }; SqlDataReader dr = null; data.RunProc("sp_BBS_GetItemAttachment", prams, out dr); while (dr.Read()) { System.IO.File.Delete(attachmentmd + "\\" + dr["filename"].ToString()); } data.Close(); SqlParameter[] prams1 = { data.MakeInParam("@itemid", SqlDbType.Int, 4, this.ItemID), }; data.RunProc("sp_BBS_DelAttachmentToItem", prams1); }
private int itemid; //����ID #endregion Fields #region Methods protected void cmdOK_ServerClick(object sender, System.EventArgs e) { BBSClass bbsclass = new BBSClass(); BBSReplay replay = new BBSReplay(); string replaycontent = ViewState["Content"] + Content.Value; replay.ItemID = itemid; replay.Replayer = username; replay.ReplayIP = Request.ServerVariables["remote_addr"].ToString(); replay.Content = replaycontent.Replace("<","<"); replay.Content = replay.Content.Replace(">",">"); try { replay.ReplayId = bbsclass.ReplayItem(replay); if(ViewState["filename"]!=null && ViewState["filename"].ToString().Trim()!="") replay.Attach(ViewState["filename"].ToString()); BindData(); Content.Value = ""; ViewState["Content"] = ""; ViewState["filename"] = ""; } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
protected void cmdOK_ServerClick(object sender, System.EventArgs e) { BBSClass bbsclass = new BBSClass(); BBSReplay replay = new BBSReplay(); string replaycontent = ViewState["Content"] + Content.Value; replay.ItemID = itemid; replay.Replayer = username; replay.ReplayIP = Request.ServerVariables["remote_addr"].ToString(); replay.Content = replaycontent.Replace("<", "<"); replay.Content = replay.Content.Replace(">", ">"); try { replay.ReplayId = bbsclass.ReplayItem(replay); if (ViewState["filename"] != null && ViewState["filename"].ToString().Trim() != "") { replay.Attach(ViewState["filename"].ToString()); } BindData(); Content.Value = ""; ViewState["Content"] = ""; ViewState["filename"] = ""; } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
public void DelReplay(BBSReplay replay) { Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@replayid", SqlDbType.Int, 4, replay.ReplayId), data.MakeInParam("@itemid", SqlDbType.Int, 4, replay.ItemID) }; data.RunProc("sp_BBS_DeleteReplay", prams); }
protected void DelReplay(object sender,System.EventArgs e) { BBSClass bbsclass = new BBSClass(); BBSReplay replay = new BBSReplay(); replay.ReplayId = Int32.Parse(((LinkButton)sender).CommandArgument.ToString()); replay.ItemID = itemid; try { replay.DelAttachment(Server.MapPath(".")+"\\Attachment\\"); bbsclass.DelReplay(replay); BindData(); Content.Value = ""; } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
protected void DelReplay(object sender, System.EventArgs e) { BBSClass bbsclass = new BBSClass(); BBSReplay replay = new BBSReplay(); replay.ReplayId = Int32.Parse(((LinkButton)sender).CommandArgument.ToString()); replay.ItemID = itemid; try { replay.DelAttachment(Server.MapPath(".") + "\\Attachment\\"); bbsclass.DelReplay(replay); BindData(); Content.Value = ""; } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
public int ReplayItem(BBSReplay replay) { Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@item_id", SqlDbType.Int, 4, replay.ItemID), data.MakeInParam("@content", SqlDbType.NText, 5000, replay.Content), data.MakeInParam("@replayer", SqlDbType.VarChar, 300, replay.Replayer), data.MakeInParam("@replay_ip", SqlDbType.VarChar, 50, replay.ReplayId) }; try { return(data.RunProc("sp_BBSReplay", prams)); } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("回复出错!"); } }
/// <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 int ReplayItem(BBSReplay replay) { Database data = new Database (); SqlParameter[] prams = { data.MakeInParam("@item_id", SqlDbType.Int, 4, replay.ItemID), data.MakeInParam("@content", SqlDbType.NText,5000, replay.Content), data.MakeInParam("@replayer", SqlDbType.VarChar,300, replay.Replayer), data.MakeInParam("@replay_ip", SqlDbType.VarChar,50, replay.ReplayId) }; try { return(data.RunProc ("sp_BBSReplay",prams)); } catch (Exception ex) { Error.Log(ex.ToString ()); throw new Exception("�ظ������"); } }
public void DelReplay(BBSReplay replay) { Database data = new Database (); SqlParameter[] prams = { data.MakeInParam("@replayid", SqlDbType.Int, 4,replay.ReplayId), data.MakeInParam("@itemid",SqlDbType.Int,4,replay.ItemID) }; data.RunProc ("sp_BBS_DeleteReplay",prams); }
/// <summary> /// ɾ������ /// </summary> public void DelAttachment(string attachmentmd) { UDS.Components.Database data = new UDS.Components.Database (); //ɾ�����лظ����� //�õ����лظ� UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); SqlDataReader dr1 = null; dr1 = bbs.ReadBBSForumItemReplay(this); while(dr1.Read()) { BBSReplay replay = new BBSReplay(); replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString()); replay.DelAttachment(attachmentmd); } //ɾ�����ӱ������ SqlParameter[] prams = { data.MakeInParam("@itemid", SqlDbType.Int, 4,this.ItemID), }; SqlDataReader dr = null; data.RunProc ("sp_BBS_GetItemAttachment",prams,out dr); while(dr.Read()) { System.IO.File.Delete(attachmentmd+"\\"+dr["filename"].ToString()); } data.Close(); SqlParameter[] prams1 = { data.MakeInParam("@itemid", SqlDbType.Int, 4,this.ItemID), }; data.RunProc("sp_BBS_DelAttachmentToItem",prams1); }
/// <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 void DelReplay(BBSReplay replay) { Database data = new Database(); SqlParameter[] prams = { data.MakeInParam("@replayid", SqlDbType.Int, 4,replay.ReplayId), data.MakeInParam("@itemid",SqlDbType.Int,4,replay.ItemID) }; try { data.RunProc("sp_BBS_DeleteReplay", prams); } finally { if (data != null) { data.Close(); data.Dispose(); } } }
/// <summary> /// 删除附件 /// </summary> public void DelAttachment(string attachmentmd) { UDS.Components.Database data = new UDS.Components.Database(); try { //删除所有回复附件 //得到所有回复 UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); SqlDataReader dr1 = null; dr1 = bbs.ReadBBSForumItemReplay(this); try { while (dr1.Read()) { BBSReplay replay = new BBSReplay(); replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString()); replay.DelAttachment(attachmentmd); } } finally { dr1.Close(); dr1.Dispose(); } //删除贴子本身附件 SqlParameter[] prams = { data.MakeInParam("@itemid", SqlDbType.Int, 4,this.ItemID), }; SqlDataReader dr = null; try { data.RunProc("sp_BBS_GetItemAttachment", prams, out dr); while (dr.Read()) { System.IO.File.Delete(attachmentmd + "\\" + dr["filename"].ToString()); } } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } SqlParameter[] prams1 = { data.MakeInParam("@itemid", SqlDbType.Int, 4,this.ItemID), }; data.RunProc("sp_BBS_DelAttachmentToItem", prams1); } finally { if (data != null) { data.Close(); data.Dispose(); } } }