Example #1
0
        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");
            }
        }
Example #2
0
        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("<", "&lt");
            item.Title   = item.Title.Replace(">", "&gt");
            if (item.Title.Trim() == "")
            {
                item.Title = "无标题";
            }
            item.Content     = itemcontent.Replace("<", "&lt");
            item.Content     = item.Content.Replace(">", "&gt");
            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");
            }
        }
Example #3
0
        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");
            }
        }
Example #4
0
        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;
                }
            }
        }
Example #5
0
        /// <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();
        }
Example #6
0
        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);
                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() + ") ";
                }
                dr_bulletin.Close();
                mar_bulletin.InnerHtml = innerstring;

                innerstring = "";
                //显示系统公告
                SqlDataReader dr_sysbulletin = bbsclass.GetSysBulletin();
                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() + ")";
                }
                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");
            }
        }
Example #7
0
        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());
            }
        }