Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetHyperLinkTitle(HyperLink_Title);
                SetHyperLinkArticle(HyperLink_Article);

                switch (g_Article_ClassID)
                {
                    case 1:
                        Banner.ImageUrl = "images/inside_a.jpg";
                        break;

                    case 2:
                        Banner.ImageUrl = "images/inside_f.jpg";
                        break;

                    case 3:
                        Banner.ImageUrl = "images/inside_f.jpg";
                        break;

                    default:
                        Banner.ImageUrl = "images/inside_a.jpg";
                        break;
                }

                BLL.Article b_Article = new BLL.Article();
                Entity.Article e_Article = b_Article.Select_Article(g_Article_ClassID, g_LanguageID);
                if (e_Article != null)
                {
                    Article_Content.InnerHtml = e_Article.Article_Content;
                }
            }
        }
Esempio n. 2
0
 public ActionResult Index()
 {
     BLL.Article bll = new Article();
     var list = bll.GetAll(1, 10);
     var model = from a in list
                 select new Models.IndexBlogs()
                 {
                     ArticleID = a.ArticleID,
                     ArticleBrief = a.ArticleContent.Length > 300 ?  a.ArticleContent.Substring(0, 300) + "...":a.ArticleContent,
                     ArticleTitle = a.ArticleTitle,
                     CreateDate = a.CreateDate,
                     IsTop = a.IsTop,
                     ReadNum = a.ReadNum,
                     ReplyNum = a.ArticleReplies.Count,
                     AuthorName = a.User.UserName
                 };
     return View(model);
 }
    private void newsBind()
    {
        Model.Article model = new BLL.Article().GetModelBystrWhere("ID=" + id + " and IsDelete=0 and IsPass=1 ");
        if (model == null)
        {
            MessageBox.ShowRedirect("参数错误!", "/cn/news");
        }
        lit_Contents.Text = model.Contents;
        lit_AddTime.Text  = model.AddTime.Value.ToString("yyyy-MM-dd");
        lit_Sources.Text  = model.Sources;
        lit_Title.Text    = model.Title;
        lit_list.Text     = "<a href='Default.aspx?classid=" + model.ClassID.Value + "'>返回列表</a>";
        if (!String.IsNullOrEmpty(model.PageTitle))
        {
            this.Title = model.PageTitle;
        }
        if (!String.IsNullOrEmpty(model.Matedescription))
        {
            base.MateDescription = model.Matedescription;
        }
        if (!String.IsNullOrEmpty(model.Matekeyword))
        {
            base.MetaKeywords = model.Matekeyword;
        }
        NewsTypeBind(model);
        NewsTypeBind(model);
        List <Model.Article> nextlist = new DAL.Article().GetList(1, "ClassID=" + model.ClassID.Value + " and IsDelete=0 and IsPass=1 and ID >" + model.ID.Value + " and Sort>=" + model.Sort.Value, "Sort asc");

        if (nextlist != null && nextlist.Count > 0)
        {
            lit_NextNews.Text = "<span><a href=\"detail.aspx?id=" + nextlist[0].ID.Value + "\">下一页</a></span>";
        }
        List <Model.Article> prelist = new DAL.Article().GetList(1, "ClassID=" + model.ClassID.Value + " and IsDelete=0 and IsPass=1 and ID <" + model.ID.Value + " and Sort<=" + model.Sort.Value, "Sort asc");

        if (prelist != null && prelist.Count > 0)
        {
            lit_PreNews.Text = "<span><a href=\"detail.aspx?id=" + prelist[0].ID.Value + "\">上一页</a></span> &nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }
Esempio n. 4
0
 /// <summary>
 /// 删除文章数据
 /// </summary>
 /// <returns></returns>
 public static int DeleteArticle(Article obj)
 {
     return(Article_Service.DeleteArticle(obj));
 }
Esempio n. 5
0
 /// <summary>
 /// 修改文章数据
 /// </summary>
 /// <returns></returns>
 public static int UpdateArticle(Article obj)
 {
     return(Article_Service.UpdateArticle(obj));
 }
Esempio n. 6
0
 /// <summary>
 /// 添加文章数据
 /// </summary>
 /// <returns></returns>
 public static int InsertArticle(Article obj)
 {
     return(Article_Service.InsertArticle(obj));
 }