Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
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());
            }
        }