Initialer Status

This commit is contained in:
Meik
2026-01-28 12:27:00 +01:00
commit 4112d6019f
35 changed files with 3478 additions and 0 deletions

81
.gitignore vendored Normal file
View File

@@ -0,0 +1,81 @@
# --------------------------------------------------------------------------------------------------
# Core Visual Studio / .NET build outputs
# --------------------------------------------------------------------------------------------------
bin/
obj/
[Bb]uild/
[Dd]ebug*/
[Rr]elease*/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
_ReSharper.*/
*.user
*.userosscache
*.suo
*.cache
*.pdb
*.mpdb
*.opendb
*.VC.db
*.vscode/
# --------------------------------------------------------------------------------------------------
# Package artefacts (NuGet, npm, etc.)
# --------------------------------------------------------------------------------------------------
/packages/
*.nupkg
*.snupkg
*.nuspec
package-lock.json
packages.config
npm-debug.log*
yarn-error.log
# --------------------------------------------------------------------------------------------------
# TFS / TFVC specific files and folders
# --------------------------------------------------------------------------------------------------
$tf/
*$tf/
*.tf
*.tfs
.tfignore
# --------------------------------------------------------------------------------------------------
# IDE tooling and workspace settings
# --------------------------------------------------------------------------------------------------
.vs/
.vscode/
*.swp
*.sln.docstates
*.VC.VC.opendb
.idea/
.DS_Store
Thumbs.db
# --------------------------------------------------------------------------------------------------
# Test results and profiling data
# --------------------------------------------------------------------------------------------------
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.trx
*.coverage
*.coveragexml
*.opencover.xml
*.dotCover
BenchmarkDotNet.Artifacts/
# --------------------------------------------------------------------------------------------------
# Miscellaneous recommended ignores
# --------------------------------------------------------------------------------------------------
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
*.tmp
*.temp
*.log
*.bak
*.orig
*.scc

View File

@@ -0,0 +1,71 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "F4SD - M42WebApi", "F4SDM42WebApi\F4SD - M42WebApi.csproj", "{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{01521575-9B5F-4E86-8F40-634119D46B9F}"
ProjectSection(SolutionItems) = preProject
SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "F4SD - Helper", "F4SDHelper\F4SD - Helper.csproj", "{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "F4SD - M42 UUX Workspace", "M42F4SDUUXWorkspace\F4SD - M42 UUX Workspace.shproj", "{C3D52A04-2461-4F35-8EDF-DE7226ADD677}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_and_copy|Any CPU = Debug_and_copy|Any CPU
Debug|Any CPU = Debug|Any CPU
Release_and_copy|Any CPU = Release_and_copy|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Debug_and_copy|Any CPU.ActiveCfg = Debug_and_copy|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Debug_and_copy|Any CPU.Build.0 = Debug_and_copy|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Release_and_copy|Any CPU.ActiveCfg = Release_and_copy|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Release_and_copy|Any CPU.Build.0 = Release_and_copy|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}.Release|Any CPU.Build.0 = Release|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Debug_and_copy|Any CPU.ActiveCfg = Debug|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Debug_and_copy|Any CPU.Build.0 = Debug|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Release_and_copy|Any CPU.ActiveCfg = Release_and_copy|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Release_and_copy|Any CPU.Build.0 = Release_and_copy|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EEEA7DD2-9C5A-4AAE-B5CA-77E4C7F1257B}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
M42F4SDUUXWorkspace\M42F4SDUUXWorkspace.projitems*{c3d52a04-2461-4f35-8edf-de7226add677}*SharedItemsImports = 13
M42F4SDUUXWorkspace\M42F4SDUUXWorkspace.projitems*{d8cbffca-0b43-4acc-80ea-c944e7420cee}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 5
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://consulting4it.visualstudio.com/
SccLocalPath0 = .
SccProjectUniqueName1 = F4SDHelper\\F4SD\u0020-\u0020Helper.csproj
SccProjectName1 = F4SDHelper
SccLocalPath1 = F4SDHelper
SccProjectUniqueName2 = F4SDM42WebApi\\F4SD\u0020-\u0020M42WebApi.csproj
SccProjectName2 = F4SDM42WebApi
SccLocalPath2 = F4SDM42WebApi
SccProjectUniqueName3 = M42F4SDUUXWorkspace\\F4SD\u0020-\u0020M42\u0020UUX\u0020Workspace.shproj
SccProjectName3 = M42F4SDUUXWorkspace
SccLocalPath3 = M42F4SDUUXWorkspace
SccProjectUniqueName4 = M42F4SDUUXWorkspace\\M42F4SDUUXWorkspace.projitems
SccProjectTopLevelParentUniqueName4 = M42F4SDUUXWorkspace\\F4SD\u0020-\u0020M42\u0020UUX\u0020Workspace.shproj
SccProjectName4 = M42F4SDUUXWorkspace
SccLocalPath4 = M42F4SDUUXWorkspace
EndGlobalSection
EndGlobal

