@@ -237,6 +237,14 @@ namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers | |||||
return Success("删除成功!"); | return Success("删除成功!"); | ||||
} | } | ||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult CleanForm(string VID) | |||||
{ | |||||
ask_MainIBLL.Clean(VID); | |||||
return Success("操作成功!"); | |||||
} | |||||
[HttpPost] | [HttpPost] | ||||
[AjaxOnly] | [AjaxOnly] | ||||
public ActionResult SubmitForm(string keyValue) | public ActionResult SubmitForm(string keyValue) | ||||
@@ -40,8 +40,9 @@ | |||||
</div> | </div> | ||||
<div class=" btn-group btn-group-sm" learun-authorize=""> | <div class=" btn-group btn-group-sm" learun-authorize=""> | ||||
<a id="lr_view" class="btn btn-default"><i class="fa fa-building-o"></i> 查看答卷</a> | <a id="lr_view" class="btn btn-default"><i class="fa fa-building-o"></i> 查看答卷</a> | ||||
</div> | </div> | ||||
<a id="lr_clean" class="btn btn-default"><i class="fa fa-building-o"></i> 清理重复数据</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="lr-layout-body" id="gridtable_stu"></div> | <div class="lr-layout-body" id="gridtable_stu"></div> | ||||
@@ -43,6 +43,11 @@ var bootstrap = function ($, learun) { | |||||
$('#lr_refresh').on('click', function () { | $('#lr_refresh').on('click', function () { | ||||
location.reload(); | location.reload(); | ||||
}); | }); | ||||
$('#lr_clean').on('click', function() { | |||||
learun.postForm(top.$.rootUrl + '/EvaluationTeach/Eval_Main/CleanForm', { VID: VID }, function () { | |||||
refreshGirdData(); | |||||
}); | |||||
}); | |||||
// 答题情况 | // 答题情况 | ||||
$('#lr_view').on('click', function () { | $('#lr_view').on('click', function () { | ||||
var keyValue = $('#gridtable_stu').jfGridValue('VID'); | var keyValue = $('#gridtable_stu').jfGridValue('VID'); | ||||
@@ -304,6 +304,26 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public void Clean(string vid) | |||||
{ | |||||
try | |||||
{ | |||||
ask_MainService.Clean(vid); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -75,5 +75,6 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach | |||||
IEnumerable<Eval_QuestionResultEntity> GetQuestionResultCount(string keyValue, string stuno, string EmpNo, | IEnumerable<Eval_QuestionResultEntity> GetQuestionResultCount(string keyValue, string stuno, string EmpNo, | ||||
string LessonNo); | string LessonNo); | ||||
void Clean(string vid); | |||||
} | } | ||||
} | } |
@@ -600,5 +600,60 @@ where 1=1 "); | |||||
} | } | ||||
} | } | ||||
public void Clean(string vid) | |||||
{ | |||||
try | |||||
{ | |||||
var misdbname = BaseRepository("CollegeMIS").getDbConnection().Database; | |||||
string sql = @" | |||||
select aa.LessonNo,aa.EmpNo,aa.VID,aa.StuNo,bb.IScore,bb.UID,cc.EmpName,aa.LessonName,ee.StuName | |||||
from | |||||
( | |||||
select a.LessonNo,a.LessonName,a.EmpNo,a.AcademicYearNo,a.Semester,b.VID,a.StuNo | |||||
from "+ misdbname + @".dbo.StuSelectLessonList a | |||||
left join Eval_Main b on a.AcademicYearNo=b.AcademicYearNo and a.Semester=b.Semester | |||||
where b.Status=1 and b.VID='"+ vid + @"' | |||||
and a.StuNo is not null and a.StuNo <> '' | |||||
and a.StuNo not in (select StuNo from " + misdbname + @".dbo.StuInfoBasic where ChangeStatus=1) | |||||
) aa | |||||
left join | |||||
( | |||||
select sum(b.IScore) as IScore, a.EmpNo, a.LessonNo, a.UID | |||||
from Eval_QuestionResult a | |||||
left join Eval_QuestionItems b on a.IID = b.IID | |||||
left join Eval_Question c on a.QID=c.QID | |||||
where c.VID='"+ vid + @"' | |||||
and a.EmpNo is not null and a.EmpNo <> '' and a.LessonNo is not null and a.LessonNo <> '' and a.UID is not null and a.UID <> '' | |||||
group by a.EmpNo, a.LessonNo, a.UID | |||||
) bb | |||||
on aa.EmpNo=bb.EmpNo and aa.LessonNo=bb.LessonNo and aa.StuNo=bb.UID | |||||
left join " + misdbname + @".dbo.EmpInfo cc on aa.EmpNo=cc.EmpNo | |||||
left join " + misdbname + @".dbo.StuInfoBasic ee on aa.StuNo = ee.StuNo | |||||
where 1=1 and iscore>100 order by IScore desc"; | |||||
var list= this.BaseRepository().FindList<Eval_QuestionResultEntity>(sql); | |||||
foreach (var item in list) | |||||
{ | |||||
var questionlist= this.BaseRepository().FindList<Eval_QuestionEntity>("select * from Eval_Question where vid='"+ vid + "'"); | |||||
foreach (var questionEntity in questionlist) | |||||
{ | |||||
string sql2 = @"select b.* from Eval_Question a left join Eval_QuestionResult b on a.QID=b.QID | |||||
where a.vid='"+ vid + "' and b.LessonNo='" + item.LessonNo + "'" + | |||||
" and b.EmpNo='" + item.EmpNo + "' and b.uid='" + item.StuNo + "' and b.qid='"+questionEntity.QID+"'"; | |||||
List<Eval_QuestionResultEntity> Eval_QuestionResultlist = this.BaseRepository().FindList<Eval_QuestionResultEntity>(sql2).ToList(); | |||||
for (int i = 0; i < Eval_QuestionResultlist.Count()-1; i++) | |||||
{ | |||||
string rid = Eval_QuestionResultlist[i].RID; | |||||
BaseRepository().Delete<Eval_QuestionResultEntity>(t=>t.RID== rid); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
Console.WriteLine(e); | |||||
throw; | |||||
} | |||||
} | |||||
} | } | ||||
} | } |