private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { BBSClass bbsclass = new BBSClass(); //��ʾϵͳ���� SqlDataReader dr_sysbulletin = bbsclass.GetDeskTopBulletin(); string innerstring = ""; while(dr_sysbulletin.Read()) { innerstring += "<a href='../SubModule/UnitiveDocument/BBS/Display.aspx?BoardID="+dr_sysbulletin["board_id"].ToString()+"&ItemID="+dr_sysbulletin["item_id"].ToString()+"' target='_blank' title='"+dr_sysbulletin["content"].ToString()+"'>" + "aaa" + "</a><font size=2>(" + DateTime.Parse(dr_sysbulletin["send_time"].ToString()).ToString() + ") </font>"; } sys_bulletin.InnerHtml = innerstring; //��ʾʱ�� lbl_Hour.Text = DateTime.Now.Hour.ToString(); lbl_Minute.Text = DateTime.Now.Minute.ToString(); lbl_Second.Text = DateTime.Now.Second.ToString(); lbl_year.Text=DateTime.Now.Date.Year.ToString(); lbl_month.Text=DateTime.Now.Date.Month.ToString(); lbl_day.Text=DateTime.Now.Date.Day.ToString(); //��ʾ�����ڵĿ������� } }
public void ReviseModifyBoard() { SqlDataReader dataReader = null; BBSClass BBS = new BBSClass(); try { if (m_BoardID != "") { dataReader = BBS.GetModifyBBSBoard(Int32.Parse(m_BoardID)); dataReader.Read(); this.TxtBoardName.Text = dataReader["board_name"].ToString(); this.TxtBoardDescription.Text = dataReader["board_description"].ToString(); if (Convert.ToBoolean(dataReader["board_type"]) == true) { RdPublic.Checked = true; RdPrivate.Checked = false; } else { RdPrivate.Checked = true; RdPublic.Checked = false; } dataReader.Close(); BBS = null; dataReader = null; } } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
private void btn_out_Click(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); BBSBoardmember member = new BBSBoardmember(); try { //����listbox�õ�ѡ�еĵ���Աid for(int i=0;i<lbBoardMemberList.Items.Count;i++) { if(lbBoardMemberList.Items[i].Selected) { member.BoardID = boardid; member.StaffID = Int32.Parse(lbBoardMemberList.Items[i].Value); bbs.DeleteBoardMember(member); } } Response.Redirect("ManageBoardMember.aspx?BoardID="+boardid+"&ClassID="+classid); } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
/// <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"); } }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� if(!Page.IsPostBack) { itemid = (Request.QueryString["ItemID"]==null)?0:Int32.Parse(Request.QueryString["ItemID"].ToString()); ViewState["itemid"] = itemid; BBSClass bbsclass = new BBSClass(); try { ddlBoardList.DataSource = bbsclass.GetAllBoard(); ddlBoardList.DataTextField = "board_name"; ddlBoardList.DataValueField = "board_id"; ddlBoardList.DataBind(); } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } } else { itemid = Int32.Parse(ViewState["itemid"].ToString()); } }
public void ReviseModifyCatalog() { SqlDataReader dataReader = null; BBSClass BBS = new BBSClass(); try { if (m_CatalogID != "") { dataReader = BBS.GetModifyBBSCatalog(Int32.Parse(m_CatalogID)); dataReader.Read(); this.TxtCatalogName.Value = dataReader["catalog_name"].ToString(); this.TxtCatalogDescription.Value = dataReader["catalog_description"].ToString(); BBS = null; dataReader.Close(); dataReader = null; } } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } finally { if (dataReader != null) { dataReader.Close(); } } }
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; } } }
/// <summary> /// 上载文件 /// </summary> private string UploadAtt() { HtmlForm FrmCompose = (HtmlForm)this.Page.FindControl("Display"); UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); string FileName = ""; string Extension = ""; string SavedName = ""; string TotalSavedName = ""; try { if (System.IO.Directory.Exists(Server.MapPath(".") + "\\Attachment")) { for (int i = 0; i < FrmCompose.Controls.Count; i++) { if (FrmCompose.Controls [i].GetType().ToString() == "System.Web.UI.HtmlControls.HtmlInputFile") { HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.Controls[i])); if (hif.PostedFile.FileName.Trim() != "") { FileName = System.IO.Path.GetFileName(hif.PostedFile.FileName); Extension = System.IO.Path.GetExtension(hif.PostedFile.FileName); SavedName = bbs.InsertFile(FileName, Extension).ToString(); TotalSavedName += SavedName + Extension + ","; hif.PostedFile.SaveAs(Server.MapPath(".") + "\\Attachment\\" + SavedName + Extension); } hif = null; } } return(TotalSavedName); } else { System.IO.Directory.CreateDirectory(Server.MapPath(".") + "\\Attachment"); UploadAtt(); return(TotalSavedName); } } catch (Exception ioex) { UDS.Components.Error.Log(ioex.ToString()); Server.Transfer("../../../Error.aspx"); return(TotalSavedName); } }
public void DeleteBoard(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = Server.UrlDecode(Request.Cookies["UserName"].Value); try { bbs.DelBBSBoard(Int32.Parse(((LinkButton)sender).CommandArgument)); bbs = null; Response.Redirect("Catalog.aspx?classID=" + classid); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
protected void btndelcatalog_Click(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = Server.UrlDecode(Request.Cookies["UserName"].Value); try { bbs.DelBBSCatalog(Int32.Parse(((LinkButton)sender).CommandArgument)); bbs = null; Response.Redirect("Catalog.aspx?classID=" + classid); //Response.Write("<script language=javascript>alert('ɾ���ɹ�!');parent.location.reload();</script>"); } 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"); } }
private void cbx_DeskTop_CheckedChanged(object sender, System.EventArgs e) { UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); BBSForumItem item = new BBSForumItem(); item.ItemID = itemid; bbs.ReadBBSForumItemStruct(item); if (((CheckBox)sender).Checked) { item.DeskTop = true; } else { item.DeskTop = false; } bbs.ModBBSForumItem(item); }
private void cmdOK_ServerClick(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); BBSForumItem olditem = new BBSForumItem(); BBSForumItem newitem = new BBSForumItem(); olditem.ItemID = itemid; newitem.BoardID = Int32.Parse(ddlBoardList.SelectedItem.Value); try { bbs.MoveBoardItem(olditem,newitem); ddlBoardList.Visible = false; cmdOK.Visible = false; ltMessage.Visible = true; ltMessage.Text = "�ƶ��ɹ���"; } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
private void btn_in_Click(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); try { //����listbox�õ�ѡ�еĴ���Ϊ��������Աid for(int i=0;i<lbRemainStaffsList.Items.Count;i++) { if(lbRemainStaffsList.Items[i].Selected) { bbs.SetupBoardMember(boardid,Int32.Parse(lbRemainStaffsList.Items[i].Value)); } } Response.Redirect("ManageBoardMember.aspx?BoardID="+boardid+"&ClassID="+classid); } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� int itemid = (Request.QueryString["ItemID"]==null)?0:Int32.Parse(Request.QueryString["ItemID"].ToString()); int boardid = (Request.QueryString["BoardID"]==null)?0:Int32.Parse(Request.QueryString["BoardID"].ToString()); BBSClass bbs = new BBSClass(); BBSForumItem item = new BBSForumItem(); item.ItemID = itemid; try { item.DelAttachment(Server.MapPath(".")+"\\Attachment\\"); bbs.DelItem(item); Response.Write("<script>alert('ɾ���ɹ�');opener.location.reload();close();</script>"); } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
/// <summary> /// �����ļ� /// </summary> private string UploadAtt() { HtmlForm FrmCompose = (HtmlForm)this.Page.FindControl("NewItem"); UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); string FileName = ""; string Extension = ""; string SavedName = ""; string TotalSavedName = ""; try { if(System.IO.Directory.Exists(Server.MapPath(".")+"\\Attachment")) { for (int i=0;i<FrmCompose.Controls.Count;i++) { if(FrmCompose.Controls [i].GetType().ToString()=="System.Web.UI.HtmlControls.HtmlInputFile") { HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.Controls[i])); if(hif.PostedFile.FileName.Trim()!="") { FileName = System.IO .Path.GetFileName(hif.PostedFile.FileName); Extension = System.IO.Path.GetExtension(hif.PostedFile.FileName); SavedName = bbs.InsertFile(FileName,Extension).ToString(); TotalSavedName += SavedName + Extension + ","; hif.PostedFile.SaveAs(Server.MapPath(".")+"\\Attachment\\"+SavedName+Extension ); } hif=null; } } return(TotalSavedName); } else { System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\\Attachment"); UploadAtt(); return(TotalSavedName); } } catch(Exception ioex) { UDS.Components.Error.Log(ioex.ToString()); Server.Transfer("../../../Error.aspx"); return(TotalSavedName); } }
private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { cbx_sysbulletin.Attributes["onclick"] = "sysbulletin_click();"; username = (Request.Cookies["Username"].Value); boardid = (Request.QueryString["BoardID"]==null)?"0":Request.QueryString["BoardID"]; UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); isboardmaster = bbs.IsBoardMaster(Int32.Parse(boardid),username); cbx_bulletin.Visible = isboardmaster; //�����˽�а�����������ϵͳ���� bool privateboard = false; SqlDataReader dr_board = bbs.GetModifyBBSBoard(Int32.Parse(boardid)); while(dr_board.Read()) { if(Boolean.Parse(dr_board["board_type"].ToString())==false) privateboard = true; } dr_board.Close(); if(Request.Cookies["UDSBBSAdmin"].Value=="0") { isadmin = false; } else if(Request.Cookies["UDSBBSAdmin"].Value=="1") { isadmin = true; } if(Request.Cookies["UDSBBSBulletinAdmin"].Value=="0") { isbulletinadmin = false; } else if(Request.Cookies["UDSBBSBulletinAdmin"].Value=="1") { isbulletinadmin = true; } if(isadmin && !privateboard) { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = true; } else if(isbulletinadmin && !privateboard) { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = true; } else { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = false; } ViewState["username"] = username; ViewState["boardid"] = boardid; ViewState["isboardmaster"] = isboardmaster; ViewState["isadmin"] = isadmin; ViewState["isbulletinadmin"] = isbulletinadmin; } else { username = ViewState["username"].ToString(); boardid = ViewState["boardid"].ToString(); isboardmaster = Boolean.Parse(ViewState["isboardmaster"].ToString()); isadmin = Boolean.Parse(ViewState["isadmin"].ToString()); isbulletinadmin = Boolean.Parse(ViewState["isbulletinadmin"].ToString()); } }
private void cmdOK_ServerClick(object sender, System.EventArgs e) { BBSClass bbs = new BBSClass(); BBSForumItem item = new BBSForumItem(); string itemcontent = ViewState["Content"] + Content.Value; item.BoardID = Int32.Parse(boardid); item.Title = MyTitle.Value.Replace("<","<"); item.Title = item.Title.Replace(">",">"); if(item.Title.Trim()=="") item.Title = "�ޱ���"; item.Content = itemcontent.Replace("<","<"); item.Content = item.Content.Replace(">",">"); item.Sender = username; item.IP = Request.ServerVariables["remote_addr"].ToString(); item.Bulletin = (cbx_bulletin==null)?false:cbx_bulletin.Checked; item.SysBulletin = (cbx_bulletin==null)?false:cbx_sysbulletin.Checked; item.DeskTop = (cbx_DeskTop==null)?false:cbx_DeskTop.Checked; item.ItemID = bbs.SendItem(item); if(ViewState["filename"]!=null && ViewState["filename"].ToString().Trim()!="") item.Attach(ViewState["filename"].ToString()); try { Response.Write("<script>if(opener!=null) {opener.location.reload();opener.parent.parent.header.location.reload();location.href='Display.aspx?ItemID="+item.ItemID.ToString()+"&BoardID="+item.BoardID.ToString()+"'}</script>"); } catch(Exception ex) { UDS.Components.Error.Log(ex.Message); Server.Transfer("../../Error.aspx"); } }
private void BindData() { BBSClass bbs = new BBSClass(); BBSForumItem item = new BBSForumItem(); Database db = new Database(); SqlDataReader dr = null; try { item.ItemID = itemid; dr = bbs.ReadBBSForumItemReplay(item); replaylist.DataSource = dr; replaylist.DataBind(); lbx_AttList.Items.Clear(); } finally { if (dr != null) { dr.Close(); } } }
/// <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(); } }
private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { username = Request.Cookies["Username"].Value; itemid = (Request.QueryString["ItemID"]==null)?0:Int32.Parse(Request.QueryString["ItemID"].ToString()); boardid = (Request.QueryString["BoardID"]==null)?0:Int32.Parse(Request.QueryString["BoardID"].ToString()); ViewState["username"] = username; ViewState["itemid"] = itemid; ViewState["boardid"] = boardid; ViewState["isboardmaster"] = isboardmaster; BBSClass bbsclass = new BBSClass(); BBSForumItem bbsforumitem = new BBSForumItem(); bbsforumitem.ItemID = itemid; SqlDataReader dr = null; dr = bbsclass.ReadBBSForumItem(bbsforumitem); //�ж��Ƿ��ǰ��� isboardmaster = bbsclass.IsBoardMaster(boardid,username); if(isboardmaster) cbx_boardBulletin.Visible = true; else cbx_boardBulletin.Visible = false; if(Request.Cookies["UDSBBSAdmin"]!=null) { if(Request.Cookies["UDSBBSAdmin"].Value=="1") cbx_sysBulletin.Visible = true; else cbx_sysBulletin.Visible = false; } else { cbx_sysBulletin.Visible = false; cbx_sysBulletin.Visible = false; } while(dr.Read()) { this.title = lblTitle.Text = dr["title"].ToString(); sendtime.Text = dr["send_time"].ToString(); browsetime.Text = dr["hit_times"].ToString(); replaytimes.Text = dr["replay_times"].ToString(); sendman.Text = dr["sender"].ToString(); //�ж��Ƿ���ϵͳ���棬�����ֻ�й���Ա�ܹ����� if(Boolean.Parse(dr["sysbulletin"].ToString())) { if(Request.Cookies["UDSBBSAdmin"]!=null) { if(Request.Cookies["UDSBBSAdmin"].Value=="1") { itemcontent.InnerHtml += "<b>�٣�����</b><a href=javascript:window.open('DeleteItem.aspx?ItemID=" + itemid + "&BoardID=" + boardid + "','_self','');>ɾ������</a>|<a href='MoveItem.aspx?ItemID=" + itemid + "'>�ƶ�����</a><br><hr color='#C0C0C0' size='1'>"; cbx_DeskTop.Visible = true; cbx_sysBulletin.Checked = true; if(Boolean.Parse(dr["DeskTop"].ToString())) { cbx_DeskTop.Checked = true; } else cbx_DeskTop.Checked = false; } else { cbx_sysBulletin.Checked = false; } } } else { if((Request.Cookies["UDSBBSAdmin"].Value=="1")||(isboardmaster)) { itemcontent.InnerHtml += "<b>�٣�����</b><a href=javascript:window.open('DeleteItem.aspx?ItemID=" + itemid + "&BoardID=" + boardid + "','_self','');>ɾ������</a>|<a href='MoveItem.aspx?ItemID=" + itemid + "'>�ƶ�����</a><br><hr color='#C0C0C0' size='1'>"; cbx_DeskTop.Visible = false; if(Boolean.Parse(dr["bulletin"].ToString())) { cbx_boardBulletin.Checked = true; } else { cbx_boardBulletin.Checked = false; } } } itemcontent.InnerHtml += FormatTxt(UBB.txtMessage(dr["content"].ToString())); } dr.Close(); BindData(); } else { username = ViewState["username"].ToString(); itemid = Int32.Parse(ViewState["itemid"].ToString()); boardid = Int32.Parse(ViewState["boardid"].ToString()); isboardmaster = Boolean.Parse(ViewState["isboardmaster"].ToString()); } }
private void cbx_sysBulletin_CheckedChanged(object sender, System.EventArgs e) { UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); BBSForumItem item = new BBSForumItem(); item.ItemID = itemid; bbs.ReadBBSForumItemStruct(item); if(((CheckBox)sender).Checked) { item.SysBulletin = true; } else { item.SysBulletin = false; item.DeskTop = false; cbx_DeskTop.Enabled = false; } bbs.ModBBSForumItem(item); }
private void BindData() { BBSClass bbs = new BBSClass(); BBSForumItem item = new BBSForumItem(); Database db = new Database(); SqlDataReader dr = null; item.ItemID = itemid; dr = bbs.ReadBBSForumItemReplay(item); replaylist.DataSource = dr; replaylist.DataBind(); dr.Close(); }
private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { cbx_sysbulletin.Attributes["onclick"] = "sysbulletin_click();"; username = (Request.Cookies["Username"].Value); boardid = (Request.QueryString["BoardID"] == null)?"0":Request.QueryString["BoardID"]; UDS.Components.BBSClass bbs = new UDS.Components.BBSClass(); isboardmaster = bbs.IsBoardMaster(Int32.Parse(boardid), username); cbx_bulletin.Visible = isboardmaster; //如果是私有板块则不允许发布系统公告 bool privateboard = false; SqlDataReader dr_board = bbs.GetModifyBBSBoard(Int32.Parse(boardid)); while (dr_board.Read()) { if (Boolean.Parse(dr_board["board_type"].ToString()) == false) { privateboard = true; } } dr_board.Close(); if (Request.Cookies["UDSBBSAdmin"].Value == "0") { isadmin = false; } else if (Request.Cookies["UDSBBSAdmin"].Value == "1") { isadmin = true; } if (Request.Cookies["UDSBBSBulletinAdmin"].Value == "0") { isbulletinadmin = false; } else if (Request.Cookies["UDSBBSBulletinAdmin"].Value == "1") { isbulletinadmin = true; } if (isadmin && !privateboard) { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = true; } else if (isbulletinadmin && !privateboard) { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = true; } else { cbx_sysbulletin.Visible = cbx_DeskTop.Visible = lbl_DeskTop.Visible = false; } ViewState["username"] = username; ViewState["boardid"] = boardid; ViewState["isboardmaster"] = isboardmaster; ViewState["isadmin"] = isadmin; ViewState["isbulletinadmin"] = isbulletinadmin; } else { username = ViewState["username"].ToString(); boardid = ViewState["boardid"].ToString(); isboardmaster = Boolean.Parse(ViewState["isboardmaster"].ToString()); isadmin = Boolean.Parse(ViewState["isadmin"].ToString()); isbulletinadmin = Boolean.Parse(ViewState["isbulletinadmin"].ToString()); } }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� if(!Page.IsPostBack) { string staffids = ""; boardid = (Request.QueryString["BoardID"]==null)?0:Convert.ToInt32(Request.QueryString["BoardID"]); classid = (Request.QueryString["classID"]==null)?0:Int32.Parse(Request.QueryString["classID"]); ViewState["boardid"] = boardid; ViewState["classid"] = classid; UDS.Components.Staff staff = new UDS.Components.Staff(); BBSClass bbs = new BBSClass(); SqlDataReader dr = null; SqlDataReader dr1 = null; DataTable dt = new DataTable(); try { dr = bbs.GetBoardMember(); dt = Tools.ConvertDataReaderToDataTable(dr); dt.DefaultView.RowFilter = "board_id=" + boardid; lbBoardMemberList.DataSource = dt.DefaultView; lbBoardMemberList.DataValueField = "staff_id"; lbBoardMemberList.DataTextField = "realname"; lbBoardMemberList.DataBind(); for (int i = 0; i < lbBoardMemberList.Items.Count; i++) { staffids += lbBoardMemberList.Items[i].Value + ","; } if (staffids.Length != 0) staffids = staffids.Substring(0, staffids.Length - 1); dr1 = staff.GetRemainStaff(staffids); lbRemainStaffsList.DataSource = dr1; lbRemainStaffsList.DataValueField = "staff_id"; lbRemainStaffsList.DataTextField = "realname"; lbRemainStaffsList.DataBind(); dr1.Close(); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } finally { if (dr1 != null) { dr1.Close(); } if (dr != null) { dr.Close(); } } } else { classid = Int32.Parse(ViewState["classid"].ToString()); boardid = Int32.Parse(ViewState["boardid"].ToString()); } HyperLink1.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { boardid = (Request.QueryString["BoardID"]==null)?0:Int32.Parse(Request.QueryString["BoardID"]); classid = (Request.QueryString["classID"]!=null && Request.QueryString["classID"]!="")?Request.QueryString["classID"].ToString():"0"; ViewState["boardid"] = boardid; ViewState["classid"] = classid; SqlDataReader dr = null; BBSClass bbsclass = new BBSClass(); dr = bbsclass.GetModifyBBSBoard(boardid); try { while (dr.Read()) { lblBoardName.Text = dr["board_name"].ToString(); } } finally { if (dr != null) { dr.Close(); } } BindGrid(); backlink.HRef = "Catalog.aspx?ClassID="+Request.QueryString["ClassID"]; } else { boardid = Int32.Parse(ViewState["boardid"].ToString()); classid = ViewState["classid"].ToString(); } }
private void BindGrid() { SqlDataReader dr = null; DataTable dt = new DataTable(); BBSClass bbsclass = new BBSClass(); BBSForumItem bbsforumitem = new BBSForumItem(); bbsforumitem.BoardID = boardid; try { dr = bbsclass.GetBBSForumItem(bbsforumitem); dt = Tools.ConvertDataReaderToDataTable(dr); //��DataTable��ĩβ���Ͽ��У�ʹ��DataGrid�̶����� int blankrows = ItemList.PageSize - (dt.Rows.Count % ItemList.PageSize); for (int i = 0; i < blankrows; i++) { dt.Rows.Add(dt.NewRow()); } ItemList.DataSource = dt.DefaultView; ItemList.DataBind(); string innerstring = ""; //��ʾ��鹫�� SqlDataReader dr_bulletin = bbsclass.GetBulletin(boardid); try { while (dr_bulletin.Read()) { innerstring += "<a href='display.aspx?ItemID=" + dr_bulletin["item_id"] + "&BoardID=" + boardid + "'title='" + dr_bulletin["content"] + "' target=_blank>" + dr_bulletin["title"].ToString() + "</a> (" + DateTime.Parse(dr_bulletin["send_time"].ToString()).ToString() + ") "; } } finally { dr_bulletin.Close(); } mar_bulletin.InnerHtml = innerstring; innerstring = ""; //��ʾϵͳ���� SqlDataReader dr_sysbulletin = bbsclass.GetSysBulletin(); try { while (dr_sysbulletin.Read()) { innerstring += "<a href='display.aspx?ItemID=" + dr_sysbulletin["item_id"] + "&BoardID=" + boardid + "'title='" + dr_sysbulletin["content"] + "' target=_blank>" + dr_sysbulletin["title"].ToString() + "</a>(" + DateTime.Parse(dr_sysbulletin["send_time"].ToString()).ToString() + ")"; } } finally { dr_sysbulletin.Close(); } sys_bulletin.InnerHtml = innerstring; //���ڿռ�¼����ʾͼƬ��������Ϣ for (int i = 0; i < ItemList.Items.Count; i++) { if (ItemList.DataKeys[i].ToString() == "") { ItemList.Items[i].FindControl("bias").Visible = false; ItemList.Items[i].FindControl("image").Visible = false; } } lbl_totalrecord.Text = ItemList.PageCount.ToString(); lbl_curpage.Text = txb_PageNo.Text = (ItemList.CurrentPageIndex + 1).ToString(); txb_ItemPerPage.Text = ItemList.PageSize.ToString(); lbl_totalpage.Text = ItemList.PageCount.ToString(); } catch (Exception ex) { UDS.Components.Error.Log(ex.Message); Server.Transfer("../../Error.aspx"); } finally { if (dr != null) { dr.Close(); } } }
private void CmdOK_Click(object sender, System.EventArgs e) { if (m_Action == "AddBoard" ) //������� { BBSClass BBS = new BBSClass(); BBSBoard Board = new BBSBoard(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = UserCookie.Value.ToString(); try { Board.CatalogID = Int32.Parse (m_CatalogID); Board.BoardName = this.TxtBoardName.Text; Board.BoardDescription = this.TxtBoardDescription.Text; if ( this.RdPublic.Checked == true ) { Board.BoardType = 1; } else { Board.BoardType = 0; } BBS.BBSAddBoard(Board); //Response.Write("<script language=javascript>alert('��ӳɹ�!');parent.location.reload();</script>"); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } finally { BBS = null; Board = null; Server.Transfer("Catalog.aspx?classID="+classid); } } else if ( m_Action == "ModifyBoard") { //�༩��� BBSClass BBS = new BBSClass(); BBSBoard Board = new BBSBoard(); HttpCookie UserCookie = Request.Cookies["Username"]; String Username = UserCookie.Value.ToString(); //try { Board.BoardID = Int32.Parse (m_BoardID); Board.BoardName = this.TxtBoardName.Text; Board.BoardDescription = this.TxtBoardDescription.Text; if ( this.RdPublic.Checked == true ) { Board.BoardType = 1; } else { Board.BoardType = 0; } BBS.EditBBSBoard (Board); Server.Transfer("Catalog.aspx?classID="+classid); } //catch (Exception ex) { // UDS.Components.Error.Log(ex.ToString()); // Server.Transfer("../../Error.aspx"); } //finally { BBS = null; Board = null; } } }