aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-19 04:32:11 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-19 04:32:11 +0200
commitbbb32747564cc76a799bff2e24acc1621c6c74ee (patch)
tree4d7dc4d1027593cdb4f564534d6e99f165be9596 /Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator
parent466340a97f8a158570f84fc12238101ca9c124ec (diff)
downloadTango-bbb32747564cc76a799bff2e24acc1621c6c74ee.tar.gz
Tango-bbb32747564cc76a799bff2e24acc1621c6c74ee.zip
Roles and Permission EDrawMax + csv generator + pdf.
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config24
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs88
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs36
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj75
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config4
5 files changed, 227 insertions, 0 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config
new file mode 100644
index 000000000..4ef5218a0
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+ </startup>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs
new file mode 100644
index 000000000..9eb0fb7b6
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Entities;
+using Tango.CSV;
+
+namespace Tango.FSE.DPGraphGenerator
+{
+ class Program
+ {
+ private class RolePermission
+ {
+ public String Name { get; set; }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+
+ private class RoleModel
+ {
+ public String Name { get; set; }
+ public List<RolePermission> Permissions { get; set; }
+
+ public RoleModel()
+ {
+ Permissions = new List<RolePermission>();
+ }
+ }
+
+ static void Main(string[] args)
+ {
+ String outputFolder = Path.GetFullPath(@"..\..\..\Roles & Permissions");
+
+ Console.WriteLine($"Generating roles and permissions csv files to '{outputFolder}'...");
+
+ List<RoleModel> models = new List<RoleModel>();
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var roles = db.Roles.ToList();
+ var roles_permissions = db.RolesPermissions.ToList();
+ var permissions = db.Permissions.ToList();
+
+ foreach (var role in roles.Where(x => x.Name.Contains("FSE")).ToList())
+ {
+ RoleModel model = new RoleModel();
+ model.Name = role.Description;
+
+ List<Permission> role_permissions = role.RolesPermissions.Select(x => x.Permission).ToList();
+
+ foreach (var permission in role_permissions.OrderBy(x => x.Code))
+ {
+ model.Permissions.Add(new RolePermission() { Name = permission.Name.Replace("FSE_", "") });
+ }
+
+ models.Add(model);
+ }
+ }
+
+ Directory.CreateDirectory(outputFolder);
+
+ foreach (var model in models)
+ {
+ Console.WriteLine($"Generating role '{model.Name}'...");
+
+ using (DynamicCsvFile csvFile = new DynamicCsvFile(Path.Combine(outputFolder, $"{model.Name}.csv")))
+ {
+ csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = model.Name });
+
+ foreach (var permission in model.Permissions)
+ {
+ csvFile.Append(permission);
+ }
+ }
+ }
+
+ Console.WriteLine();
+ Console.WriteLine("Done!, press return to exit...");
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..4cec0e5fd
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango.FSE.DPGraphGenerator")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.FSE.DPGraphGenerator")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c57d9d68-336c-4665-9ef4-ec1bdbb84885")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj
new file mode 100644
index 000000000..ae2b84d7c
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{C57D9D68-336C-4665-9EF4-EC1BDBB84885}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>Tango.FSE.DPGraphGenerator</RootNamespace>
+ <AssemblyName>Tango.FSE.DPGraphGenerator</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.CSV\Tango.CSV.csproj">
+ <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project>
+ <Name>Tango.CSV</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config
new file mode 100644
index 000000000..b3daf0d6c
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+</packages> \ No newline at end of file