Ejemplo n.º 1
0
        public ActionResult EditCourseDetail(Course_TestRate model)
        {
            Course_DetailBLL bll = new Course_DetailBLL();

            if (bll.UpdateTestRate(model))
            {
                return Json(new { Result = true, Msg = "设定成功!" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { Result = false, Msg = "设定失败!" }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 2
0
 private void ConvertToTestRateModel(IDataReader reader, Course_TestRate model)
 {
     if (reader["TrainingId"] != DBNull.Value)
         model.TrainingId = Convert.ToInt32(reader["TrainingId"]);
     if (reader["ReadingRate"] != DBNull.Value)
         model.ReadingRate = Convert.ToDouble(reader["ReadingRate"]);
     if (reader["DisscusRate"] != DBNull.Value)
         model.DisscusRate = Convert.ToDouble(reader["DisscusRate"]);
     if (reader["HomeWorkRate"] != DBNull.Value)
         model.HomeWorkRate = Convert.ToDouble(reader["HomeWorkRate"]);
     if (reader["QuestionRate"] != DBNull.Value)
         model.QuestionRate = Convert.ToDouble(reader["QuestionRate"]);
     if (reader["TestingRate"] != DBNull.Value)
         model.TestingRate = Convert.ToDouble(reader["TestingRate"]);
     if (reader["CommentRate"] != DBNull.Value)
         model.CommentRate = Convert.ToDouble(reader["CommentRate"]);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 取得一条考核比例记录
 /// </summary>
 /// <param name="id"></param>
 /// <param name="where"></param>
 /// <returns></returns>
 public Course_TestRate GetTestRateModel(int TrainingId, string where)
 {
     string sql = "select * from [dbo].[Course_Detail] where [TrainingId]=@TrainingId";
     if (!string.IsNullOrEmpty(where))
         sql += " and " + where;
     SqlParameter[] cmdParams = new SqlParameter[]{
         new SqlParameter("@TrainingId", SqlDbType.Int, 4) { Value = TrainingId }
     };
     using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql, cmdParams))
     {
         if (reader.Read())
         {
             Course_TestRate model = new Course_TestRate();
             ConvertToTestRateModel(reader, model);
             return model;
         }
         else
         {
             return null;
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新一条考核比例记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int UpdateTestRate(Course_TestRate model)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("update [dbo].[Course_Detail] set ");
     sql.Append("[ReadingRate]=@ReadingRate,[DisscusRate]=@DisscusRate,[HomeWorkRate]=@HomeWorkRate,[QuestionRate]=@QuestionRate,[TestingRate]=@TestingRate,[CommentRate]=@CommentRate");
     sql.Append(" where [TrainingId]=@TrainingId");
     SqlParameter[] cmdParams = new SqlParameter[] {
         new SqlParameter("@TrainingId", SqlDbType.Int, 4) { Value = model.TrainingId },
         new SqlParameter("@ReadingRate", SqlDbType.Float, 8) { Value = model.ReadingRate },
         new SqlParameter("@DisscusRate", SqlDbType.Float, 8) { Value = model.DisscusRate },
         new SqlParameter("@HomeWorkRate", SqlDbType.Float, 8) { Value = model.HomeWorkRate },
         new SqlParameter("@QuestionRate", SqlDbType.Float, 8) { Value = model.QuestionRate },
         new SqlParameter("@TestingRate", SqlDbType.Float, 8) { Value = model.TestingRate },
         new SqlParameter("@CommentRate", SqlDbType.Float, 8) { Value = model.CommentRate }
     };
     return MSEntLibSqlHelper.ExecuteNonQueryBySql(sql.ToString(), cmdParams);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条考核比例记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateTestRate(Course_TestRate model)
 {
     return dal.UpdateTestRate(model) > 0;
 }