|
@@ -176,12 +176,33 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach |
|
|
/// <returns></returns> |
|
|
/// <returns></returns> |
|
|
public void DeleteEntity(string keyValue) |
|
|
public void DeleteEntity(string keyValue) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var db = this.BaseRepository().BeginTrans(); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
this.BaseRepository().Delete<Eval_MainEntity>(t => t.VID == keyValue); |
|
|
|
|
|
|
|
|
var entity = this.BaseRepository().FindEntity<Eval_MainEntity>(x => x.VID == keyValue); |
|
|
|
|
|
if (entity != null) |
|
|
|
|
|
{ |
|
|
|
|
|
var questionList = this.BaseRepository().FindList<Eval_QuestionEntity>(x => x.VID == entity.VID); |
|
|
|
|
|
if (questionList.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in questionList) |
|
|
|
|
|
{ |
|
|
|
|
|
var qitemsList = this.BaseRepository().FindList<Eval_QuestionItemsEntity>(x => x.QID == item.QID); |
|
|
|
|
|
//删除答案 |
|
|
|
|
|
db.Delete(qitemsList.ToList()); |
|
|
|
|
|
} |
|
|
|
|
|
//删除问题 |
|
|
|
|
|
db.Delete(questionList.ToList()); |
|
|
|
|
|
} |
|
|
|
|
|
//删除问卷 |
|
|
|
|
|
db.Delete(entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
db.Commit(); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
|
|
|
db.Rollback(); |
|
|
if (ex is ExceptionEx) |
|
|
if (ex is ExceptionEx) |
|
|
{ |
|
|
{ |
|
|
throw; |
|
|
throw; |
|
|