diff --git a/BO/Views/croom/grade0.cshtml b/BO/Views/croom/grade0.cshtml index ae4f41c..caa959e 100644 --- a/BO/Views/croom/grade0.cshtml +++ b/BO/Views/croom/grade0.cshtml @@ -69,7 +69,7 @@     @if (Model.IsAdmin) { - 수료처리 + 수료확인 if (!ViewBag.IsSubAdmin96) { 강제수료처리 @@ -189,7 +189,7 @@ } function cbsave() { if (capResult.code == 1000) { - msgf(capResult.obj + "건을 수료 처리했습니다.", "submit('mform', 0, true)"); + msgf(capResult.obj.completecount + "건을 수료, " + capResult.obj.cancelcount + "건을 미수료 처리했습니다.", "submit('mform', 0, true)"); } else { msgdev(); } diff --git a/Base/Controller/ACommonCRoom.cs b/Base/Controller/ACommonCRoom.cs index 1df4f81..efb0874 100644 --- a/Base/Controller/ACommonCRoom.cs +++ b/Base/Controller/ACommonCRoom.cs @@ -392,18 +392,28 @@ namespace NP.Base.Controllers } lectnos = string.Join(",", Dao.Get("grade.nocompletelectcm", cmnos).Select(s => s.lectno)); } - var Lects2 = Dao.Get("grade.nocompletelect", lectnos).Where(w => w.iscomplete != 1 && lectnos.Contains(w.lectno.ToString())).ToList(); - if (Lects2.Count() > 0) + var lects = Dao.Get("grade.nocompletelect", lectnos).Where(w => lectnos.Contains(w.lectno.ToString())); + var completecount = 0; + var cancelcount = 0; + foreach (var lect in lects) { - lectnos = string.Join(",", Lects2.Select(s => s.lectno)); - var data2 = new Lect() { uno = SUserInfo.UserNo, uip = GetUserIP(), cmno = Convert.ToInt32(cmno), cmnos = cmnos, lectnos = lectnos }; - return JsonOK(Dao.Save("grade.lectcomplete2", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); + var ispass = Dao.Get("grade.ispass", new Hashtable() { { "lectno", lect.lectno } }).FirstOrDefault().ispass; + if (ispass == 1) + { + if (lect.iscomplete == 0) + { + completecount += Dao.Save("grade.lectcomplete2", new Hashtable() { { "lectno", lect.lectno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); + } + } + else + { + if (lect.iscomplete == 1) + { + cancelcount += Dao.Save("grade.lectcomplete.cancel", new Hashtable() { { "lectno", lect.lectno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); + } + } } - else - { - return JsonBack(new JsonRtn() { code = 1, msg = "이미 수료된 데이터는 다시 수료할 수 없습니다." }); - } - //return JsonOK(Dao.Save("grade.lectcomplete", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); + return JsonBack(new JsonRtn() { code = 1000, msg = "OK", obj = new { completecount , cancelcount } }); } [HttpPost] public JsonResult CMInningGetForOff(Int64 cmino) diff --git a/Dao/MyBatis/Maps/CRoom.xml b/Dao/MyBatis/Maps/CRoom.xml index 8b329dc..1819d38 100644 --- a/Dao/MyBatis/Maps/CRoom.xml +++ b/Dao/MyBatis/Maps/CRoom.xml @@ -1583,9 +1583,9 @@ ,birthday=HEX(AES_ENCRYPT(#birthday#, )) where userno=#userno#; - update lect - set - ,iscomplete=#iscomplete# + update lect + set + ,iscomplete=#iscomplete#,completetime=null ,sdate=#sdate# ,edate=#edate# where lectno=#lectno# and userno=#userno#; diff --git a/Dao/MyBatis/Maps/Grade.xml b/Dao/MyBatis/Maps/Grade.xml index 15cb434..63afe33 100644 --- a/Dao/MyBatis/Maps/Grade.xml +++ b/Dao/MyBatis/Maps/Grade.xml @@ -351,7 +351,7 @@ ,l.uip= #uip# ,l.iscomplete=1 ,l.completetime=b.completetime - ,l.completeno = b.completeno + ,l.completeno = case when l.completeno is not null then l.completeno else b.completeno end where l.lectno = b.lectno @@ -405,8 +405,8 @@ ,a.spoint=b.spoint ,a.dpoint=b.dpoint ,a.tpoint=b.apoint+b.mpoint+b.fpoint+b.spoint+b.dpoint - ,a.completetime = case when b.ispass = 1 then else null end - ,a.completeno = case when b.ispass = 1 then c.completeno else null end + ,a.completetime = case when b.ispass = 1 then c.completetime else null end + ,a.completeno = case when a.completeno is not null then a.completeno else case when b.ispass = 1 then c.completeno else null end end where a.status=1 and a.ischanged=0 and a.lectno = c.lectno and a.cmno = #cmno# @@ -414,6 +414,13 @@ and a.cmno in ($cmnos$) and a.lectno in ($lectnos$) + + update lect + set + ,iscomplete=0 + ,completetime=null + where lectno=#lectno# +