Initial commit

parent ef09e6d4

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33513.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransferringLocationToAttribute", "TransferringLocationToAttribute\TransferringLocationToAttribute.csproj", "{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9D8C5641-96A1-48B0-93AF-4B8361B86A8A}
EndGlobalSection
EndGlobal
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("TransferringLocationToAttribute")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TransferringLocationToAttribute")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[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("4e9005d6-0b4e-45ae-b391-2f6dfa1b0916")]
// 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")]
using RnD.API;
using RnD.Attributes;
using RnD.Model;
using System.Linq;
namespace TransferringLocationToAttribute
{
[CustomFunction("TransferringLocationToAttributeCustomAction", RnD.Common.Enums.CustomFunctionType.CustomAction)]
public class TransferringLocationToAttributeCustomAction : AdvancedCustomFunction, ICustomAction<ICustomContext>
{
#region Constructors
public TransferringLocationToAttributeCustomAction(IAPI aAPI) : base(aAPI)
{
}
#endregion
#region Methods
public void Execute(ICustomContext aContext)
{
var entity = aContext.Entity;
if (entity is null)
{
Log.Error("entity was null");
return;
}
if (!(entity is ISample sample))
{
Log.Error("Entity is not sample");
return;
}
var locationId = DatabaseContext.RndvScLo.FirstOrDefault(c => c.SC == sample.ID).LO;
var locationName = DatabaseContext.RndvLoLang.FirstOrDefault(c => c.LO == locationId).DESCRIPTION;
var locationAttribute = DatabaseContext.RndvAu.Where(c => c.AU == 53).OrderByDescending(c => c.VERSION).FirstOrDefault(); // 53 - Id required attribute
if (locationAttribute == null)
{
Log.Error("Location attribute not found");
return;
}
var foundedScAu = DatabaseContext.RndvScAu.FirstOrDefault(c => c.AU == locationAttribute.AU && c.SC == sample.ID);
if (foundedScAu == null)
{
DatabaseContext.RndvScAu.Add(new RnD.Model.EF.RndvScAu
{
SC = (decimal)sample.ID,
AU = locationAttribute.AU,
AU_VERSION = locationAttribute.VERSION,
AUSEQ = locationAttribute.TR_SEQ,
VALUE = locationName
});
}
else
{
foundedScAu.VALUE = locationName;
}
DatabaseContext.SaveChanges();
}
#endregion
}
}
<?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>{4E9005D6-0B4E-45AE-B391-2F6DFA1B0916}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TransferringLocationToAttribute</RootNamespace>
<AssemblyName>TransferringLocationToAttribute</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<ItemGroup>
<Reference Include="EntityFramework">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\NLog.dll</HintPath>
</Reference>
<Reference Include="RDnL.Logger">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RDnL.Logger.dll</HintPath>
</Reference>
<Reference Include="RnD.BusinessLayer.EF">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.BusinessLayer.EF.dll</HintPath>
</Reference>
<Reference Include="RnD.BusinessLayer.Interfaces">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.BusinessLayer.Interfaces.dll</HintPath>
</Reference>
<Reference Include="RnD.Common">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.Common.dll</HintPath>
</Reference>
<Reference Include="RnD.Customizations.API">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.Customizations.API.dll</HintPath>
</Reference>
<Reference Include="RnD.Customizations.Interfaces">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.Customizations.Interfaces.dll</HintPath>
</Reference>
<Reference Include="RnD.Model.EF">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.Model.EF.dll</HintPath>
</Reference>
<Reference Include="RnD.SubstitutionSyntax">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.SubstitutionSyntax.dll</HintPath>
</Reference>
<Reference Include="RnD.Uniconnect">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnD.Uniconnect.dll</HintPath>
</Reference>
<Reference Include="RnDSuiteBackend">
<HintPath>..\..\..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\OpcenterRDnLLibrary_Builds\Siemens.OpcenterRDnLLibrary.Dependencies\RnDSuiteBackend.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="RDnL\TransferringLocationToAttributeCustomAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment