Song.Site/News.ashx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WeiSha.Common;
using Song.ServiceInterfaces;
using VTemplate.Engine;
namespace Song.Site
{
    /// <summary>
    /// News 的摘要说明
    /// </summary>
    public class News : BasePage
    {
        protected override void InitPageTemplate(HttpContext context)
        {
            //新闻列表
            Tag newsTag = this.Document.GetChildTagById("newslist");
            if (newsTag != null)
            {
                //每页多少条记录
                int newsSize = int.Parse(newsTag.Attributes.GetValue("size", "10"));
                //新闻栏目
                int columns = int.Parse(newsTag.Attributes.GetValue("columns", "-1"));
                //简介的输出长度
                int introlen = int.Parse(newsTag.Attributes.GetValue("introlen", "200"));
                int index = WeiSha.Common.Request.QueryString["index"].Int32 ?? 1;
                int sum = 0;
                Song.Entities.Article[] news = Business.Do<IContents>().ArticlePager(Organ.Org_ID, columns, true, "", newsSize, index, out sum);
                foreach (Song.Entities.Article art in news)
                {
                    art.Art_Logo = Upload.Get["News"].Virtual + art.Art_Logo;
                    if (string.IsNullOrWhiteSpace(art.Art_Intro))
                    {
                        art.Art_Intro = ReplaceHtmlTag(art.Art_Details, introlen);
                    }
                }
                this.Document.SetValue("newslist", news);
                //总页数
                int pageSum = (int)Math.Ceiling((double)sum / (double)newsSize);
                int[] pageAmount = new int[pageSum];
                for (int i = 0; i < pageAmount.Length; i++)
                    pageAmount[i] = i + 1;
                this.Document.SetValue("pageAmount", pageAmount);
                this.Document.SetValue("pageIndex", index);
            }
            //通知公告
            Tag noTag = this.Document.GetChildTagById("notice");
            if (noTag != null)
            {
                int noCount = int.Parse(noTag.Attributes.GetValue("count", "10"));
                Song.Entities.Notice[] notice = Business.Do<INotice>().GetCount(Organ.Org_ID, true, noCount);
                this.Document.SetValue("notice", notice);
            }
        }
        /// <summary>
        /// 去除HTML标签,并返回指定长度
        /// </summary>
        /// <param name="html"></param>
        /// <param name="length"></param>
后面还有 13 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。