YNICTE/BO/Controllers/MMController.cs

118 lines
5.1 KiB
C#
Raw Normal View History

2020-10-12 14:39:23 +09:00
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<ComCode>("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<NCS>() { };
vm.stringval = vm.stringval ?? "U";
if (IsPost())
{
vm.NCSs = Dao.Get<NCS>("cm.ncs." + vm.stringval, new System.Collections.Hashtable() { { "ndepth", vm.stringval },{"pagenum",vm.pagenum},{ "pagerowsize",vm.pagerowcount}, { "codename", vm.stringval2 } });
}
vm.NCSs2 = Dao.Get<NCS>("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<NP.Model.Menu>("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<NP.Model.UserAuth>("sys.menu.auths",new System.Collections.Hashtable() { { "isall",1} });
vm.menus = Dao.Get<NP.Model.Menu>("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<Users>();
// 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<Users>("mm.admins", ht);
// vm.PageTotalCount = GetCount(vm.Users.FirstOrDefault());
//}
//else
//{
// vm.Users = Dao.Get<Users>("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<Users>("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<Banner>("mm.banners", new System.Collections.Hashtable() { });
vm.stringval = GetConfig("fronturl");
return View(vm);
}
public ActionResult popups(VMMM vm)
{
vm.Popups = Dao.Get<Popup>("mm.popups", new System.Collections.Hashtable() { });
vm.stringval = GetConfig("fronturl");
return View(vm);
}
public ActionResult pages(VMMM vm)
{
vm.MenuPages = Dao.Get<MenuPage>("mm.pages", new System.Collections.Hashtable() { });
vm.BMs = Dao.Get<BoardMaster>("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);
}
}
}