using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NP.Model; namespace NP.BO.Controllers { public class MMController : BOBaseController { public ActionResult Config(NP.Model.VMMM vm, int mno = 0, int ano = 0) { ModelState.Clear(); switch (vm.tabidx) { case 0: ViewBag.savedata = vm.savedata ?? ""; vm.ComGroups = Dao.Get("mm.comcode.glist", new System.Collections.Hashtable() { { "rno", "cgroupname" },{ "notcgroups", "'ccdiff','cc1','cc2','cc3','cc4','cc5'" } }); vm.ComCode = new ComCode(); break; case 1: var ht = SetHash(vm); vm.NCSs = new List() { }; vm.stringval = vm.stringval ?? "U"; if (IsPost()) { vm.NCSs = Dao.Get("cm.ncs." + vm.stringval, new System.Collections.Hashtable() { { "ndepth", vm.stringval },{"pagenum",vm.pagenum},{ "pagerowsize",vm.pagerowcount}, { "codename", vm.stringval2 } }); } vm.NCSs2 = Dao.Get("cm.ncses0", new System.Collections.Hashtable() { { "ntype", 0 } }); vm.pagetotalcount = GetCount(vm.NCSs.FirstOrDefault()); break; case 2: ViewBag.mno = mno; ViewBag.mtree = "/"; vm.menus = Dao.Get("sys.menu.list", ""); if (mno > 0) { ViewBag.mtree = (vm.menus.Where(w => w.menuno == mno).FirstOrDefault() ?? new NP.Model.Menu()).menurout ?? "/"; } vm.menu = new NP.Model.Menu(); break; case 3: ViewBag.ANO = ano; vm.userauths = Dao.Get("sys.menu.auths",new System.Collections.Hashtable() { { "isall",1} }); vm.menus = Dao.Get("sys.menu.list", new System.Collections.Hashtable() { { "isall", 1 } }); break; } return View(vm); } public ActionResult As(VMMM vm) { //if (vtabidx == 0) //{ // if (!IsPost() && vm.StringVal == null) // { // vm.StringVal = "1"; // } // vm.Users = InitM(); // var ht = SetHash(vm); // ht.Add("Status", vm.StringVal); // ht.Add("UserType", vm.StringVal2); // ht.Add("UserNameIdIC", vm.SearchText); // ht.Add("OrderBy", "a.enterdate desc"); // vm.Users = Dao.Get("mm.admins", ht); // vm.PageTotalCount = GetCount(vm.Users.FirstOrDefault()); //} //else //{ // vm.Users = Dao.Get("mm.admins", new System.Collections.Hashtable() { {"Status",1 }, { "NoRetired", 1 }, { "OrderBy", "a.sort" } }); //} return View(vm); } public ActionResult Ar(VMMM vm) { //ViewBag.PopupMenuName = "컨설턴트 " + (vm.LongVal < 1 ? "등록":"수정"); //vm.User = new Users() { Status = 1, UserType = 31, IsOpen = 1 }; //if (vm.LongVal > 0) //{ // ModelState.Clear(); // vm.User = Dao.Get("mm.admins", new System.Collections.Hashtable() { { "AdminNo", vm.LongVal }, { "OrderBy", "a.enterdate desc" } }).First(); // if ((vm.User.FGNoProfile ?? 0) > 0) // { // vm.FileList = GetFiles(vm.User.FGNoProfile.Value); // } // if ((vm.User.FGNoCCV ?? 0) > 0) // { // vm.FileList2 = GetFiles(vm.User.FGNoCCV.Value); // } //} //vm.ComCodes = GetComCodes("Position"); return View(vm); } public ActionResult banners(VMMM vm) { vm.Banners = Dao.Get("mm.banners", new System.Collections.Hashtable() { }); vm.stringval = GetConfig("fronturl"); return View(vm); } public ActionResult popups(VMMM vm) { vm.Popups = Dao.Get("mm.popups", new System.Collections.Hashtable() { }); vm.stringval = GetConfig("fronturl"); return View(vm); } public ActionResult pages(VMMM vm) { vm.MenuPages = Dao.Get("mm.pages", new System.Collections.Hashtable() { }); vm.BMs = Dao.Get("board.bms", new System.Collections.Hashtable() { { "isopen", 1 }, { "bmposition", 0 } }); foreach(var d in vm.BMs) { d.text = string.Format("{0}({1})", d.text, d.bmcode); } return View(vm); } } }