protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(this.Request.QueryString["infoid"], out this.infoId))
            {
                this.Response.Write("<script>alert('参数错误!');</script>");
                this.Response.Write("<script>window.location = 'info_manager.aspx';</script>");
                return;
            }

            this.articleManager = new ArticleManager("EFConnectionString");
            this.article = this.articleManager.Get(this.infoId) as ArticleEntity;

            NodeManager nodeManager = new NodeManager("EFConnectionString");
            NodeEntity node = nodeManager.Get(this.article.NodeId);
            StringDictionary roles = (this.Master as AdminLayout).UserRoles;

            if (!nodeManager.CheckNodeRole(node, roles, ActionType.ManageInfo))
            {
                this.Response.Write("<script>alert('无权限!');</script>");
                this.Response.Write("<script>window.location = 'info_manager.aspx';</script>");
                return;
            }

            if (!this.IsPostBack)
            {
                this.title.Text = this.article.Title;
                this.content.Text = this.article.Content;
                this.source.Text = this.article.Source;
                this.image.Text = this.article.Image;
                this.link.Text = this.article.Link;
                this.isTop.Checked = this.article.IsTop;
                this.stateList.SelectedIndex = (int)this.article.State;
            }
        }
Esempio n. 2
0
        protected void addArticleButton_Click(object sender, EventArgs e)
        {
            ArticleEntity article = new ArticleEntity()
            {
                Title = this.title.Text,
                Content = this.content.Text,
                AuthorName = Membership.GetUser().UserName,
                Source = this.source.Text,
                Link = this.link.Text.Trim(),
                Image = this.image.Text.Trim(),
                NodeId = this.nodeId,
                FullNodeIds = node.FullIdsStringType
            };

            ArticleManager articleManager = new ArticleManager("EFConnectionString");
            articleManager.Add(article);

            this.Response.Write("<script>alert('添加文章成功!');</script>");
            this.Response.Write("<script>window.location = 'add_info.aspx';</script>");
        }
Esempio n. 3
0
 protected override InfoEntity GetInfo(int infoId)
 {
     ArticleManager articleManager = new ArticleManager(this.connectionStringName.Value);
     return articleManager.Get(infoId);
 }
Esempio n. 4
0
 protected override InfoEntity GetInfo(int infoId)
 {
     ArticleManager articleManager = new ArticleManager(this.connectionStringName.Value);
     return articleManager.Get(infoId);
 }
Esempio n. 5
0
        /// <summary>
        /// 获取文章信息集合。
        /// </summary>
        /// <param name="count">文章总数。</param>
        /// <returns>文章信息集合。</returns>
        protected override List <InfoEntity> GetInfos(out int count)
        {
            ArticleManager articleManger = new ArticleManager(this.ConnectionStringName);

            return(articleManger.GetByNodeId(this.NodeId, false, this.PageIndex, this.PageSize, out count));
        }
Esempio n. 6
0
 /// <summary>
 /// 获取文章信息集合。
 /// </summary>
 /// <param name="count">文章总数。</param>
 /// <returns>文章信息集合。</returns>
 protected override List<InfoEntity> GetInfos(out int count)
 {
     ArticleManager articleManger = new ArticleManager(this.ConnectionStringName);
     return articleManger.GetByNodeId(this.NodeId, false, this.PageIndex, this.PageSize, out count);
 }