/// <summary> /// 分组更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool PaperGroupUpd(PaperGroup model) { try { using (var conn = DbHelper.ResourceService()) { var p = new DynamicParameters(); p.Add("@GroupID", model.GroupID); p.Add("@Brief", model.Brief); p.Add("@Timelimit", model.Timelimit); conn.Execute("PaperGroup_Upd", p, commandType: CommandType.StoredProcedure); return(true); } } catch (Exception e) { return(false); } }
/// <summary> /// 新增试卷分组 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int PaperGroup_ADD(PaperGroup model) { try { using (var conn = DbHelper.ResourceService()) { var p = new DynamicParameters(); p.Add("@GroupID", dbType: DbType.Int32, direction: ParameterDirection.Output); p.Add("@PaperID", model.PaperID); p.Add("@GroupName", model.GroupName); p.Add("@Orde", model.Orde); p.Add("@Brief", model.Brief); p.Add("@Timelimit", model.Timelimit); conn.Execute("PaperGroup_ADD", p, commandType: CommandType.StoredProcedure); model.GroupID = p.Get <int>("GroupID"); return(model.GroupID); } } catch (Exception e) { return(0); } }
/// <summary> /// 线下作业 /// </summary> /// <param name="TestID">测试id</param> /// <param name="PaperName">试卷名称</param> /// <param name="OCID"></param> /// <param name="UserID">创建人id</param> /// <param name="content">内容</param> /// <param name="answer">答案</param> /// <returns></returns> public int Paper_OfflineTest_Edit(int TestID, string PaperName, int OCID, int UserID, string content, string answer, int PaperID) { ExerciseInfo model = new ExerciseInfo(); ExerciseCommon exerciseCommon = new ExerciseCommon(); Exercise exercise = new Exercise(); PaperGroup pg = new PaperGroup(); exercise.ExerciseID = 0; exercise.OCID = OCID; exercise.CourseID = 0; exercise.OwnerUserID = UserID; exercise.CreateUserID = UserID; exercise.ExerciseType = 10; exercise.ExerciseTypeName = "问答题"; exercise.Scope = 0; exercise.Diffcult = 0; exercise.ShareRange = 0; exercise.Keys = ""; exercise.Kens = ""; exercise.Conten = content; exercise.Analysis = ""; exercise.Answer = answer; exercise.ScorePoint = ""; exercise.ParentID = 0; exerciseCommon.ExerciseType = 10; exerciseCommon.ExerciseID = 0; exerciseCommon.exercise = exercise; model.exercisecommon = exerciseCommon; pg.GroupID = 0; pg.PaperID = PaperID; pg.GroupName = "第1部分"; pg.Orde = 1; pg.Brief = ""; pg.Timelimit = 0; int ExerciseID = Exercise_Writing_M_Edit(model); //线下作业,添加一个简答题。 int PaperGroupID = PaperDAL.PaperGroup_ADD(pg); //试卷添加分组。 PaperDAL.PaperExercise_ADD(PaperID, PaperGroupID, ExerciseID, 100, 1,0); //习题添加到试卷 return TestDAL.Paper_OfflineTest_Edit(TestID, PaperName, OCID, UserID, content, answer, PaperID); }
public bool PaperGroupUpd(PaperGroup model) { return(PaperDAL.PaperGroupUpd(model)); }
public int PaperGroup_ADD(PaperGroup model) { return(PaperDAL.PaperGroup_ADD(model)); }