DAL/LearningDAL.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Data.SqlClient;
using System.Data;

namespace DAL
{
    public class LearningDAL
    {


        /// <summary>
        /// 添加 
        ///</summary>
        public static int AddLearning(Learning LearningModel)
        {
            string sql = string.Format("insert into  Learning (Title,Contents,EntryTime,UserId,ResourcesType,ProjectInfoId )values('{0}','{1}','{2}',{3},'{4}',{5})", LearningModel.Title, LearningModel.Contents.Replace("'", ""), LearningModel.EntryTime, LearningModel.UserId, LearningModel.ResourcesType,LearningModel.ProjectInfoId);
            return DBHelper.ExecuteCommand(sql);
        }

        /// <summary> 
        /// 根据ID修改 
        ///</summary>
        public static int UpdateLearning(Learning LearningModel)
        {
            string sql = string.Format(" UPDATE Learning  set Title='{0}',Contents='{1}',EntryTime='{2}',UserId={3},ResourcesType='{4}',ProjectInfoId={5} where LearningId={6} ", LearningModel.Title, LearningModel.Contents.Replace("'", ""), LearningModel.EntryTime, LearningModel.UserId, LearningModel.ResourcesType, LearningModel.ProjectInfoId, LearningModel.LearningId);
            return DBHelper.ExecuteCommand(sql);
        }

        /// <summary> 
        /// 根据主键删除 
        ///</summary>
        public static int DeleteLearning(int Id)
        {
            string sql = string.Format("delete from Learning where LearningId={0}", Id);
            return DBHelper.ExecuteCommand(sql);
        }

        /// <summary> 
        /// 查询条数 
        ///</summary>
        public static int CountNumber(string NewWHere)
        {
            string sql = "";
            if (!string.IsNullOrEmpty(NewWHere))
            {
                sql = "select count(*) from Learning where 1=1 " + NewWHere;
            }
            else
            {
                sql = "select count(*) from Learning";

            }
            return DBHelper.GetIntScalar(sql);
        }

        /// <summary>
后面还有 91 行代码,购买后查看完整代码

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

AI 解读 AI

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

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