148 lines
7.0 KiB
C#
148 lines
7.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
using NP.Model;
|
|
using NP.Base;
|
|
using System.Net;
|
|
using System.IO;
|
|
|
|
namespace NP.FO.Controllers
|
|
{
|
|
public class HomeController : FOOpenBaseController
|
|
{
|
|
public ActionResult Index(VMHome vm)
|
|
{
|
|
//서브도메인 확인 하여 고객사 로그인/마이페이지로 이동
|
|
var sd = Request.Url.Host.Split('.')[0];
|
|
if (GetConfig("isdevtest") != "1" && !Request.Url.Host.Contains("118.219.255.") && 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())
|
|
{
|
|
if (SUserInfo.UserNo < 1)
|
|
{
|
|
return Redirect("/Account/Index");
|
|
}
|
|
else
|
|
{
|
|
return Redirect("/My/Index");
|
|
}
|
|
}
|
|
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob");
|
|
//HttpWebRequest requestHttp = (HttpWebRequest)HttpWebRequest.Create("http://ynictea.nptc.kr/Content/homeDepth2.htm");
|
|
string urlStr = GetConfig("adminurl");
|
|
HttpWebRequest requestHttp = (HttpWebRequest)HttpWebRequest.Create(urlStr + "/Content/homeDepth1.htm");
|
|
requestHttp.Method = WebRequestMethods.Http.Get;
|
|
var resp = requestHttp.GetResponse() as System.Net.HttpWebResponse;
|
|
var receiveStream = resp.GetResponseStream();
|
|
StreamReader readStream = new System.IO.StreamReader(receiveStream, System.Text.Encoding.UTF8);
|
|
ViewBag.depthHtml = (readStream.ReadToEnd());
|
|
|
|
requestHttp = (HttpWebRequest)HttpWebRequest.Create(urlStr + "/Content/homeDepth2.htm");
|
|
requestHttp.Method = WebRequestMethods.Http.Get;
|
|
resp = requestHttp.GetResponse() as System.Net.HttpWebResponse;
|
|
receiveStream = resp.GetResponseStream();
|
|
readStream = new System.IO.StreamReader(receiveStream, System.Text.Encoding.UTF8);
|
|
ViewBag.depthHtml += (readStream.ReadToEnd());
|
|
|
|
ViewBag.POPUPS = GetPOPUP;
|
|
ViewBag.POPUPXS = CookieGet("popup", "");
|
|
ViewBag.IsMain = true;
|
|
vm.Datas = Dao.Get<Data>("site.main", new System.Collections.Hashtable() { {"offcode", OffCode }, { "oncode", OnCode} });
|
|
vm.CMsEtc = Dao.Get<CM>("cm.cgetc", new System.Collections.Hashtable() { { "cgcode", "2" } });//cgcode = 기타교육 // 기타교육 cgcode 바뀌면 파라미터도 변경해야함
|
|
|
|
ViewBag.OnCode1 = OnCode1;
|
|
return View(vm);
|
|
}
|
|
|
|
public ActionResult IndexSample(VMHome vm)
|
|
{
|
|
//서브도메인 확인 하여 고객사 로그인/마이페이지로 이동
|
|
var sd = Request.Url.Host.Split('.')[0];
|
|
if (GetConfig("isdevtest") != "1" && !Request.Url.Host.Contains("118.219.255.") && 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())
|
|
{
|
|
if (SUserInfo.UserNo < 1)
|
|
{
|
|
return Redirect("/Account/Index");
|
|
}
|
|
else
|
|
{
|
|
return Redirect("/My/Index");
|
|
}
|
|
}
|
|
//ViewBag.B24 = Dao.Get<Model.Board>("board.listformain", new System.Collections.Hashtable() { });
|
|
//팝업
|
|
//var cps = CookieGet("popup", "");
|
|
//if (cps != "") {
|
|
// ViewBag.POPUPS = string.Join("ynppopuplistseparator", GetPOPUPS.Where(w => !string.Format("p{0}p", cps).Contains("p" + w.PNo.ToString() + "p")).Select(s => string.Format("{0}ynppopupseparator{1}ynppopupseparator{2}ynppopupseparator{3}ynppopupseparator{4}ynppopupseparator{5}ynppopupseparator{6}ynppopupseparator{7}ynppopupseparator{8}", s.PNo, s.PTitle, s.PContents??"", s.TopPX, s.LeftPX, s.PWidth, s.PHeight, s.PUrl??"", s.ZIndex)));
|
|
//}
|
|
//else
|
|
//{
|
|
ViewBag.POPUPS = GetPOPUP;
|
|
//}
|
|
ViewBag.POPUPXS = CookieGet("popup", "");
|
|
vm.Datas = Dao.Get<Data>("site.main", new System.Collections.Hashtable() { { "offcode", OffCode }, { "oncode", OnCode } });
|
|
//foreach(var d in vm.Datas.Where(w=>w.dtype == 1 && !string.IsNullOrEmpty(w.strval4)))
|
|
//{
|
|
// //Thumbnail 확인
|
|
// if (!System.IO.File.Exists(Server.MapPath(vm.Thumbnails + "/" + d.intval + ".jpg")))
|
|
// {
|
|
// if (!System.IO.Directory.Exists(Server.MapPath(vm.Files + vm.Thumbnails)))
|
|
// {
|
|
// System.IO.Directory.CreateDirectory(Server.MapPath(vm.Files + vm.Thumbnails + "/"));
|
|
// }
|
|
// String thumbargs = "-i " + Server.MapPath(vm.Contents + d.strval4) + " -vframes 1 -ss 00:00:07 -s 150x150 " + Server.MapPath(vm.Thumbnails + "/" + d.intval + ".jpg");
|
|
// System.Diagnostics.Process thumbproc = new System.Diagnostics.Process();
|
|
// thumbproc = new System.Diagnostics.Process();
|
|
// thumbproc.StartInfo.FileName = GetConfig("thumbnailexe");
|
|
// thumbproc.StartInfo.Arguments = thumbargs;
|
|
// thumbproc.StartInfo.UseShellExecute = false;
|
|
// thumbproc.StartInfo.CreateNoWindow = false;
|
|
// thumbproc.StartInfo.RedirectStandardOutput = false;
|
|
// try
|
|
// {
|
|
// thumbproc.Start();
|
|
// d.strval5 = vm.Thumbnails + "/" + d.intval + ".jpg";
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// SetError("ffmpeg: " + ex.Message);
|
|
// d.strval5 = "/img/main/main_edu_thumb01.jpg";
|
|
// }
|
|
// thumbproc.WaitForExit();
|
|
// thumbproc.Close();
|
|
// //_repository.CreateUniqueFullPath(_path);
|
|
// }
|
|
// else
|
|
// {
|
|
// d.strval5 = vm.Thumbnails + "/" + d.intval + ".jpg";
|
|
// }
|
|
//}
|
|
ViewBag.OnCode1 = OnCode1;
|
|
return View(vm);
|
|
}
|
|
public ActionResult Html(VMHome vm)
|
|
{
|
|
if (ViewBag.MenuPage == null)
|
|
{
|
|
return RedirectToAction("/");
|
|
}
|
|
return View(vm);
|
|
}
|
|
public ActionResult Popup(int pno)
|
|
{
|
|
return View(GetPOPUPS.Where(w => w.pno == pno).First());
|
|
}
|
|
|
|
public ActionResult PrivacyPolicy()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult UsePolicy()
|
|
{
|
|
return View();
|
|
}
|
|
}
|
|
}
|