Example #1
0
        /// <summary>
        /// 【教师】保存学生成绩
        /// </summary>
        /// <param name="sc"></param>
        /// <returns></returns>
        public static int TSvaeStuScore(SelectClassInfo sc)
        {
            string sql = "Update SelectClassInfo set Grade1 = @Grade1 , Grade2 = @Grade2 , Grade3 = @Grade3 , Grade4 = @Grade4 , Grade = @Grade where StuNum = @stuNum and CourseNum = @CourseNum";

            SqlParameter[] param =
            {
                new SqlParameter("@Grade1",    sc.Grade1),
                new SqlParameter("@Grade2",    sc.Grade2),
                new SqlParameter("@Grade3",    sc.Grade3),
                new SqlParameter("@Grade4",    sc.Grade4),
                new SqlParameter("@Grade",     sc.Grade),
                new SqlParameter("@StuNum",    sc.StuNum),
                new SqlParameter("@CourseNum", sc.CourseNum)
            };

            return(SqlHelper.ExecuteNonQuery(sql, param));
        }
Example #2
0
        /// <summary>
        /// 【教师】获取学生成绩信息
        /// </summary>
        /// <param name="stuNum">学号</param>
        /// <param name="courseNum">课程号</param>
        /// <returns></returns>
        public static SelectClassInfo TGetStuScoreInfo(string stuNum, string courseNum)
        {
            string sql = "Select * from SelectClassInfo where StuNum = @StuNum and CourseNum = @CourseNum and DelFlag = 0";

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

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

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    #region
                    //平时成绩
                    if (dr["Grade1"] is DBNull)
                    {
                        sc.Grade1 = 0;
                    }
                    else
                    {
                        sc.Grade1 = Convert.ToInt32(dr["Grade1"]);
                    }

                    //期中成绩
                    if (dr["Grade2"] is DBNull)
                    {
                        sc.Grade2 = 0;
                    }
                    else
                    {
                        sc.Grade2 = Convert.ToInt32(dr["Grade2"]);
                    }

                    //实验成绩
                    if (dr["Grade3"] is DBNull)
                    {
                        sc.Grade3 = 0;
                    }
                    else
                    {
                        sc.Grade3 = Convert.ToInt32(dr["Grade3"]);
                    }

                    //期末成绩
                    if (dr["Grade4"] is DBNull)
                    {
                        sc.Grade4 = 0;
                    }
                    else
                    {
                        sc.Grade4 = Convert.ToInt32(dr["Grade4"]);
                    }

                    //总评成绩
                    if (dr["Grade"] is DBNull)
                    {
                        sc.Grade = 0;
                    }
                    else
                    {
                        sc.Grade = Convert.ToInt32(dr["Grade"]);
                    }

                    #endregion
                }
            }

            return(sc);
        }