11
F4SDHelper/App.config Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,500 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using static C4IT.Logging.cLogManager;
namespace C4IT.FASD.Base
{
public enum enumFasdInformationClass
{
Unknown = -1,
Main = 0,
Computer = 1,
User = 2,
Ticket = 3
}
public enum enumF4sdSearchResultClass
{
Unknown = -1,
Computer = 0,
User = 1,
Phone = 2,
Ticket = 3
}
public enum enumF4sdSearchResultStatus
{
Unknown = -1,
Inactive = 0,
Active = 1
}
public enum enumFasdValueType
{
Unknown = 0,
STRING = 1,
GUID = 2,
INT = 3,
BIGINT = 4,
FLOAT = 5,
DATETIME = 6,
VERSION = 7,
MD5 = 8,
SID = 9,
IPV4 = 10,
IPV6 = 11,
TEXT = 12,
BOOLEAN = 13,
AUTOID = 255
};
public enum enumFasdCharCaseType { none = 0, lower = 1, upper = 2 };
public enum enumFasdConfigurationType
{
unknown = 0,
commonIcons,
menuSections,
quickActions,
copyTemplates,
healthCard
}
public class cFasdApiConnectionInfo
{
public string ServerVersion { get; set; }
public string MinCockpitVersion { get; set; }
public UInt64 ConfigRevision { get; set; } = 0;
}
public class cAgentApiConfiguration
{
public string LogonUrl { get; set; }
public string ApiUrl { get; set; }
public string ClientId { get; set; }
public string ClientSecret { get; set; }
public int? OrganizationCode { get; set; }
[JsonIgnore]
public static cAgentApiConfiguration Instance { get; set; }
}
public class cFasdApiSearchResultDefault
{
public enumF4sdSearchResultClass Type { get; set; }
public string Name { get; set; }
public Guid id { get; set; }
public enumF4sdSearchResultStatus Status { get; set; } = enumF4sdSearchResultStatus.Unknown;
public Dictionary<string, string> Infos { get; set; } = null;
static public enumF4sdSearchResultClass getSearchClass(enumFasdInformationClass infoClass)
{
switch (infoClass)
{
case enumFasdInformationClass.User:
return enumF4sdSearchResultClass.User;
case enumFasdInformationClass.Computer:
return enumF4sdSearchResultClass.Computer;
default:
return enumF4sdSearchResultClass.Unknown;
}
}
}
public class cF4sdIdentityEntry
{
public enumFasdInformationClass Class { get; set; }
public Guid Id { get; set; }
public static enumFasdInformationClass GetFromSearchResult(enumF4sdSearchResultClass searchResult)
{
var infoClass = enumFasdInformationClass.Unknown;
switch (searchResult)
{
case enumF4sdSearchResultClass.Computer:
infoClass = enumFasdInformationClass.Computer;
break;
case enumF4sdSearchResultClass.User:
case enumF4sdSearchResultClass.Phone:
infoClass = enumFasdInformationClass.User;
break;
}
return infoClass;
}
}
public class cF4sdApiSearchResultRelation : cFasdApiSearchResultDefault
{
public DateTime LastUsed { get; set; }
public double UsingLevel { get; set; }
public List<cF4sdIdentityEntry> Identities { get; set; } = null;
}
public class cF4sdHealthCardRawDataRequest
{
public List<string> Tables { get; set; }
public List<cF4sdIdentityEntry> Identities { get; set; }
public int MaxAge { get; set; } = 14;
public DateTime RefTime { get; set; } = DateTime.Now.Date.ToUniversalTime();
}
public class cF4SDHealthCardRawData
{
public class cHealthCardTableColumn
{
public string ColumnName { get; set; }
public List<object> Values { get; set; } = new List<object>();
public bool IsIncomplete { get; set; } = false;
}
public class cHealthCardTable
{
public string Name { get; set; }
public int StartingIndex { get; set; } = 0;
public bool IsIncomplete { get; set; } = false;
public bool IsStatic { get; set; }
public DateTime[,] TimeFrames { get; set; }
public Dictionary<string, cHealthCardTableColumn> Columns { get; set; } = new Dictionary<string, cHealthCardTableColumn>();
}
public class cHealthCardDetailsTable
{
public string Name { get; set; }
public List<string> Columns { get; set; }
public Dictionary<int, List<object[]>> Values { get; set; }
}
public Guid Id { get; set; }
public Dictionary<string, cHealthCardTable> Tables { get; set; } = new Dictionary<string, cHealthCardTable>();
#region GetObjects
#region GetInteger
public static int? GetInteger(object Value, int? Default = null)
{
int? output = Default;
if (Value == null)
return output;
try
{
var valuetype = Value.GetType();
if (Value is int @int)
output = @int;
if (Value is Int64 @int64)
output = Convert.ToInt32(@int64);
else if (Value is double @double)
output = Convert.ToInt32(@double);
else if (Value is string @string)
{
if (int.TryParse(@string, out int parsedInt))
output = parsedInt;
else
output = Default;
}
}
catch (Exception E)
{
LogException(E);
}
return output;
}
public int? GetIntegerByAddressInfo(string TableName, string TableColumn, int index = 0, int? Default = null)
{
int? output = Default;
try
{
if (Tables.TryGetValue(TableName, out var selectedTable))
if (selectedTable.Columns.TryGetValue(TableColumn, out var selectedColumn))
output = GetInteger(selectedColumn.Values[index], Default);
}
catch (Exception E)
{
LogException(E);
}
return output;
}
#endregion
#region GetString
public static string GetString(object Value, string Default = null)
{
string output = Default;
try
{
if (Value is int @int)
output = Convert.ToString(@int);
else if (Value is double @double)
output = Convert.ToString(@double);
else if (Value is string @string)
output = @string;
}
catch (Exception E)
{
LogException(E);
}
return output?.ToString();
}
public string GetStringByAddressInfo(string TableName, string TableColumn, int index = 0, string Default = null)
{
string output = Default;
try
{
if (Tables.TryGetValue(TableName, out var selectedTable))
if (selectedTable.Columns.TryGetValue(TableColumn, out var selectedColumn))
output = GetString(selectedColumn.Values[index], Default);
}
catch (Exception E)
{
LogException(E);
}
return output;
}
#endregion
#region GetVersion
public static Version GetVersion(object Value, Version Default = null)
{
Version output = Default;
if (Value == null)
return output;
try
{
if (Value is string @string)
{
if (Version.TryParse(@string, out var tempVersionFromString))
output = tempVersionFromString;
}
}
catch (Exception E)
{
LogException(E);
}
return output;
}
public Version GetVersionByAddressInfo(string TableName, string TableColumn, int index = 0, Version Default = null)
{
Version output = Default;
try
{
if (Tables.TryGetValue(TableName, out var selectedTable))
if (selectedTable.Columns.TryGetValue(TableColumn, out var selectedColumn))
output = GetVersion(selectedColumn.Values[index], Default);
}
catch (Exception E)
{
LogException(E);
}
return output;
}
#endregion
#region GetDateTime
public static DateTime? GetDateTime(object Value, DateTime? Default = null)
{
DateTime? output = Default;
if (Value == null)
return output;
try
{
if (Value is DateTime time)
output = time;
else if (Value is string @string)
{
var tempOutput = Convert.ToDateTime(@string);
DateTime.SpecifyKind(tempOutput, DateTimeKind.Utc);
if (tempOutput != null)
output = tempOutput;
else
output = Default;
}
}
catch (Exception E)
{
LogException(E);
}
return output;
}
public DateTime? GetDateTimeByAddressInfo(string TableName, string TableColumn, int index = 0, DateTime? Default = null)
{
DateTime? output = Default;
try
{
if (Tables.TryGetValue(TableName, out var selectedTable))
if (selectedTable.Columns.TryGetValue(TableColumn, out var selectedColumn))
output = GetDateTime(selectedColumn.Values[index], Default);
}
catch (Exception E)
{
LogException(E);
}
return output;
}
#endregion
#region GetDouble
public static double? GetDouble(object Value, double? Default = null)
{
double? output = Default;
try
{
if (Value is int @int)
output = Convert.ToDouble(@int);
else if (Value is Int64 @int64)
output = Convert.ToDouble(@int64);
else if (Value is double @double)
output = @double;
else if (Value is string @string)
{
if (double.TryParse(@string, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US").NumberFormat, out double tempOutput))
output = tempOutput;
else
output = Default;
}
}
catch (Exception E)
{
LogException(E);
}
return output;
}
public double? GetDoubleByAddressInfo(string TableName, string TableColumn, int index = 0, double? Default = null)
{
double? output = Default;
try
{
if (Tables.TryGetValue(TableName, out var selectedTable))
if (selectedTable.Columns.TryGetValue(TableColumn, out var selectedColumn))
output = GetDouble(selectedColumn.Values[index], Default);
}
catch (Exception E)
{
LogException(E);
}
return output;
}
#endregion
#endregion
}
public class cApiM42TicketQueueInfo
{
public string QueueName { get; set; }
public Guid QueueID { get; set; }
}
public class cF4SDTicketSummary
{
public Guid TicketObjectId { get; set; }
public string Name { get; set; }
public string ActivityType { get; set; }
public string Summary { get; set; }
public string Sid { get; set; }
public string Status { get; set; }
public int StatusId { get; set; }
public string Urgency { get; set; }
public int UrgencyId { get; set; }
public string Impact { get; set; }
public int ImpactId { get; set; }
public string AssetCIName { get; set; }
public string AssetName { get; set; }
public string ServiceName { get; set; }
public Guid ServiceId { get; set; }
public bool IsPrimaryAccount { get; set; }
}
public class cF4SDTicket : cF4SDTicketSummary
{
public enum enumTicketCreationSource
{
Unknown = 0,
Mail = 1,
Phone = 2,
F4SD = 3
}
public class cTicketJournalItem
{
public DateTime CreationDate { get; set; }
public string Header { get; set; }
public string CreatedBy { get; set; }
public string DescriptionHtml { get; set; }
public string Description { get; set; }
public bool IsVisibleForUser { get; set; }
public Guid ActivityObjectId { get; set; }
public Guid JournalId { get; set; }
}
public Guid AffectedUserId { get; set; }
public Guid AssetId { get; set; }
public DateTime CreationDate { get; set; }
public DateTime? ClosingDate { get; set; }
public int CreationSourceId { get; set; }
public string CreationSource { get; set; }
public string Description { get; set; }
public string DescriptionHtml { get; set; }
public int PriorityId { get; set; }
public string Priority { get; set; }
public Guid CategoryId { get; set; }
public string Category { get; set; }
public string CategoryHierarchical { get; set; }
public string CIName { get; set; }
public string DirectLinkEdit { get; set; }
public Guid AssetCIId { get; set; }
public int AssetSKUAssetGroupId { get; set; }
public string AssetSKUAssetGroup { get; set; }
public int AssetSKUTypeId { get; set; }
public string AssetSKUType { get; set; }
public string DirectLinkPreview { get; set; }
public string DirectLinkClose { get; set; }
public string AffectedUser { get; set; }
public string SolutionHtml { get; set; }
public string Solution { get; set; }
public string AssetDomain { get; set; }
}
}

View File

@@ -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>{EB95E1FB-7A9E-4894-BD28-2D0BE2715EBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>C4IT.F4SDM</RootNamespace>
<AssemblyName>C4ITF4SDM42WebApiHelper</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_and_copy|AnyCPU'">
<OutputPath>bin\Release_and_copy\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<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="..\..\..\Common Code\Logging\C4IT.Logging.LogManager.cs">
<Link>Common\C4IT.Logging.LogManager.cs</Link>
</Compile>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Common\C4IT.FASD.Base.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,29 @@
using System.Reflection;
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("C4IT - F4SD - WebApi for M42")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[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("eb95e1fb-7a9e-4894-bd28-2d0be2715ebe")]
// 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.*")]

15
F4SDM42WebApi/App.config Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,143 @@
<?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>{D8CBFFCA-0B43-4ACC-80EA-C944E7420CEE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>C4IT.F4SDM</RootNamespace>
<AssemblyName>C4ITF4SDM42WebApi</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_and_copy|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug_and_copy\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_and_copy|AnyCPU'">
<OutputPath>bin\Release_and_copy\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Matrix42.Common, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Common.dll</HintPath>
</Reference>
<Reference Include="Matrix42.Contracts.Common, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Contracts.Common.dll</HintPath>
</Reference>
<Reference Include="Matrix42.Contracts.Platform, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Contracts.Platform.dll</HintPath>
</Reference>
<Reference Include="Matrix42.Contracts.ServiceManagement, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Contracts.ServiceManagement.dll</HintPath>
</Reference>
<Reference Include="Matrix42.Pandora.Contracts, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Pandora.Contracts.dll</HintPath>
</Reference>
<Reference Include="Matrix42.Services.Description.Contracts, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\Matrix42.Services.Description.Contracts.dll</HintPath>
</Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.OData, Version=5.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\System.Web.OData.dll</HintPath>
</Reference>
<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" />
<Reference Include="update4u.SPS.DataLayer, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\update4u.SPS.DataLayer.dll</HintPath>
</Reference>
<Reference Include="update4u.SPS.Utility, Version=12.0.3.3096, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>M42Libraries\update4u.SPS.Utility.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="cM42LogEntry.cs" />
<Compile Include="F4SDHelperService.cs" />
<Compile Include="F4SDM42WebApiController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\F4SDHelper\F4SD - Helper.csproj">
<Project>{eb95e1fb-7a9e-4894-bd28-2d0be2715ebe}</Project>
<Name>F4SD - Helper</Name>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="deploy.ps1" />
<None Include="packages.config" />
<None Include="SignSourceFiles.cmd" />
</ItemGroup>
<Import Project="..\M42F4SDUUXWorkspace\M42F4SDUUXWorkspace.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>@echo powershell -ExecutionPolicy Unrestricted $(ProjectDir)deploy.ps1 -ProjectDir $(ProjectDir) -SolutionDir $(SolutionDir) -OutDir $(OutDir) -ConfigurationName $(ConfigurationName)</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,377 @@
using C4IT.F4SDM;
using C4IT.FASD.Base;
using C4IT.Logging;
using Matrix42.Common;
using Matrix42.Contracts.ServiceManagement.ServiceContracts;
using Matrix42.Pandora.Contracts;
using Matrix42.Services.Description.Contracts;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.OData;
using System.Web.OData.Query;
using update4u.SPS.Utility.GlobalConfiguration;
using static C4IT.FASD.Base.cF4SDTicket;
using static C4IT.Logging.cLogManager;
namespace C4IT.F4SD
{
[RoutePrefix("api/C4ITF4SDWebApi")]
public partial class F4SDM42WebApiController : ApiController
{
public static bool IsInitialized { get; private set; } = false;
public static F4SDM42WebApiController defaultInstance;
//private readonly IIncidentService _incidentService;
internal readonly GlobalConfigurationProvider _globalConfigurationProvider;
public readonly IJournalService _journalService;
//public readonly IObjectService _objectService;
//public readonly IFragmentService _fragmentService;
internal readonly IEntityDataService _entityDataService;
internal readonly IPandoraUserProfile _userProfile;
private readonly F4SDHelperService _f4stHelperService;
public string BaseUrl => $"{Request.RequestUri.Scheme}://{Request.RequestUri.Host}";
public string EndpointBaseUrl => $"{BaseUrl}/m42Services/api/c4itf4sdwebapi";
public F4SDM42WebApiController(
//IObjectService objectService,
//IIncidentService incidentService,
IJournalService journalService
//IFragmentService fragmentService,
, IEntityDataService entityDataService
, IPandoraUserProfile userProfile
)
{
defaultInstance = this;
//_objectService = objectService;
//_fragmentService = fragmentService;
//_incidentService = Guard.NullArgument(incidentService, "incidentService");
_entityDataService = entityDataService;
_journalService = journalService;
_globalConfigurationProvider = GlobalConfigurationProvider.Instance;
_f4stHelperService = new F4SDHelperService();
_userProfile = userProfile;
}
private static object initLock = new object();
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
try
{
//System.Diagnostics.Debugger.Launch();
lock (initLock)
{
if (IsInitialized || F4SDM42LogsWebApiController.IsInitialized)
return;
var Ass = Assembly.GetExecutingAssembly();
var LM = cLogManagerFile.CreateInstance(LocalMachine: true, A: Ass);
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
cLogManager.DefaultLogger.LogAssemblyInfo(Ass);
IsInitialized = true;
LogMethodEnd(CM);
}
}
catch { };
}
[Route("getDirectLinkCreateTicket"), HttpGet]
public async Task<F4SDHelperService.DirectLink> getDirectLinkCreateTicket(string sid = "", string assetname = "")
{
await Task.Delay(0);
return await _f4stHelperService.getDirectLinkCreateTicket(sid, assetname);
}
[Route("getDirectLinkF4SD"), HttpGet]
public async Task<string> getDirectLinkF4SD(Guid EOID, string Type)
{
return await _f4stHelperService.getDirectLinkF4SD(EOID, Type);
}
[Route("getTicketList"), HttpGet]
public async Task<List<cF4SDTicketSummary>> getTicketList(
string sid,
int hours,
int queueoption = 0,
string queues = ""
)
{
// "HR:2a7e..." → Tuple("HR", "2a7e..."), dann UrlDecode
var decodedPairs = queues
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Select(part =>
{
var segments = part.Split(':');
if (segments.Length != 2)
return null;
var name = HttpUtility.UrlDecode(segments[0]);
var idStr = HttpUtility.UrlDecode(segments[1]);
return Guid.TryParse(idStr, out var guid)
? new cApiM42TicketQueueInfo { QueueName = name, QueueID = guid }
: null;
})
.Where(q => q != null)
.ToList();
// Nun weiterreichen an Service
return await _f4stHelperService.getTicketListByUser(
sid,
hours,
queueoption,
decodedPairs
);
}
[Route("getTicketDetails"), HttpGet]
public async Task<cF4SDTicket> getTicketDetails(Guid objectId)
{
var tickets = await _f4stHelperService.getTicketDetails(new List<Guid>() { objectId });
if (tickets.Count > 0)
return tickets[0];
else
return null;
}
[Route("getTicketHistory"), HttpGet]
public async Task<List<cTicketJournalItem>> getTicketHistory(Guid objectId)
{
return await _f4stHelperService.GetJournalEntries(objectId);
}
[Route("getTicketOverviewCounts"), HttpGet]
public async Task<F4SDHelperService.TicketOverviewCountsResult> getTicketOverviewCounts(string sid, string scope = "personal", string keys = "")
{
var parsedKeys = (keys ?? string.Empty)
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(key => key.Trim())
.Where(key => !string.IsNullOrWhiteSpace(key))
.ToList();
return await _f4stHelperService.getTicketOverviewCounts(sid, scope, parsedKeys);
}
[Route("getTicketOverviewRelations"), HttpGet]
public async Task<List<F4SDHelperService.TicketOverviewRelationDto>> getTicketOverviewRelations(string sid, string scope = "personal", string key = "", int count = 0)
{
return await _f4stHelperService.getTicketOverviewRelations(sid, scope, key, count);
}
/*
[Route("updateActivitySolution/{objectId}"), HttpPost]
public async Task<HttpResponseMessage> updateActivitySolution(Guid objectId, [FromBody] string SolutionHtml)
{
return new HttpResponseMessage
{
StatusCode = await _f4stHelperService.updateActivitySolution(objectId, SolutionHtml) ? HttpStatusCode.NoContent : HttpStatusCode.BadRequest,
};
}
*/
[Route("getPickup/{name}"), HttpGet]
//[CacheOutput(UseETAG = true)]
public async Task<HttpResponseMessage> getPickup(string name, [FromUri] EntityEnumerationVisibilityMode mode = EntityEnumerationVisibilityMode.None, [FromUri] Int32 group = -1)
{
await Task.Delay(0);
EntityEnumeration enumerationTemp = _entityDataService.GetEnumeration(name, mode);
var vals = enumerationTemp.Values;
if (group > -1)
{
vals = vals.Where(row => !row.Extentions.TryGetValue("StateGroup", out var stateGroup) || (ConvertHelper.ParseInt(stateGroup, 0) == group)).ToArray();
}
string[] columns = new string[] { "position" };
foreach (var item in vals)
{
item.Extentions = item.Extentions.Where(x => columns.Contains(x.Key.ToLower())).ToDictionary(x => x.Key, x => x.Value);
}
EntityEnumeration enumeration = new EntityEnumeration
{
Name = enumerationTemp.Name,
Values = vals.ToArray()
};
//CacheOutputAttribute.RegisterResponseEtag($"enum_{enumeration.Name}_{(int)mode}", $"{enumeration.Name}_{(int)mode}", cultureInvariant: false, userInvariant: true, val);
return Request.CreateResponse(HttpStatusCode.OK, enumeration);
}
[Route("getMyRoleMemberships", Order = 2), HttpGet]
public async Task<HttpResponseMessage> getMyRoleMemberships()
{
var User = _userProfile.GetInteractiveUserInfo();
var filter = AsqlHelper.BuildInCondition("ID", new Guid[] { User.Id });
return Request.CreateResponse(HttpStatusCode.OK, await _f4stHelperService.UserPermissionsInfo(filter));
}
[HttpGet]
[Route("getRoleMemberships", Order = 1)]
public async Task<HttpResponseMessage> getRoleMemberships([FromUri] GetRoleMembershipsRequest req)
{
var filter = "";
if (req.Id != null && req.Id.Value != Guid.Empty)
{
filter = AsqlHelper.BuildInCondition("ID", new Guid[] { req.Id.Value });
}
else if (!string.IsNullOrEmpty(req.Sid))
{
filter = AsqlHelper.BuildInCondition("Accounts.T(SPSAccountClassAD).Sid", new string[] { req.Sid });
}
else if (!string.IsNullOrEmpty(req.Upn))
{
filter = AsqlHelper.BuildInCondition("Accounts.T(SPSAccountClassAD).UserPrincipalName", new string[] { req.Upn });
}
if (!string.IsNullOrEmpty(filter))
{
return Request.CreateResponse(HttpStatusCode.OK, await _f4stHelperService.UserPermissionsInfo(filter));
}
else
{
return null;
}
}
public class GetRoleMembershipsRequest
{
public Guid? Id { get; set; }
public string Sid { get; set; }
public string Upn { get; set; }
public GetRoleMembershipsRequest() { }
}
[Route("isAlive"), HttpGet]
public HttpResponseMessage isAlive()
{
return new HttpResponseMessage(HttpStatusCode.NoContent);
}
[Route("loglevel"), HttpGet]
public async Task<string> setDebugMode(string debug = "0")
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
await Task.Delay(0);
DefaultLogger.Manager.Level = debug == "1" || debug.Equals("true", StringComparison.OrdinalIgnoreCase) ? LogLevels.Debug : LogLevels.Info;
return DefaultLogger.Manager.Level.ToString();
}
catch (Exception E)
{
LogException(E);
return null;
}
finally
{
LogMethodEnd(CM);
}
}
[Route("log"), HttpGet]
public HttpResponseMessage getLog(string download = "0", int count = 50, string filter = "")
{
try
{
return _f4stHelperService.privGetLog(download, count, Request, filter);
}
catch (Exception E)
{
LogException(E);
return null;
}
}
}
[RoutePrefix("api/C4ITF4SDWebApi/Logs")]
public partial class F4SDM42LogsWebApiController : ApiController
{
private readonly F4SDHelperService _f4stHelperService;
public static bool IsInitialized { get; private set; } = false;
private static object initLock = new object();
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
try
{
lock (initLock)
{
if (IsInitialized || F4SDM42WebApiController.IsInitialized)
return;
var Ass = Assembly.GetExecutingAssembly();
var LM = cLogManagerFile.CreateInstance(LocalMachine: true, A: Ass);
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
cLogManager.DefaultLogger.LogAssemblyInfo(Ass);
IsInitialized = true;
LogMethodEnd(CM);
}
}
catch { };
}
public F4SDM42LogsWebApiController()
{
_f4stHelperService = new F4SDHelperService();
}
[Route(""), HttpGet]
[EnableQuery]
public IEnumerable<cM42LogEntry> getLog2(ODataQueryOptions<cM42LogEntry> queryOptions)
{
try
{
IQueryable<cM42LogEntry> queryable = _f4stHelperService.privGetLog2().AsQueryable();
if (queryOptions.Filter != null)
{
queryable = queryOptions.Filter.ApplyTo(queryable, new ODataQuerySettings()).Cast<cM42LogEntry>();
}
return queryable;
}
catch (Exception E)
{
LogException(E);
return null;
}
}
[Route("$count")]
[HttpGet]
public int Log2Count(ODataQueryOptions<cM42LogEntry> queryOptions)
{
IQueryable<cM42LogEntry> queryable = _f4stHelperService.privGetLog2().AsQueryable();
if (queryOptions.Filter != null)
{
queryable = queryOptions.Filter.ApplyTo(queryable, new ODataQuerySettings()).Cast<cM42LogEntry>();
}
return queryable.Count();
}
[Route("{id}")]
[OperationType(OperationType.GetObject)]
public cM42LogEntry GetClass(int id)
{
return _f4stHelperService.privGetLog2(id);
}
}
public class cGetPropertyBody
{
public string TableName { get; set; }
public List<string> Columns { get; set; } = new List<string>();
public cGetPropertyBody() { }
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,29 @@
using System.Reflection;
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("C4IT - F4SD - WebApi for M42")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[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("d8cbffca-0b43-4acc-80ea-c944e7420cee")]
// 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.*")]

View File

@@ -0,0 +1,10 @@
set ProductName="C4IT First Aid Service Desk Matrix42 ESM Addon"
set SignTool=..\..\..\Common Code\Tools\signtool.exe
set TimeStamp=http://rfc3161timestamp.globalsign.com/advanced
"%SignTool%" sign /a /tr %TimeStamp% /td SHA256 /fd SHA256 /d %ProductName% ".\bin\Release\C4ITF4SDM42WebApi.dll" ".\bin\Release\C4ITF4SDM42WebApiHelper.dll"
pause

View File

@@ -0,0 +1,21 @@
using Matrix42.Services.Description.Contracts;
using System;
namespace C4IT.F4SDM
{
[DisplayName(Name = "Log Entry", Type = DisplayNameTypes.Static)]
public class cM42LogEntry
{
public string DisplayName
{
get => string.Format("Line {0}", LineNumber.ToString());
}
public DateTime date { get; set; }
public string ProcessId { get; set; }
public string logLvl { get; set; }
public string Theme { get; set; }
public string Message { get; set; }
[Identifier]
public int LineNumber { get; internal set; }
}
}

77
F4SDM42WebApi/deploy.ps1 Normal file
View File

@@ -0,0 +1,77 @@
#POSTBUILD powershell -ExecutionPolicy Unrestricted $(ProjectDir)deploy.ps1 -ProjectDir $(ProjectDir) -SolutionDir $(SolutionDir) -OutDir $(OutDir) -ConfigurationName $(ConfigurationName)
param([string]$OutDir,
[string]$ConfigurationName,
[string]$SolutionDir,
[string]$ProjectDir);
$copyAssembly = 0
$copyWorkspace = 0
$signAssembly = 1
$ProductName="C4IT - F4SD - WebApi for M42"
$targetPath = "\\srvwsm001.imagoverum.com\c$\Program Files (x86)\Matrix42\Matrix42 Workplace Management"
$minifyApi = "https://www.toptal.com/developers/javascript-minifier/api/raw"
#minify js file
$workdirPath = "$ProjectDir${OutDir}"
$workdirPathZip = "$workdirPath\zip"
Get-ChildItem -Path "$workdirPathZip" -File -Recurse | Remove-Item
Expand-Archive -Path "$workdirPath\F4SD - M42.zip" -DestinationPath $workdirPathZip
$buildDate = $((get-date).ToLocalTime()).ToString("yyyy-MM-dd")
$jsCode = Get-Content -Path "$workdirPath\F4SD.js" -Raw
$body = @{input=$jsCode}
$contentType = 'application/x-www-form-urlencoded'
$resp = Invoke-WebRequest -Method POST -Uri $minifyApi -body $body -ContentType $contentType
$workspaceVersion = (Get-Content -Raw -Path "$workdirPath\workspace.json" | ConvertFrom-Json).version
[IO.File]::WriteAllLines("$workdirPath\F4SD.min.js","/*v$workspaceVersion ($buildDate)*/" + $resp.Content)
$finalWorkspacePath = "$workdirPathZip\Files\WM\workspaces\C4IT_F4SD"
New-Item -ItemType Directory -Force -Path $finalWorkspacePath | out-null
Copy-Item "$workdirPath\F4SD.min.js" -Destination "$finalWorkspacePath"
Copy-Item "$workdirPath\F4SDIcons.svg" -Destination "$finalWorkspacePath"
Copy-Item "$workdirPath\workspace.json" -Destination "$finalWorkspacePath"
$finalAssemblyPath = "$workdirPathZip\Assemblies\svc\bin\"
New-Item -ItemType Directory -Force -Path $finalWorkspacePath | out-null
if($signAssembly -eq 1)
{
$SignTool="$SolutionDir\..\..\Workspaces\Common Code\Tools\signtool.exe"
$TimeStamp="http://rfc3161timestamp.globalsign.com/advanced"
& $SignTool sign /a /tr $TimeStamp /td SHA256 /fd SHA256 /d $ProductName C:\Users\dm134\source\repos\F4SDM42WebApi\F4SDM42WebApi\bin\Release\C4ITF4SDM42WebApi.dll C:\Users\dm134\source\repos\F4SDM42WebApi\F4SDM42WebApi\bin\Release\C4ITF4SDM42WebApiHelper.dll
}
Get-ChildItem -Path "$ProjectDir${OutDir}C4ITF4SD*" -Include *.dll | Copy-Item -Destination $finalAssemblyPath
Remove-Item "$workdirPath\F4SD - M42 v$workspaceVersion.zip"
Compress-Archive -Path "$workdirPathZip\*" -DestinationPath "$workdirPath\F4SD - M42 v$workspaceVersion.zip"
IF( $ConfigurationName -eq "Release_and_copy" -OR $ConfigurationName -eq "Debug_and_copy" )
{
#Copy Assembly
if($copyAssembly -eq 1)
{
Get-ChildItem -Path "$ProjectDir${OutDir}C4ITF4SD*" -Include *.dll | Copy-Item -Destination "$targetPath\svc\bin\"
}
#Copy Workspace
if($copyWorkspace -eq 1)
{
$targetWorkspacePath = "$targetPath\WM\workspaces\C4IT_F4SD"
New-Item -ItemType Directory -Force -Path $targetWorkspacePath | out-null
Get-ChildItem -Path "$finalWorkspacePath\*" -Include * | Copy-Item -Destination $targetWorkspacePath
}
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>c3d52a04-2461-4f35-8edf-de7226add677</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="M42F4SDUUXWorkspace.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

Binary file not shown.

108
M42F4SDUUXWorkspace/F4SD.js Normal file
View File

@@ -0,0 +1,108 @@
(function (w) {
'use strict';
const icons = 'c4it-f4sd-icons';
w.mx = w.mx || {};
w.mx.workspacesConfig = w.mx.workspacesConfig || {};
w.mx.workspacesConfig.modules = w.mx.workspacesConfig.modules || {};
w.mx.workspacesConfig.modules.add = w.mx.workspacesConfig.modules.add || function (name, config) {
w.mx.workspacesConfig.modules[name] = config;
};
w.mx.workspacesConfig.modules.add('mx.C4IT.F4SD', {
name: 'mx.C4IT.F4SD',
config: ['$mdIconProvider', function ($mdIconProvider) {
$mdIconProvider.iconSet(icons, 'workspaces/C4IT_F4SD/F4SDIcons.svg');
w.mx.components = w.mx.components || {};
w.mx.components.Icons = w.mx.components.Icons || [];
w.mx.components.Icons.unshift({
id: icons,
name: 'C4IT F4SD Icons',
icons: [{
SVG: true,
id: `${icons}:icon-f4sd`,
name: 'F4SD Icon',
keywords: ['c4it', 'custom', 'f4sd']
}, {
SVG: true,
id: `${icons}:icon-f4sd-coloured`,
name: 'F4SD Icon (coloured)',
keywords: ['c4it', 'custom', 'f4sd']
}]
});
}]
});
})(window);
(function (w) {
'use strict';
angular.module("mx.C4IT.F4SD")
.controller("mx.C4IT.F4SD.Actions.callF4SD", [
"mx.shell.Config",
"mx.SolutionBuilderAgent.Http",
"mx.shell.NotificationService",
"mx.internationalization",
function (shellConfig, $http, notificationService, i18n) {
const vm = this;
const F4SD_URL_PREFIX = 'f4sdsend://localhost/';
const ERROR_INVALID_RESPONSE = "Invalid response from server";
const ERROR_SERVICE_UNAVAILABLE = "Service not available";
vm.restHost = shellConfig.settings.restHosts.default;
vm.messageF4SDOpened = i18n.get('c4it.f4sd.action-open-called') || 'F4SD wird geöffnet...';
vm.execute = function (conf, para) {
const eoid = conf[0]['Sys-ObjectId'] || conf[0].ID;
// Aktionsparameter abrufen
if (para.controllerParams) {
try {
vm.controllerParams = new URLSearchParams(para.controllerParams);
} catch (error) {
console.error('Fehler beim Parsen der Controller-Parameter:', error);
notificationService.error("Formatfehler in Aktionskonfigurationsparametern");
return;
}
} else {
vm.controllerParams = new URLSearchParams();
}
// F4SD-URL abrufen
const uri = new URL("api/c4itf4sdwebapi/getdirectlinkf4sd/", vm.restHost);
uri.searchParams.append("type", vm.controllerParams.get("type") || para.name);
uri.searchParams.append("eoid", eoid);
$http.get(uri.pathname + uri.search).then((response) => {
try {
const n = response.data || response;
if (typeof n !== 'string') {
console.error('Unerwartetes Datenformat:', n);
notificationService.error(ERROR_INVALID_RESPONSE);
return;
}
if (!n.startsWith(F4SD_URL_PREFIX)) {
notificationService.error(ERROR_SERVICE_UNAVAILABLE);
return;
}
if (vm.controllerParams.get("showNotification") === '1') {
notificationService.info(vm.messageF4SDOpened);
}
window.location.href = n;
} catch (error) {
console.error(`Fehler beim Verarbeiten der Antwort-URL: ${error}`);
notificationService.error(ERROR_SERVICE_UNAVAILABLE);
}
}).catch((error) => {
console.error('HTTP-Anfrage fehlgeschlagen:', error);
notificationService.error(ERROR_SERVICE_UNAVAILABLE);
});
};
}
]);
})(window);

View File

@@ -0,0 +1,21 @@
<svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-f4sd-coloured" viewBox="0 0 56.69 56.69">
<title>F4SD Icon (coloured)</title>
<rect fill="#1d4b99" width="56.69" height="56.69" rx="8.15"/>
<path fill="#fff" d="M46.06,34.3a1.77,1.77,0,0,0-.88,2.34A17.81,17.81,0,0,1,46.7,44a1.77,1.77,0,0,0,3.54,0,21.25,21.25,0,0,0-1.84-8.78A1.77,1.77,0,0,0,46.06,34.3Z"/>
<path fill="#fff" d="M33.66,26.57a1.77,1.77,0,0,0,2.2-1.16,1.82,1.82,0,0,0-1.17-2.24,22.72,22.72,0,0,0-6.34-.92A21.75,21.75,0,0,0,6.63,44a1.77,1.77,0,1,0,3.54,0A18.21,18.21,0,0,1,28.41,25.79,18.64,18.64,0,0,1,33.66,26.57Z"/>
<path fill="#fff" d="M42.17,27.18,25.87,39.3a5.53,5.53,0,0,0-1.78,1.48,5.29,5.29,0,0,0,4.61,8.44,5.17,5.17,0,0,0,3.54-1.81,5.47,5.47,0,0,0,1-1.63L42.7,27.71a.42.42,0,0,0-.28-.53A.36.36,0,0,0,42.17,27.18ZM28.35,46.35a2.27,2.27,0,0,1-2.45-2.08v-.05A2.31,2.31,0,0,1,28,41.74h0a2.37,2.37,0,0,1,2.48,2.16,2.31,2.31,0,0,1-2.15,2.45Z"/>
<path fill="#fff" d="M48.08,3.54H8.61A5,5,0,0,0,3.54,8.36v2.27H53.15V8.36A5,5,0,0,0,48.08,3.54Z"/>
<rect fill="#fff" x="3.65" y="13.75" width="49.43" height="2.48"/>
</symbol>
<symbol id="icon-f4sd" viewBox="0 0 56.69 56.69">
<title>F4SD Icon</title>
<path d="M46.06,34.3a1.77,1.77,0,0,0-.88,2.34A17.81,17.81,0,0,1,46.7,44a1.77,1.77,0,0,0,3.54,0,21.25,21.25,0,0,0-1.84-8.78A1.77,1.77,0,0,0,46.06,34.3Z"/>
<path d="M33.66,26.57a1.77,1.77,0,0,0,2.2-1.16,1.82,1.82,0,0,0-1.17-2.24,22.72,22.72,0,0,0-6.34-.92A21.75,21.75,0,0,0,6.63,44a1.77,1.77,0,1,0,3.54,0A18.21,18.21,0,0,1,28.41,25.79,18.64,18.64,0,0,1,33.66,26.57Z"/>
<path d="M42.17,27.18,25.87,39.3a5.53,5.53,0,0,0-1.78,1.48,5.29,5.29,0,0,0,4.61,8.44,5.17,5.17,0,0,0,3.54-1.81,5.47,5.47,0,0,0,1-1.63L42.7,27.71a.42.42,0,0,0-.28-.53A.36.36,0,0,0,42.17,27.18ZM28.35,46.35a2.27,2.27,0,0,1-2.45-2.08v-.05A2.31,2.31,0,0,1,28,41.74h0a2.37,2.37,0,0,1,2.48,2.16,2.31,2.31,0,0,1-2.15,2.45Z"/>
<path d="M48.08,3.54H8.61A5,5,0,0,0,3.54,8.36v2.27H53.15V8.36A5,5,0,0,0,48.08,3.54Z"/>
<rect x="3.65" y="13.75" width="49.43" height="2.48"/>
</symbol>
</defs>
</svg>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="SharedProjectFile_SccProperties">
<SharedProjectFile_ProjectGuid>{5915b31c-bc61-422e-ae50-8f337bf0b998}</SharedProjectFile_ProjectGuid>
<SharedProjectFile_SccProjectName>SAK</SharedProjectFile_SccProjectName>
<SharedProjectFile_SccAuxPath>SAK</SharedProjectFile_SccAuxPath>
<SharedProjectFile_SccLocalPath>SAK</SharedProjectFile_SccLocalPath>
<SharedProjectFile_SccProvider>SAK</SharedProjectFile_SccProvider>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>c3d52a04-2461-4f35-8edf-de7226add677</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>M42F4SDUUXWorkspace</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)F4SD.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)F4SDIcons.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)F4SD - M42.zip">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)workspace.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,7 @@
{
"description": "C4IT - F4SD - M42 ESM Integration",
"version": "1.0.0",
"resources": [
"F4SD.min.js"
]
}

9
SharedAssemblyInfo.cs Normal file
View File

@@ -0,0 +1,9 @@
using System.Reflection;
[assembly: AssemblyCompany("Consulting4IT GmbH, Germany")]
[assembly: AssemblyProduct("C4IT - F4SD - WebApi for M42")]
[assembly: AssemblyCopyright("Copyright © 2023, Consulting4IT GmbH, Germany")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("1.2.0.3")]
[assembly: AssemblyInformationalVersion("1.2.0.3")]