前言

  • 上一篇文章我们完成了系统角色管理的基本功能实现,也对系统层次结构进行了了解。这一篇我们将继续对系统的用户管理模块进行代码编写。代码没有做封装,所以大部分的逻辑代码都是相通的,只是在一些前端的细节上处理有些不同。源码将在文章的末尾给出,有兴趣的园友可以对代码做一些封装或重构,毕竟这可以减少很多的代码量。

Abstract

  • 在这一层添加对用户管理操作的业务接口IS_UserRepository,里面定义增删改查的业务接口。代码如下:
  1. using Entities;
  2. using System.Collections.Generic;
  3.  
  4. namespace Abstract
  5. {
  6. public interface IS_UserRepository
  7. {
  8. bool Add(S_User model);
  9. bool Update(S_User model);
  10. bool Delete(long id);
  11. List<S_User> GetInfo(string strWhere, int rows, int page, out int total);
  12. }
  13. }

Concrete

  • 这一层我们添加S_UserRepository类,实现用户管理需要的操作方法。由于在页面上操作需要显示用户所属的角色信息,所以在这里的查询会启用延迟加载。代码如下:
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Abstract;
  4. using Entities;
  5.  
  6. namespace Concrete
  7. {
  8. public class S_UserRepository : IS_UserRepository
  9. {
  10. private EFDbContext context = new EFDbContext();
  11. public bool Add(S_User model)
  12. {
  13. try
  14. {
  15. if (null != model)
  16. {
  17. context.S_Users.Add(model);
  18. context.SaveChanges();
  19. return true;
  20. }
  21. else
  22. {
  23. return false;
  24. }
  25. }
  26. catch
  27. {
  28. return false;
  29. }
  30. }
  31.  
  32. public bool Update(S_User model)
  33. {
  34. try
  35. {
  36. if (null != model)
  37. {
  38. S_User oldModel = context.S_Users.FirstOrDefault(x => x.ID == model.ID);
  39. //oldModel.UserName = model.UserName;
  40. //oldModel.UserPwd = model.UserPwd;
  41. oldModel.Email = model.Email;
  42. oldModel.IsUse = model.IsUse;
  43. oldModel.Phone = model.Phone;
  44. oldModel.Remark = model.Remark;
  45. oldModel.RoleID = model.RoleID;
  46. context.SaveChanges();
  47. return true;
  48. }
  49. else
  50. {
  51. return false;
  52. }
  53. }
  54. catch
  55. {
  56. return false;
  57. }
  58. }
  59.  
  60. public bool Delete(long id)
  61. {
  62. try
  63. {
  64. if (null != id)
  65. {
  66. S_User model = context.S_Users.FirstOrDefault(x => x.ID == id);
  67. if (null != model)
  68. {
  69. context.S_Users.Remove(model);
  70. context.SaveChanges();
  71. return true;
  72. }
  73. else
  74. {
  75. return false;
  76. }
  77. }
  78. else
  79. {
  80. return false;
  81. }
  82. }
  83. catch
  84. {
  85. return false;
  86. }
  87. }
  88.  
  89. public List<S_User> GetInfo(string strWhere, int rows, int page, out int total)
  90. {
  91. context.Configuration.ProxyCreationEnabled = true;
  92. context.Configuration.LazyLoadingEnabled = true;
  93. List<S_User> listData = new List<S_User>();
  94.  
  95. if (!string.IsNullOrEmpty(strWhere))
  96. {
  97. listData = context.S_Users.Where(x => x.UserName.Contains(strWhere)).ToList();
  98. }
  99. else
  100. {
  101. listData = context.S_Users.ToList();
  102. }
  103.  
  104. var results = listData.OrderByDescending(p => p.ID).Skip((page - ) * rows).Take(rows);
  105. total = listData.Count();
  106. return results.ToList();
  107.  
  108. }
  109. }
  110. }