Example #3
0
        }                                     //上课周数

        #endregion

        /// <summary>
        /// 获取学生的选课信息
        /// </summary>
        /// <param name="stuNum">学号</param>
        /// <returns>学生已选课信息表</returns>
        public static List <SelectClassInfo> GetStuSelectClassInfoByStuNum(string stuNum)
        {
            //string sql = "Select res.*,c.CourseName,c.Credit,c.CourseType,c.ClassDate,ClassTime,c.ClassRoom,c.CheckWay from( Select sc.*,t.TeacherName from SelectClassInfo as sc Left join TeacherInfo as t on sc.TeacherNum = t.TeacherNum where StuNum = @StuNum and sc.DelFlag = 0 and sc.State =@State and sc.IsEnd = 1 ) as res Left join CourseInfo as c on res.CourseNum = c.CourseNum ";
            //string sql = "Select res.*,c.CourseName,c.Credit,c.CourseType,c.ClassDate,ClassTime,c.ClassRoom,c.CheckWay from( Select sc.*,t.TeacherName from SelectClassInfo as sc Left join TeacherInfo as t on sc.TeacherNum = t.TeacherNum where StuNum = @StuNum and sc.DelFlag = 0 and sc.State =@State  ) as res Left join CourseInfo as c on res.CourseNum = c.CourseNum and c.IsEnd = 1";
            string sql = "select *,t.TeacherName from( Select s.*,c.CourseName,c.Credit,c.CourseType,c.ClassDate,ClassTime,c.ClassRoom,c.CheckWay  from SelectClassInfo as s,CourseInfo c where s.StuNum=@StuNum and s.CourseNum = c.CourseNum and c.IsEnd = 1 and s.DelFlag = 0 and s.State = @State) as res Left join TeacherInfo as t on res.TeacherNum = t.TeacherName";

            SqlParameter[] param =
            {
                new SqlParameter("@StuNum", stuNum),
                new SqlParameter("@State",  "正常")
            };

            List <SelectClassInfo> list = new List <SelectClassInfo>();
            DataTable dt = new DataTable();



            dt = SqlHelper.ExecuteTable(sql, param);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    SelectClassInfo sc = new SelectClassInfo();
                    #region 课程信息填装
                    //课程编号
                    if (dr["CourseNum"] is DBNull)
                    {
                        sc.CourseNum = "";
                    }
                    else
                    {
                        sc.CourseNum = dr["CourseNum"].ToString();
                    }

                    //学号
                    if (dr["StuNum"] is DBNull)
                    {
                        sc.StuNum = "";
                    }
                    else
                    {
                        sc.StuNum = dr["StuNum"].ToString();
                    }

                    //教师编号
                    if (dr["TeacherNum"] is DBNull)
                    {
                        sc.TeacherNum = "";
                    }
                    else
                    {
                        sc.TeacherNum = dr["TeacherNum"].ToString();
                    }

                    //教师名字
                    if (dr["TeacherName"] is DBNull)
                    {
                        sc.TeacherName = "";
                    }
                    else
                    {
                        sc.TeacherName = dr["TeacherName"].ToString();
                    }

                    //成绩信息暂时不读取

                    //备注
                    if (dr["Remark"] is DBNull)
                    {
                        sc.Remark = "";
                    }
                    else
                    {
                        sc.Remark = dr["Remark"].ToString();
                    }

                    if (dr["CourseName"] is DBNull)
                    {
                        sc.CourseName = "";
                    }
                    else
                    {
                        sc.CourseName = dr["CourseName"].ToString();
                    }

                    if (dr["CourseType"] is DBNull)
                    {
                        sc.CourseType = "";
                    }
                    else
                    {
                        sc.CourseType = dr["CourseType"].ToString();
                    }

                    if (dr["CheckWay"] is DBNull)
                    {
                        sc.CheckWay = "";
                    }
                    else
                    {
                        sc.CheckWay = dr["CheckWay"].ToString();
                    }

                    if (dr["Credit"] is DBNull)
                    {
                        sc.Credit = 0;
                    }
                    else
                    {
                        sc.Credit = Convert.ToInt32(dr["Credit"]);
                    }

                    //Count, SelectCount

                    if (dr["ClassDate"] is DBNull)
                    {
                        sc.ClassDate = "";
                    }
                    else
                    {
                        string str = dr["ClassDate"].ToString();
                        sc.LearnWeeks  = str.Substring(10, 2) + " - ";
                        str            = str.Substring(12, 2);
                        sc.LearnWeeks += str;
                    }

                    if (dr["ClassTime"] is DBNull)
                    {
                        sc.ClassTime = "";
                    }
                    else
                    {
                        sc.ClassTime = dr["ClassTime"].ToString();
                    }

                    if (dr["ClassRoom"] is DBNull)
                    {
                        sc.ClassRoom = "";
                    }
                    else
                    {
                        sc.ClassRoom = dr["ClassRoom"].ToString();
                    }
                    #endregion
                    list.Add(sc);
                }
            }

            return(list);
        }