/// <summary> /// 添加知识竞赛计划 /// </summary> /// <param name="TestPlan"></param> public static void AddTestPlan(Model.Test_TestPlan TestPlan) { Model.SUBHSSEDB db = Funs.DB; Model.Test_TestPlan newTestPlan = new Model.Test_TestPlan { TestPlanId = TestPlan.TestPlanId, PlanCode = TestPlan.PlanCode, PlanName = TestPlan.PlanName, PlanManId = TestPlan.PlanManId, PlanDate = TestPlan.PlanDate, TestStartTime = TestPlan.TestStartTime, TestEndTime = TestPlan.TestEndTime, Duration = TestPlan.Duration, TotalScore = TestPlan.TotalScore, QuestionCount = TestPlan.QuestionCount, TestPalce = TestPlan.TestPalce, QRCodeUrl = TestPlan.QRCodeUrl, SValue = TestPlan.SValue, MValue = TestPlan.MValue, JValue = TestPlan.JValue, States = TestPlan.States, }; db.Test_TestPlan.InsertOnSubmit(newTestPlan); db.SubmitChanges(); }
/// <summary> /// 根据主键删除知识竞赛计划 /// </summary> /// <param name="TestPlanId"></param> public static void DeleteTestPlanById(string TestPlanId) { Model.SUBHSSEDB db = Funs.DB; Model.Test_TestPlan TestPlan = db.Test_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlanId); if (TestPlan != null) { ///删除编码表记录 CodeRecordsService.DeleteCodeRecordsByDataId(TestPlan.TestPlanId); ////删除附件表 CommonService.DeleteAttachFileById(TestPlan.TestPlanId); ///删除题目类型 ServerTestPlanTrainingService.DeleteTestPlanTrainingByTestPlanId(TestPlan.TestPlanId); db.Test_TestPlan.DeleteOnSubmit(TestPlan); db.SubmitChanges(); } }
/// <summary> /// 修改知识竞赛计划 /// </summary> /// <param name="TestPlan"></param> public static void UpdateTestPlan(Model.Test_TestPlan TestPlan) { Model.SUBHSSEDB db = Funs.DB; Model.Test_TestPlan newTestPlan = db.Test_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlan.TestPlanId); if (newTestPlan != null) { newTestPlan.PlanCode = TestPlan.PlanCode; newTestPlan.PlanName = TestPlan.PlanName; newTestPlan.PlanManId = TestPlan.PlanManId; newTestPlan.PlanDate = TestPlan.PlanDate; newTestPlan.TestStartTime = TestPlan.TestStartTime; newTestPlan.TestEndTime = TestPlan.TestEndTime; newTestPlan.Duration = TestPlan.Duration; newTestPlan.TotalScore = TestPlan.TotalScore; newTestPlan.QuestionCount = TestPlan.QuestionCount; newTestPlan.TestPalce = TestPlan.TestPalce; newTestPlan.QRCodeUrl = TestPlan.QRCodeUrl; newTestPlan.SValue = TestPlan.SValue; newTestPlan.MValue = TestPlan.MValue; newTestPlan.JValue = TestPlan.JValue; newTestPlan.States = TestPlan.States; db.SubmitChanges(); } }