Web

  • 首先在NinjectControllerFactory类中追加对用户管理的解耦操作的绑定,代码如下:
  1. private void AddBindings()
  2. {
  3. // put additional bindings here
  4. ninjectKernel.Bind<IS_RoleRepository>().To<S_RoleRepository>();
  5. ninjectKernel.Bind<IS_UserRepository>().To<S_UserRepository>();
  6. }
  • 在MVC的Models中定义页面需要绑定的数据模型对象,这里我们将数据模型类都定义在mod_S_User类中。mod_S_User和mod_S_UserPage用于绑定EasyUI的datagrid中的数据集合。RoleData用户绑定EasyUI的combobox下拉框中的角色列表。代码如下:
  1. using System.Collections.Generic;
  2.  
  3. namespace Web.Models
  4. {
  5. public class mod_S_User
  6. {
  7. public long ID { get; set; }
  8. public long RoleID { get; set; }
  9. public string RoleName { get; set; }
  10. public string UserName { get; set; }
  11. public string UserPwd { get; set; }
  12. public string IsUse { get; set; }
  13. public string Phone { get; set; }
  14. public string Email { get; set; }
  15. public string Remark { get; set; }
  16. }
  17. public class RoleData
  18. {
  19. public long RoleID { get; set; }
  20. public string RoleName { get; set; }
  21. }
  22. public class mod_S_UserPage
  23. {
  24. public string total { get; set; }
  25. public List<mod_S_User> rows { get; set; }
  26. }
  27. }
  • 在MVC的SystemController中添加对用户管理接口IS_UserRepository的依赖注入,代码如下:
  1.     private IS_RoleRepository IS_Role;
  2. private IS_UserRepository IS_User;
  3. public SystemController(IS_RoleRepository _S_Role, IS_UserRepository _S_User)
  4. {
  5. this.IS_Role = _S_Role;
  6. this.IS_User = _S_User;
  7. }
  • 在MVC的SystemController中完成对用户管理操作的页面逻辑处理代码。代码如下:
  1. #region log20150704 Create By Jack:系统用户操作
  2.  
  3. public ActionResult UserList()
  4. {
  5. return View();
  6. }
  7.  
  8. public ActionResult GetUsers(string strWhere, int rows, int page = )
  9. {
  10. mod_S_UserPage DataModel = new mod_S_UserPage();
  11. List<mod_S_User> listViewData = new List<mod_S_User>();
  12.  
  13. int total; //必须定义参数变量接收out参数
  14. List<S_User> listData = IS_User.GetInfo(strWhere, rows, page, out total);
  15.  
  16. foreach (var item in listData)
  17. {
  18. mod_S_User model = new mod_S_User();
  19.  
  20. model.ID = item.ID;
  21. model.UserName = item.UserName;
  22. model.UserPwd = item.UserPwd;
  23. model.RoleID = item.S_Role.ID;
  24. model.RoleName = item.S_Role.RoleName;
  25. model.IsUse = item.IsUse;
  26. model.Email = item.Email;
  27. model.Phone = item.Phone;
  28. model.Remark = item.Remark;
  29.  
  30. listViewData.Add(model);
  31.  
  32. }
  33.  
  34. DataModel.total = total.ToString();
  35. DataModel.rows = listViewData;
  36.  
  37. return Json(DataModel, JsonRequestBehavior.AllowGet);
  38. }
  39.  
  40. public ActionResult CreateUser(S_User dataModel)
  41. {
  42. bool rtnFalg = false;
  43. if (Request.IsAjaxRequest())
  44. {
  45. if (dataModel.ID == ) //0为ID的默认值
  46. {
  47. dataModel.ID = NewID.NewComb();
  48. rtnFalg = IS_User.Add(dataModel);
  49. }
  50. else
  51. {
  52. rtnFalg = IS_User.Update(dataModel);
  53. }
  54. if (rtnFalg == true)
  55. {
  56. return Json(new { flag = true });
  57. }
  58. else
  59. {
  60. return Json(new { flag = false });
  61. }
  62. }
  63. else
  64. {
  65. return Json(new { flag = false });
  66. }
  67. }
  68.  
  69. [HttpPost]
  70. public ActionResult DeleteUser(long id)
  71. {
  72. if (id != )
  73. {
  74. bool rtnFlag = IS_User.Delete(id);
  75. if (rtnFlag == true)
  76. {
  77. return Json(new { flag = true });
  78. }
  79. else
  80. {
  81. return Json(new { flag = false });
  82. }
  83. }
  84. else
  85. {
  86. return Json(new { flag = false });
  87. }
  88. }
  89. public ActionResult BindRoles()
  90. {
  91. List<S_Role> listData = IS_Role.BindRoles();
  92. List<RoleData> BindData = new List<RoleData>();
  93. foreach (var item in listData)
  94. {
  95. RoleData model = new RoleData();
  96. model.RoleID = item.ID;
  97. model.RoleName = item.RoleName;
  98. BindData.Add(model);
  99. }
  100.  
  101. return Json(BindData, JsonRequestBehavior.AllowGet);
  102. }
  103. #endregion
  • 注意绑定页面角色下拉框中的角色列表的方法是定义在IS_RoleRepository中的,所以应该在S_RoleRepository中追加该方法的实现,代码如下:
  1.     public List<S_Role> BindRoles()
  2. {
  3. context.Configuration.ProxyCreationEnabled = false;
  4. context.Configuration.LazyLoadingEnabled = false;
  5.  
  6. List<S_Role> listData = new List<S_Role>();
  7. listData = context.S_Roles.ToList();
  8. return listData;
  9. }
  • 添加对页面用户管理视图UserList的代码,在此页面有两个注意的地方:
  1. 页面的密码输入,需要验证两次输入的密码是否相等,这个可以通过Jquery的扩展方法解决。代码如下:
  1. $.extend($.fn.validatebox.defaults.rules, {
  2. equalTo: { validator: function (value, param) { return $(param[]).val() == value; }, message: '字段不匹配' }
  3. });

  2. 页面的角色下拉框列表绑定是动态的,需要从数据库中读取。利用combobox的data-options属性,

   我们可以向Controller中发起异步的get请求加载数据。代码如下:

  1. <input class="easyui-combobox" id="RoleID" required="true"
  2. name="RoleID"
  3. data-options="
  4. url:'/System/BindRoles',
  5. method:'get',
  6. valueField:'RoleID',
  7. textField:'RoleName',
  8. panelHeight:'auto',
  9. width:">

  3. UserList的完整代码如下:

  1. @{
  2. ViewBag.Title = "UserList";
  3. }
  4. <script src="~/JSFunction/System_UserList.js"></script>
  5.  
  6. <style type="text/css">
  7. #fm {
  8. margin: ;
  9. padding: 10px 30px;
  10. }
  11.  
  12. .ftitle {
  13. font-size: 14px;
  14. font-weight: bold;
  15. padding: 5px ;
  16. margin-bottom: 10px;
  17. border-bottom: 1px solid #ccc;
  18. }
  19.  
  20. .fitem {
  21. margin-bottom: 5px;
  22. }
  23.  
  24. .fitem label {
  25. display: inline-block;
  26. width: 80px;
  27. }
  28. </style>
  29.  
  30. <div id="toolbar">
  31. <table cellpadding="">
  32. <tr>
  33. <td>用户ID:<input type="hidden" id="hid_optype" name="hid_optype" value="" /></td>
  34. <td><input class="easyui-validatebox textbox" type="text" name="ID" disabled="disabled"></input></td>
  35. <td>用户名:</td>
  36. <td><input class="easyui-validatebox textbox" type="text" name="UserName" id="txt_UserName"></input></td>
  37. </tr>
  38.  
  39. </table>
  40.  
  41. <div class="panelExten">
  42. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="ConditionSearch();">查询</a> |
  43. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="NewData();">新增</a> |
  44. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="EditData();">编辑</a> |
  45. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="DestroyData();">删除</a> |
  46. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-undo" plain="true" onclick="ClearQuery();">清除</a>
  47. </div>
  48. </div>
  49.  
  50. <table id="dg" class="easyui-datagrid" pagination="true"
  51. rownumbers="true" fit="true"
  52. fitcolumns="true" singleselect="true" toolbar="#toolbar" @*data-options="toolbar:toolbar" *@
  53. fit="false" style=" height:500px;">
  54. <thead>
  55. <tr>
  56. <th data-options="field:'ck',checkbox:true"></th>
  57.  
  58. <th field="ID" width="">
  59. 主键ID
  60. </th>
  61. <th field="UserName" width="">
  62. 用户名
  63. </th>
  64. <th field="Phone" width="">
  65. 电话
  66. </th>
  67. <th field="Email" width="">
  68. 邮箱
  69. </th>
  70. <th field="RoleID" width="" hidden="true">
  71. 角色ID
  72. </th>
  73. <th field="RoleName" width="">
  74. 所属角色
  75. </th>
  76. <th field="Remark" width="">
  77. 备注
  78. </th>
  79. </tr>
  80. </thead>
  81. </table>
  82.  
  83. <div id="dlg" class="easyui-dialog" style="width: 550px; height: 480px; padding: 10px 20px"
  84. closed="true" buttons="#dlg-buttons" modal="true">
  85. <form id="fm" method="post" novalidate>
  86. <div class="fitem" style=" display:none;">
  87. <label> 主键ID:</label>
  88. <input id="ID" name="ID" class="easyui-validatebox" required="true">
  89. </div>
  90. <div class="fitem">
  91. <label>用户名:</label>
  92. <input id="UserName" name="UserName" class="easyui-validatebox" required="true">
  93. </div>
  94. <div class="fitem" id="div_UserPwd">
  95. <label> 码:</label>
  96. <input id="UserPwd" name="UserPwd" class="easyui-validatebox" required="true" type="password">
  97. </div>
  98. <div class="fitem" id="div_repassword">
  99. <label>确认密码:</label>
  100. <input name="repassword" id="repassword" class="easyui-validatebox" required="true" type="password"
  101. validtype="equalTo['#UserPwd']" invalidmessage="两次输入密码不匹配" />
  102. </div>
  103. <div class="fitem">
  104. <label>是否启用:</label>
  105. <select class="easyui-combobox" name="IsUse" id="IsUse" style="width:134px;" required="true">
  106. <option value="是" selected>是</option>
  107. <option value="否">否</option>
  108. </select>
  109. </div>
  110. <div class="fitem">
  111. <label>所属角色:</label>
  112. <input class="easyui-combobox" id="RoleID" required="true"
  113. name="RoleID"
  114. data-options="
  115. url:'/System/BindRoles',
  116. method:'get',
  117. valueField:'RoleID',
  118. textField:'RoleName',
  119. panelHeight:'auto',
  120. width:
  121. ">
  122. </div>
  123. <div class="fitem">
  124. <label>邮箱:</label>
  125. <input name="Email" id="Email" class="easyui-validatebox" data-options="prompt:'请输入正确的邮箱地址',validType:'email'">
  126. </div>
  127. <div class="fitem">
  128. <label>电话:</label>
  129. <input id="Phone" name="Phone" class="easyui-textbox">
  130. </div>
  131. <div class="fitem">
  132. <label>备注:</label>
  133. <textarea id="Remark" name="Remark" cols="" rows=""> </textarea>
  134. </div>
  135. </form>
  136. </div>
  137. <div id="dlg-buttons">
  138. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" id="send" onclick="SaveData()"> 保存</a>
  139. <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
  140. </div>
  • 在JSFunction文件中添加对UserList页面逻辑处理的js文件System_UserList。代码如下:
  1. //判断密码值是否相等
  2. $.extend($.fn.validatebox.defaults.rules, {
  3. equalTo: { validator: function (value, param) { return $(param[]).val() == value; }, message: '字段不匹配' }
  4. });
  5.  
  6. //页面加载时读取数据
  7. $(function () {
  8. Search();
  9.  
  10. var dg = $('#dg');
  11. var opts = dg.datagrid('options');
  12. var pager = dg.datagrid('getPager');
  13. pager.pagination({
  14. onSelectPage: function (pageNum, pageSize) {
  15. opts.pageNumber = pageNum;
  16. opts.pageSize = pageSize;
  17. pager.pagination('refresh', {
  18. pageNumber: pageNum,
  19. pageSize: pageSize
  20. });
  21. Search(); //从数据库中获取数据,并加载
  22. },
  23. pageList: [, , ], //可以设置每页记录条数的列表
  24. beforePageText: '第', //页数文本框前显示的汉字
  25. afterPageText: '页 共 {pages} 页',
  26. displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录'
  27. });
  28. });
  29.  
  30. //从数据库中获取数据,并加载
  31. function Search() {
  32.  
  33. var page_Number = $('#dg').datagrid('options').pageNumber; //pageNumber为datagrid的当前页码
  34. var page_Size = $('#dg').datagrid('options').pageSize; //pageSize为datagrid的每页记录条数
  35.  
  36. var optype = $('#hid_optype').val();
  37. $('#dg').datagrid("loading");
  38.  
  39. //根据操作类型判断筛选条件
  40. var strUserName = $('#txt_UserName').val();
  41. var strWhere = strUserName;
  42.  
  43. $.post('/System/GetUsers', { strWhere: strWhere, page: page_Number, rows: page_Size },
  44. function (data) {
  45. $('#dg').datagrid('loadData', data);
  46. $('#dg').datagrid("loaded");
  47. })
  48. }
  49.  
  50. function ConditionSearch() {
  51. $('#hid_optype').val(); //操作:点击查询按钮筛选条件
  52. Search();
  53. }
  54.  
  55. function NewData() {
  56. $('#dlg').dialog('open').dialog('setTitle', '新增用户信息');
  57. //$('#fm').form('clear');
  58. //页面上有绑定值,不能完全清空
  59. $('#UserName').val("");
  60. $('#UserPwd').val("");
  61. $('#repassword').val("");
  62.  
  63. $('#Email').val("");
  64. $('#Phone').val("");
  65. $('#Remark').val("");
  66. }
  67.  
  68. function EditData() {
  69. var row = $('#dg').datagrid('getSelected');
  70. if (row) {
  71. $('#dlg').dialog('open').dialog('setTitle', '编辑用户信息');
  72.  
  73. $("#UserName").attr("disabled", true);
  74. $('#div_repassword').hide();
  75. $('#div_UserPwd').hide();
  76.  
  77. $('#fm').form('load', row);
  78. }
  79. }
  80.  
  81. function DestroyData() {
  82. var row = $('#dg').datagrid('getSelected');
  83. if (row) {
  84. $.messager.confirm('提醒', '确定删除这条数据吗?', function (r) {
  85. if (r) {
  86. var strWhere = row.ID;
  87.  
  88. $.ajax({
  89. url: '/System/DeleteUser',
  90. type: 'POST',
  91. data: { id: strWhere },
  92. success: function (data) {
  93. var t = data.flag;
  94. if (t) {
  95. $.messager.show({
  96. title: '提示信息',
  97. msg: '【系统提示】:操作成功!',
  98. style: {
  99. right: '',
  100. top: document.body.scrollTop + document.documentElement.scrollTop,
  101. bottom: ''
  102. }
  103. });
  104. //$('#dg_CommGreen').datagrid('reload'); // reload the user data
  105. Search();
  106. }
  107. }
  108. })
  109. }
  110. });
  111. }
  112. else {
  113. $.messager.show({
  114. title: '提示信息',
  115. msg: '【系统提示】:请选择须要操作的数据!',
  116. style: {
  117. right: '',
  118. top: document.body.scrollTop + document.documentElement.scrollTop,
  119. bottom: ''
  120. }
  121. });
  122. }
  123. }
  124.  
  125. function ClearQuery() {
  126. $('#txt_UserName').val("");
  127. }
  128.  
  129. function SaveData() {
  130. var prod = {
  131. ID: $('#ID').val(),
  132. UserName: $('#UserName').val(),
  133. UserPwd: $('#UserPwd').val(),
  134. IsUse: $('#IsUse').combobox('getValue'),
  135. RoleID: $('#RoleID').combobox('getValue'),
  136. Email: $('#Email').val(),
  137. Phone: $('#Phone').val(),
  138. Remark: $('#Remark').val()
  139. };
  140.  
  141. $.ajax({
  142. url: '/System/CreateUser',
  143. type: 'POST',
  144. data: JSON.stringify(prod),
  145. dataType: 'json',
  146. processData: false,
  147. contentType: 'application/json;charset=utf-8',
  148. complete: function (data) {
  149. $('#dlg').dialog('close'); // close the dialog
  150. $('#dg').datagrid('reload'); // reload the user data
  151.  
  152. },
  153. success: function (data) {
  154. var t = data.flag;
  155. if (t) {
  156. $.messager.show({
  157. title: '提示信息',
  158. msg: '【系统提示】:操作成功!',
  159. style: {
  160. right: '',
  161. top: document.body.scrollTop + document.documentElement.scrollTop,
  162. bottom: ''
  163. }
  164. });
  165. Search(); //添加成功后加载数据
  166. }
  167. else {
  168. $.messager.show({
  169. title: '提示信息',
  170. msg: '【系统提示】:操作失败!',
  171. style: {
  172. right: '',
  173. top: document.body.scrollTop + document.documentElement.scrollTop,
  174. bottom: ''
  175. }
  176. });
  177. }
  178. },
  179. error: function () {
  180. $.messager.show({
  181. title: '提示信息',
  182. msg: '【系统提示】:操作失败!',
  183. style: {
  184. right: '',
  185. top: document.body.scrollTop + document.documentElement.scrollTop,
  186. bottom: ''
  187. }
  188. });
  189. }
  190. });
  191. }
  • 到此,用户管理模块完成,运行结果如下:

  

