Ejemplo n.º 1
0
        /// <summary>
        /// 获取【某个教师】提交的【课程信息】
        /// </summary>
        /// <param name="teacherNum">教师编号</param>
        /// <returns></returns>
        public static List <CourseInfo> GetCourseInfoByTeacherNum(string teacherNum, string sql)
        {
            //string sql = "Select * from CourseInfo where TeacherNum = @TeacherNum and DelFlag = 0";

            SqlParameter[] param =
            {
                new SqlParameter("@TeacherNum", teacherNum)
            };

            List <CourseInfo> list = new List <CourseInfo>();

            DataTable dt = SqlHelper.ExecuteTable(sql, param);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    CourseInfo c = new CourseInfo();

                    c = c.DataRow_To_CourseInfo(dr);

                    list.Add(c);
                }
            }

            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 单个获取完整的【课程信息】
        /// </summary>
        /// <param name="courseNum">课程号</param>
        /// <param name="teacherNum">教师编号</param>
        /// <returns></returns>
        public static CourseInfo GetFullCourseInfoByCourseNumAndTeacherNum(string courseNum, string teacherNum)
        {
            string sql = "Select * from CourseInfo where CourseNum = @CourseNum and TeacherNum = @TeacherNum and DelFlag = 0";

            SqlParameter[] param =
            {
                new SqlParameter("@CourseNum",  courseNum),
                new SqlParameter("@TeacherNum", teacherNum)
            };

            DataTable  dt = SqlHelper.ExecuteTable(sql, param);
            CourseInfo c1 = new CourseInfo();

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];

                c1 = c1.DataRow_To_CourseInfo(dr);
            }

            return(c1);
        }