com.huiyou.Bll/ArticleService.cs

(开头部分) 1KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using com.huiyou.Dal;
using com.huiyou.Model;
using com.huiyou.Model.Tables;
using com.huiyou.Common;
using System.Data;

namespace com.huiyou.Bll
{
    public class ArticleService
    {
        public static Tb_Article GetById(int id)
        {
            string sql = "select * from Tb_Article where id=" + id;
            List<Tb_Article> rst = TableFactory.GetList<Tb_Article>(sql);
            if (rst.Count == 0) return null;

            return rst[0];
        }

        public static Tb_Article GetByTitle(string title)
        {
            string sql = "select * from Tb_Article where title='" + Util.SafeSQL(title) + "'";
            List<Tb_Article> rst = TableFactory.GetList<Tb_Article>(sql);
            if (rst.Count == 0) return null;

            return rst[0];
        }

        public static bool CreateArticle(Tb_Article article)
        {
            bool result = false;

            try
            {
                TableFactory.Add<Tb_Article>(article);
                result = true;
            }
            catch
            {
                result = false;
            }

            return result;
        }

        public static bool UpdateArticle(Tb_Article article)
        {
            bool result = false;

            try
            {
                TableFactory.Update<Tb_Article>(article);
                result = true;
            }
            catch
后面还有 8 行代码,购买后查看完整代码

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

AI 解读

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

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