备注

  • 这一篇,我们完成了用户管理操作的代码编写,后面还有菜单管理和权限设置。代码都很基础,不过因为都是采用的异步处理,所以有些细节点还是要注意。源码已放入网盘,点此下载。整个运行效果如下:

  

  

EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(七)的更多相关文章

  1. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(一)

    前言 本系列源自对EF6 CodeFirst的探索,但后来发现在自己项目中构建的时候遇到了一些问题以及一些解决方法,因此想作为一个系列写下来. 本系列并不是教你怎么做架构设计,但可以参照一下里面的方法 ...

  2. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(六)

    前言 在接下来的篇幅里将对系统的模块功能进行编写.主要以代码实现为主.这一篇我们需要完成系统模块“角色管理”的相关功能.完成后可以对系统框架结构有进一步了解. Abstract层 之前说过,Abstr ...

  3. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(完)

    前言 这一篇是本系列的最后一篇,虽然示例讲到这里就停止呢,但对于这些技术的学习远不能停止.虽然本示例讲的比较基础,但是正如我第一篇说到的,这个系列的目的不是说一些高端的架构设计,而是作为一个入门级,对 ...

  4. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(八)

    前言 本篇幅将对系统的菜单管理模块进行说明,系统的菜单采用树形结构,这样可以更好地方便层级设计和查看.本示例将说明如何通过EntityFramework读取递归的菜单树形结构,以及结合EasyUI的t ...

  5. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(四)

    前言 这一篇,我们终于到了讲解Entity Framework CodeFirst 的时刻了,首先创建实体对象模型,然后会通过配置Fluent API的方式来对实体对象模型进行完整的数据库映射操作. ...

  6. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(三)

    前言 在上一篇中,我们依靠着EasyUI强大的前端布局特性把前端登录界面和主界面给搭建完成了.这一篇我们就要尝试着把整个解决方案部署到云端呢,也就是Visual Studio Online(TFVC) ...

  7. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(二)

    前言 写完第一篇后,我一直在想接下来应该从哪一方面开始讲.后来我觉得不用那么死板的把每一个课程和大纲都列出来吧,毕竟我又不是教书的,呵呵...我觉得就像做实验一样,我们一部分一部分的完成,最后总个结果 ...

  8. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(九)

    前言 这一篇我们将完成系统的权限设置功能以及不同角色用户登录系统后动态加载菜单.注意:此示例权限只针对菜单级,如果园友需要更复杂的系统权限设置,可以拓展到按钮级或属性级. 用户的登录采用Form认证来 ...

  9. EF6 CodeFirst+Repository+Ninject+MVC4+EasyUI实践(五)

    前言 在编写代码的时候,我遇到了很多关于EntityFramework6的疑问,所以现在就提前把这些问题列出来做一下解答,以便在以后的代码编写过程中减少不必要的Bug. EntityFramework ...

