首页 > 代码库 > 4、VS2010+ASP.NET MVC4+EF4+JqueryEasyUI+Oracle项目开发之——后台管理界面
4、VS2010+ASP.NET MVC4+EF4+JqueryEasyUI+Oracle项目开发之——后台管理界面
这一章节比较简单,我就直接贴代码了,后台管理登陆界面如下:
对应的控制器HomeController.cs,代码如下:
using YKT.Model; using YKT.Common; using YKT.BLL; using YKT.Common.HtmlHelpers; using YKT.Common.Functions; using Microsoft.Practices.Unity; using YKT.IBLL; namespace YKT.Controllers { public class HomeController : BaseController { #region 通用部分-实例化业务逻辑对象 ValidationErrors validationErrors = new ValidationErrors(); HomeService m_BLL = new HomeService(); ISysMenuRoleFuncService _menuRoleFunService = new SysMenuRoleFuncService(); #endregion public ActionResult Index() { Account account = GetCurrentAccount(); if (account == null) { return RedirectToAction("Index", "Account"); } else { ViewData["PersonName"] = account.UID; ViewData["Menu"] = m_BLL.GetMenuByAccount(ref account);// 获取菜单 } return View(); } //[SupportFilter] public ActionResult Main() { SysInfo model = m_BLL.GetSysInfoModel() as SysInfo; return View(model); } /// <summary> /// 根据父节点获取数据字典,绑定二级下拉框的时候使用 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult GetSysFieldByParent(string id, string parentid, string value) { if (string.IsNullOrWhiteSpace(value)) { return null; } ISysFieldHander baseDDL = new SysFieldHander(); return Json(new SelectList(baseDDL.GetSysFieldByParent(id, parentid, value), "MyTexts", "MyTexts"), JsonRequestBehavior.AllowGet); } /// <summary> /// 获取列表中的按钮导航 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult GetToolbar(int id) { Account account = GetCurrentAccount(); if (account == null) { return Content(" <script type=‘text/javascript‘> window.top.location=‘Account‘; </script>"); } List<SMFUNCTB> sysOperations = _menuRoleFunService.GetByRefSysMenuIdAndSysRoleId(id, account.RoleIds); List<toolbar> toolbars = new List<toolbar>(); foreach (SMFUNCTB item in sysOperations) { toolbars.Add(new toolbar() { handler = item.EVENT_NAME, iconCls = item.ICONIC, text = item.FUNC_NAME }); } return Json(toolbars, JsonRequestBehavior.AllowGet); } } }这里我继承了一个基控制器BaseController如下:
/*Company:EMPEROR*/ /*Author:Zouqj*/ /*Date:2014-02-20*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.EnterpriseServices; using YKT.Model; using System.Web.Mvc; using System.Configuration; using System.Web; using System.IO.Compression; using YKT.Common; namespace YKT.Controllers { [SupportFilter]//此处如果去掉注释,则全部继承BaseController的Controller,都将执行SupportFilter过滤 public class BaseController : Controller { /// <summary> /// 是否添加选择行 /// </summary> public bool IsAddSelect = true; /// <summary> /// //选择行的文本 /// </summary> public string DefaultSelectText = "——请选择——"; /// <summary> /// //默认选择的值 /// </summary> public string DefaultSelectValue = http://www.mamicode.com/"";>View如下:@{ ViewBag.Title = "一卡通企业平台"; Layout =null; } <!DOCTYPE html> <html> <head id="Head1"> <title>一卡通企业平台</title> <base target="_self"/> <link href=http://www.mamicode.com/‘@Url.Content("~/Res/easyui/themes/default/easyui.css")‘ rel="stylesheet" type="text/css" />>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。