DAL/ChosenService.cs

(完整代码) 1KB

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

namespace DAL
{
    public class ChosenService
    {
        //条件查询,显示对应登录学生的选课表
        public static List<LessonSelect> getList(student stu)
        {
            string sql = $"Select * from Lessoninfo l inner join LessonSelect ls on l.id=ls.id where ls.StudentNum='{stu.StudentNum}'";

            SqlDataReader dr = DBHelper.getData(sql);

            List<LessonSelect> list = new List<LessonSelect>();
            LessonSelect obj = null;
            while (dr.Read())
            {
                obj = new LessonSelect()
                {
                    id=dr.GetInt32(0),
                    LessonName = dr.GetString(1),
                    LessonCode = dr.GetInt32(2),
                    Teacher = dr.GetString(3),
                    LessonTime = dr.GetDateTime(4),
                    LessonPart = dr.GetString(5),
                    LessonNeed = dr.GetInt32(6),
                    LessonScore = dr.GetInt32(7),
                    LessonStart = dr.GetDateTime(8),
                    LessonEnd = dr.GetDateTime(9),
                    LessonState = dr.GetString(10),
                    TeacherNum=int.Parse(dr["TeacherNum"].ToString())
                };
                list.Add(obj);
            }
            dr.Close();
            return list;
        }
    }
}

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

AI 解读 AI

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

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