随机推荐

  1. Mac OS Terminal 几个快捷键

    在Mac系统中几个键位组合可以使Terminal的操作更加灵活方便. 1.将光标移动到行首:ctrl + a 2.将光标移动到行尾:ctrl + e 3.清除屏幕:            ctrl + ...

  2. ffmpeg centos6.5上安装(测试 amr 转换为 mp3)

    1. 下载相关源码包 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz wget http://sourcefo ...

  3. 2016年12月30日 星期五 --出埃及记 Exodus 21:25

    2016年12月30日 星期五 --出埃及记 Exodus 21:25 burn for burn, wound for wound, bruise for bruise.以烙还烙,以伤还伤,以打还打 ...

  4. spring mybatis 事务配置及使用

    转自:http://kinglixing.blog.51cto.com/3421535/723870

  5. CSS3简单的小技巧:linear-gradient切角画册

    关于linear-gradient的语法就不多做介绍了网上到处都是,下面看个小例 我们先做一个渐变,使其让他旋转, <div class="example"> < ...

  6. ionic 中$ionicView.beforeEnter 事件的一个bug

    我在使用ionic写app的时候,需要使用$IonicView.beforeEnter事件,在页面进入前做一些事情,但是发现,它不起作用,很蛋疼,后来,看了别人做的app例子,也涉及到这个$Ionic ...

  7. property animation ( NineOldAndroid )

    区别一:需要的Anroid API level不一样 Property Animation需要Android API level 11的支持,而View Animation则是更早期的版本. 区别二: ...

  8. 微信小程序-位置坐标

    wx.getLocation(OBJECT) 获取当前的地理位置.速度. OBJECT参数说明: success返回参数说明: 示例代码: wx.getLocation({ type: 'wgs84' ...

  9. 利用JS制作简便计算器

    var d; var a=prompt("请输入数字"); a=parseInt(a); if(isNaN(a)){ alert("請輸入正確數字"); } e ...

  10. latex给表格添加注释

    给表格加注释的确是很多TeX用户不好用的地方,这里提供一个样式和代码,或许对于你的学习使用有所帮助,样式如下: 代码如下: \documentclass[11pt,a4paper,english]{a ...