using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NP.Model; using NP.Base; using System.Collections; namespace NP.FO.Controllers { public class CDMSController : FOOpenBaseController { public ActionResult PlayTaste(VMCRoom vm) { vm.pseq = 1; vm.istaste = 1; vm.status = 1; vm.ErrLi = new Data() { }; if (vm.cmino < 1 && vm.ctno < 1) { vm.status = 0; } else if (vm.cmino > 0) { vm.CMInning = Dao.Get("cm.cminnings", new Hashtable() { { "cmino", vm.cmino } }).FirstOrDefault(); if (vm.CMInning == null || vm.CMInning.istaste != 1) { vm.status = 0; } else { vm.Pages = Dao.Get("cm.ctps", new Hashtable() { { "ctno", vm.CMInning.ctno } }).Where(w => w.pseq == 1).ToList(); if (Request.IsLocal) { foreach(var d in vm.Pages) { d.srcp = "/Files/test.mp4"; } } vm.Page = vm.Pages.Where(w => w.pseq == 1).First(); vm.lip = new LectInningPage() { }; } } else if (vm.ctno > 0) { //관리자에서 보려는 인증키확인 var ct = Dao.Get("common.authkey.check"+ vm.authtype, new Hashtable() { { "authkey", vm.authkey }, { "ctno", vm.ctno } }).FirstOrDefault(); if (ct != null) { vm.CMInning = new CMInning() { iseq = 1, ititle="미리보기", ismenu = ct.intval2, ctype = ct.intval3, ccode=ct.strval }; vm.Pages = Dao.Get("cm.ctps", new Hashtable() { { "ctno", vm.ctno } }); if (vm.cpno > 0) { vm.Page = vm.Pages.Where(w => w.cpno == vm.cpno).First(); vm.pseq = vm.Page.pseq; } else { vm.Page = vm.Pages.Where(w => w.pseq == 1).First(); } vm.lip = new LectInningPage() { }; } else { vm.status = 0; } } return View("ViewTaste",vm); } public ActionResult Play(VMCRoom vm) { var sd = Request.Url.Host.Split('.')[0]; if (GetConfig("isdevtest") != "1" && Request.Url.Host != "222.122.63.91" && Request.Url.Host != "cte.nptc.kr" && Request.Url.Host != "ynicte.nptc.kr" && Request.Url.Host != "phd.nptc.kr" && MainSubDomain.ToUpper() != sd.ToUpper()) { ViewBag.SiteTitle = Dao.Get("users.assignsite", new Hashtable() { { "subdomain", sd } }).First().asname; } vm.status = 0; vm.istaste = 0; vm = vm ?? new VMCRoom() { }; if (SUserInfo.UserNo > 0 && vm.cmino > 0 && vm.lectno > 0) { var data = Dao.Get("lect.lectinning.attcert.check", new Hashtable() { { "lectno", vm.lectno }, { "cmino", vm.cmino }, { "userno", SUserInfo.UserNo } }).FirstOrDefault(); //출석 인증 시만 보이게 제한 처리 (intval 회차, intval2 출석인증제외 회원, intval3 출석인증제외 강좌) if (data != null && (data.intval == 1 || data.intval2 == 1 || data.intval3 == 1)) { var todayLectinningCount = Dao.Get("cr.lectinnings", new Hashtable() { { "lectno", vm.lectno }, { "isfinishtoday", 1 } }).Count(); var lectInnings = Dao.Get("cr.cminnings", new Hashtable() { { "lectno", vm.lectno }, { "userno", SUserInfo.UserNo } }); foreach (var item in lectInnings) { item.daylectinninglimit = item.daylectinninglimit == 0 ? 9999 : item.daylectinninglimit; } var lectInning = lectInnings.Where(w => w.cmino == vm.cmino).FirstOrDefault(); //1일 신규 동영상 강의를 10차시로 제한 if (todayLectinningCount < lectInning.daylectinninglimit || lectInning.istatus == 2) { //이어보기를 위해 페이지관리 //vm.pseq = vm.pseq < 1 ? 1 : vm.pseq; vm.pseq = 0; //학습로그생성 String ua = ""; try { ua = (Request.UserAgent ?? "").ToLower(); } catch (Exception ex) { Logger.Error("ExamStart Get UserAgent Info Error" + ex.StackTrace); } var li = Dao.Get("lect.lectinning.new", new Hashtable() {{ "userno", SUserInfo.UserNo } }).FirstOrDefault(); vm.ErrLi = new Data() { }; //longval:logno,intval:lectno,intval2:cmino,intval3:maxcnt if(li.intval3 > 0 && li.intval2 != vm.cmino) { vm.ErrLi = li; return View("ViewTaste", vm); } vm.lip = new LectInningPage() { lectno = vm.lectno, cmino = vm.cmino, pseq = vm.pseq, userno = SUserInfo.UserNo, isrelay = 1, uno = SUserInfo.UserNo, uip = GetUserIP(), ispc = vm.ismobile == 1 ? 0 : 1, webkitinfo = ua.Length > 500 ? ua.Substring(0, 500) : ua }; Dao.Insert("cr.lectinningpage.in", vm.lip); if (vm.lip.logno > 0) { vm.status = 1; vm.Pages = Dao.Get("cr.ctps", vm.lip); vm.pseq = vm.Pages.First().lastpseq; vm.Page = vm.Pages.Where(w => w.pseq == vm.pseq).First(); vm.CMInning = new CMInning() { isokmid = vm.Page.isokmid, ismenu = vm.Page.ismenu, iseq = vm.Page.iseq, ititle = vm.Page.ititle, ctype = vm.Page.ctype, ccode = vm.Page.ccode, isoversize = vm.Page.isoversize, mstime = vm.Page.mstime, metime = vm.Page.metime }; if (vm.CMInning.isokmid == 0 && vm.CMInning.metime > 0) { //if (Request.IsLocal || GetConfig("isdevtest")=="1") //{ // vm.CMInning.mtime = 10; //} //else //{ Random r = new Random(); vm.CMInning.mtime = r.Next(vm.CMInning.mstime * 60, vm.CMInning.metime * 60); vm.CMInning.mtime = vm.CMInning.mtime < 10 ? 15 : vm.CMInning.mtime; //} } } else { #region 복습처리(학습종료일 ~ 1년) vm.LectInnings = Dao.Get("cr.cminnings", new Hashtable() { { "lectno", vm.lectno }, { "userno", SUserInfo.UserNo }, { "limit", 1 } }); if (vm.LectInnings.Count() > 0 && vm.LectInnings.First().sdate < DateTime.Now && vm.LectInnings.First().edate.AddYears(1) > DateTime.Now) { vm.istaste = 1; vm.status = 1; vm.Pages = Dao.Get("cr.ctps", vm.lip); vm.pseq = vm.Pages.First().lastpseq; vm.Page = vm.Pages.Where(w => w.pseq == vm.pseq).First(); vm.CMInning = new CMInning() { lectno = vm.lectno, cmino = vm.cmino, isokmid = vm.Page.isokmid, ismenu = vm.Page.ismenu, iseq = vm.Page.iseq, ititle = vm.Page.ititle, ctype = vm.Page.ctype, ccode = vm.Page.ccode, isoversize = vm.Page.isoversize, mstime = vm.Page.mstime, metime = vm.Page.metime }; } #endregion } } } } //Response.AddHeader("X-Frame-Options", "ALLOW-FROM http://www.kocw.net"); //Response.Headers.Remove("X-Frame-Options"); //Response.AddHeader("X-Frame-Options", "AllowAll"); return View("ViewTaste", vm); } public ActionResult HTTPS(String url) { ViewBag.https = url; return View(); } } }