using System; using System.Linq; namespace BLL { /// /// 考试记录 /// public static class TrainTestRecordService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取考试记录 /// /// /// public static Model.Training_TrainTestRecord GetTrainTestRecordById(string trainingTestRecordId) { return Funs.DB.Training_TrainTestRecord.FirstOrDefault(e => e.TrainingTestRecordId == trainingTestRecordId); } /// /// 新增考生记录信息 /// /// public static void AddTestRecord(Model.Training_TrainTestRecord testRecord) { Model.SGGLDB db = Funs.DB; Model.Training_TrainTestRecord newTestRecord = new Model.Training_TrainTestRecord { TrainingTestRecordId = testRecord.TrainingTestRecordId, ProjectId = testRecord.ProjectId, TrainingName = testRecord.TrainingName, TrainingType = testRecord.TrainingType, PeopleNum = testRecord.PeopleNum, UnitId = testRecord.UnitId, DateA = testRecord.DateA, DateZ = testRecord.DateZ, }; db.Training_TrainTestRecord.InsertOnSubmit(newTestRecord); db.SubmitChanges(); } /// /// 修改考试记录信息 /// /// public static void UpdateTrainTestRecord(Model.Training_TrainTestRecord testRecord) { Model.SGGLDB db = Funs.DB; Model.Training_TrainTestRecord newTestRecord = db.Training_TrainTestRecord.FirstOrDefault(e => e.TrainingTestRecordId == testRecord.TrainingTestRecordId); if (newTestRecord != null) { newTestRecord.TrainingName = testRecord.TrainingName; newTestRecord.TrainingType = testRecord.TrainingType; newTestRecord.PeopleNum = testRecord.PeopleNum; newTestRecord.UnitId = testRecord.UnitId; newTestRecord.DateA = testRecord.DateA; newTestRecord.DateZ = testRecord.DateZ; db.SubmitChanges(); } } /// /// 根据计划主键删除考试人员信息 /// /// public static void DeleteTrainTestRecordById(string TrainingTestRecordId) { var deleteRecords = Funs.DB.Training_TrainTestRecord.FirstOrDefault(x=> x.TrainingTestRecordId == TrainingTestRecordId) ; Funs.DB.Training_TrainTestRecord.DeleteOnSubmit(deleteRecords); Funs.DB.SubmitChanges(); } } }