/// <summary> /// 加载所有分类 /// </summary> /// <returns></returns> public List <Entity.CusCategory> LoadCategory() { BLL.BaseBLL <Entity.CusCategory> bll = new BLL.BaseBLL <Entity.CusCategory>(); var oldData = bll.GetListBy(0, new List <BLL.FilterSearch>(), "SortNo Desc"); List <Entity.CusCategory> newData = new List <Entity.CusCategory>(); GetChilds(oldData, newData, null); foreach (var item in newData) { item.Title = StringHelper.StringOfChar(item.Depth - 1, " ") + "├ " + StringHelper.StringOfChar(item.Depth - 1, " ") + item.Title; } return(newData); }
/// <summary> /// 加载用户组 /// </summary> private void Load() { List <SelectListItem> userRoleList = new List <SelectListItem>(); userRoleList.Add(new SelectListItem() { Text = "全部组", Value = "0" }); BLL.BaseBLL <Entity.SysRole> bll = new BLL.BaseBLL <Entity.SysRole>(); foreach (var item in bll.GetListBy(0, new List <BLL.FilterSearch>(), null)) { userRoleList.Add(new SelectListItem() { Text = item.RoleName, Value = item.ID.ToString() }); } ViewData["sysuser_role"] = userRoleList; }
/// <summary> /// 加载所有分类select /// </summary> /// <returns></returns> public void LoadCategorySelect() { List <SelectListItem> selectList = new List <SelectListItem>(); selectList.Add(new SelectListItem() { Text = "选择父类", Value = "0" }); BLL.BaseBLL <Entity.CusCategory> bll = new BLL.BaseBLL <Entity.CusCategory>(); var oldData = bll.GetListBy(0, new List <BLL.FilterSearch>(), "SortNo Desc"); List <Entity.CusCategory> newData = new List <Entity.CusCategory>(); GetChilds(oldData, newData, null); foreach (var item in newData) { string text = StringHelper.StringOfChar(item.Depth - 1, "|--") + StringHelper.StringOfChar(item.Depth - 1, "|--") + item.Title; selectList.Add(new SelectListItem() { Text = text, Value = item.ID.ToString() }); } ViewData["CategoryList"] = selectList; }
public JsonResult UpdateRoute() { List <Models.ModelRoute> route_list = new List <Models.ModelRoute>(); #region 反射获取所有的控制路由 string path = IOHelper.GetMapPath("~/bin/Universal.Web.dll"); byte[] buffer = System.IO.File.ReadAllBytes(path); Assembly assembly = Assembly.Load(buffer); foreach (var type in assembly.ExportedTypes) { System.Reflection.MemberInfo[] properties = type.GetMembers(); foreach (var item in properties) { string controllerName = item.ReflectedType.Name.Replace("Controller", "").ToString(); string actionName = item.Name.ToString(); //访问路由 string route_map = controllerName.ToLower() + "/" + actionName.ToLower(); //是否是HttpPost请求 bool IsHttpPost = item.GetCustomAttributes(typeof(System.Web.Mvc.HttpPostAttribute), true).Count() > 0 ? true : false; object[] attrs = item.GetCustomAttributes(typeof(Framework.AdminPermissionAttribute), true); if (attrs.Length == 1) { Framework.AdminPermissionAttribute attr = (Framework.AdminPermissionAttribute)attrs[0]; route_list.Add(new Models.ModelRoute { Tag = attr.Tag, Desc = attr.Desc, IsPost = IsHttpPost, Route = route_map }); } } } #endregion BLL.BaseBLL <Entity.SysRoute> bll = new BLL.BaseBLL <Entity.SysRoute>(); var db_list = bll.GetListBy(0, new List <BLL.FilterSearch>(), null); foreach (var item in db_list) { var entity = route_list.Where(p => p.IsPost == item.IsPost && p.Route == item.Route).FirstOrDefault(); //如果数据库对应程序中不存在,则删除数据库里的 if (entity == null) { bll.Del(item); } else { //否则修改数据库里的DES之类的辅助说明 item.Desc = entity.Desc; item.Tag = entity.Tag; bll.Modify(item); } } foreach (var item in route_list) { var entity = bll.GetModel(p => p.IsPost == item.IsPost && p.Route == item.Route, null); if (entity == null) { var route = new Entity.SysRoute(); route.AddTime = DateTime.Now; route.Desc = item.Desc; route.IsPost = item.IsPost; route.Route = item.Route; route.Tag = item.Tag; bll.Add(route); } } AddAdminLogs(Entity.SysLogMethodType.Update, "更新权限数据"); WorkContext.AjaxStringEntity.msg = 1; WorkContext.AjaxStringEntity.msgbox = "success"; return(Json(WorkContext.AjaxStringEntity)); }
public ActionResult LogException() { BLL.BaseBLL <Entity.SysLogException> bll = new BLL.BaseBLL <Entity.SysLogException>(); return(View(bll.GetListBy(0, new List <BLL.FilterSearch>(), "AddTime desc", false))); }