/// <summary> /// 分页数据 /// </summary> /// <param name="queryModel"></param> /// <returns></returns> public SoaDataPageResponse <FunctionModel> GetList(SoaDataPage <FunctionQueryModelRequest> queryModel) { SoaDataPageResponse <FunctionModel> response = new SoaDataPageResponse <FunctionModel>(); SoaDataPageResponse <Esmart_Sys_Functions> soa = FunctionDbAction.GetList(queryModel); List <FunctionModel> listFunction = new List <FunctionModel>(); if (soa.Body.Any()) { foreach (var li in soa.Body) { listFunction.Add(new FunctionModel() { AppId = li.AppId, CreateId = li.CreateId, CreateTime = li.CreateTime, FunctionId = li.FunctionId, FunctionKey = li.FunctionKey, FunctionName = li.FunctionName, Remark = li.Remark }); } } response.Body = listFunction; response.Count = soa.Count; return(response); }
public List <FunctionResponse> GetAllAndChoice(int appId, int navigationId) { var response = new List <FunctionResponse>(); var listFunction = FunctionDbAction.GetAllFunctions(appId); var listNavigation = NavigationFunctionDbAction.GetListByNavigationId(navigationId); var isNull = listNavigation != null && listNavigation.Any(); if (listFunction == null || !listFunction.Any()) { return(response); } foreach (var f in listFunction) { var function = new FunctionResponse { Id = f.FunctionId, Name = f.FunctionName }; if (isNull && listNavigation.Any(m => m.FunctionId == f.FunctionId)) { function.IsChoice = true; } else { function.IsChoice = false; } response.Add(function); } return(response); }
/// <summary> /// 更新 /// </summary> /// <param name="queryModel"></param> /// <returns></returns> public bool Update(FunctionModel queryModel) { Esmart_Sys_Functions functions = new Esmart_Sys_Functions() { AppId = queryModel.AppId, CreateId = queryModel.CreateId, FunctionKey = queryModel.FunctionKey, FunctionName = queryModel.FunctionName, Remark = queryModel.Remark, FunctionId = queryModel.FunctionId }; return(FunctionDbAction.Update(functions)); }
/// <summary> /// 新增 /// </summary> /// <param name="queryModel"></param> /// <returns></returns> public bool Add(FunctionModel queryModel) { Esmart_Sys_Functions functions = new Esmart_Sys_Functions() { AppId = queryModel.AppId, CreateId = queryModel.CreateId, CreateTime = DateTime.Now, FunctionKey = queryModel.FunctionKey, FunctionName = queryModel.FunctionName, Remark = queryModel.Remark }; return(FunctionDbAction.Add(functions)); }
public List <MenuResponse> GetMenus(int appId) { listData = Data.MenuManager.GetAllMenus(appId); listFunctions = FunctionDbAction.GetAllFunctions(appId); var listMenuFunctions = FunctionDbAction.GetMenusFunctions(listData.ConvertAll(a => a.NavigationId)); var firstMenus = listData.FindAll(a => a.ParentID == 0).ConvertAll(a => new MenuResponse() { Iconurl = a.Iconurl, Id = a.NavigationId, InClassName = a.InClassName, OutClassName = a.OutClassName, Url = a.Url, Name = a.Title }); SetList(listMenuFunctions, firstMenus); return(firstMenus); }
/// <summary> /// 获取一个实例by functionId /// </summary> /// <param name="functionId"></param> /// <returns></returns> public FunctionModel GetFunctionById(int functionId) { FunctionModel functionModel = new FunctionModel(); var dbFunction = FunctionDbAction.GetFunctionById(functionId); if (dbFunction != null) { functionModel.FunctionId = dbFunction.FunctionId; functionModel.AppId = dbFunction.AppId; functionModel.CreateId = dbFunction.CreateId; functionModel.CreateTime = dbFunction.CreateTime; functionModel.FunctionKey = dbFunction.FunctionKey; functionModel.FunctionName = dbFunction.FunctionName; functionModel.Remark = dbFunction.Remark; } return(functionModel); }
/// <summary> /// 删除 /// </summary> /// <param name="functionId"></param> /// <returns></returns> public bool Del(int functionId) { return(FunctionDbAction.Del(functionId)); }