public async Task <IActionResult> GetRolePower(int id) { var result = await _permissionService.GetPermissionListTree(id) as ResultModel <DTreeModel>; DTreeModel dTree = result.Data; return(Json(dTree)); }
public async Task <IResultModel> GetPermissionListTree(int roleId = 0) { var permissions = await _permissionRepository.GetListAsync(new { IsDeleted = 0 }) as List <PermissionEntity>; DTreeModel dTree = new DTreeModel(); dTree.Data = _mapper.Map(permissions, dTree.Data); var permissionIds = (await _rolePermissionRepository.GetListAsync(new { roleId })).Select(a => a.PermissionId).ToList(); for (int i = 0; i < dTree.Data.Count; i++) { if (permissionIds.Contains(dTree.Data[i].Id)) { dTree.Data[i].CheckArr = "1"; } } return(ResultModel.Success(dTree)); }
// Methods. public bool Initialize(DSystemConfiguration configuration, IntPtr windowHandle, string appTitle, int testTimeSeconds) { try { // Create the input object. Input = new DInput(); // Initialize the input object. if (!Input.Initialize(configuration, windowHandle)) { return(false); } #region Initialize System // Create the Direct3D object. D3D = new DDX11(); // Initialize the Direct3D object. if (!D3D.Initialize(configuration, windowHandle)) { return(false); } // Create the timer object. Timer = new DTimer(); // Initialize the timer object. if (!Timer.Initialize()) { return(false); } // Create the position object. Position = new DPosition(); // Set the initial position. Position.SetPosition(0.0f, 7.0f, -11.0f); Position.SetRotation(20.0f, 0.0f, 0.0f); #endregion #region Initialize Camera // Create the camera object Camera = new DCamera(); // Create the light object. Light = new DLight(); // Initialize the light object. Light.GenerateOrthoMatrix(15.0f, 15.0f, SHADOWMAP_DEPTH, SHADOWMAP_NEAR); #endregion // Create the ground model object. GroundModel = new DModel(); // Initialize the ground model object. if (!GroundModel.Initialize(D3D.Device, "plane01.txt", "dirt.bmp", 2.0f)) { return(false); } // Set the position for the ground model. GroundModel.SetPosition(0.0f, 1.0f, 0.0f); // Create the tree object. TreeModel = new DTreeModel(); // Initialize the shadow shader object. if (!TreeModel.Initialize(D3D.Device, "trunk001.txt", "trunk001.bmp", "leaf001.txt", "leaf001.bmp", 0.1f)) { return(false); } // Set the position for the tree model. TreeModel.SetPosition(0.0f, 1.0f, 0.0f); // Create the render to texture object. RenderTexture = new DRenderTexture(); // Initialize the render to texture object. if (!RenderTexture.Initialize(D3D.Device, SHADOWMAP_WIDTH, SHADOWMAP_HEIGHT, SHADOWMAP_DEPTH, SHADOWMAP_NEAR)) { return(false); } // Create the depth shader object. DepthShader = new DDepthShader(); // Initialize the depth shader object. if (!DepthShader.Initialize(D3D.Device, windowHandle)) { return(false); } // Create the transparent depth shader object. TransparentDepthShader = new DTransparentDepthShader(); // Initialize the transparent depth shader object. if (!TransparentDepthShader.Initialize(D3D.Device, windowHandle)) { return(false); } // Create the shadow shader object. ShadowShader = new DShadowShader(); // Initialize the shadow shader object. if (!ShadowShader.Initialize(D3D.Device, windowHandle)) { return(false); } DPerfLogger.Initialize("WinForms C# SharpDX: " + configuration.Width + "x" + configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + " " + appTitle, testTimeSeconds, configuration.Width, configuration.Height); return(true); } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return(false); } }