Initial commit

parent d77f1401
<?xml version="1.0"?>
<doc>
<assembly>
<name>IntegraitonR3</name>
</assembly>
<members>
<member name="M:IntegraitonR3.Cryptography.AesExtensions.DecryptStringFromBytesAes(System.Byte[],System.Byte[],System.Byte[])">
<summary xml:lang="en">
Decrypt input line according by standart AES
</summary>
<summary xml:lang="ru">
Дешифрование входящей строки по стандарту AES
</summary>
</member>
<member name="T:IntegraitonR3.Commands.R3Commads">
<summary>
A set of commands for R3 integration
</summary>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.FillRThree(RnD.Model.ISample,IntegraitonR3.Models.PassportLayoutTable,System.Collections.Generic.List{IntegraitonR3.Models.PasportMainTable},RnD.Model.EF.RnDConnection)">
<summary>
Filling in the data model R3
</summary>
<param name="sample">Sampe model</param>
<param name="pasportLayoutTable">Pasport layout table model</param>
<param name="passportMainTables">Passport main table models</param>
<param name="databaseContext">Database context</param>
<returns></returns>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.SendPostRequestKssh(NLog.Logger,IntegraitonR3.Models.R3,IntegraitonR3.Models.RndaAuthorization,System.Nullable{System.Decimal})">
<summary>
Sending json to the data bus (KSSH)
</summary>
<param name="logger">Nlog logger</param>
<param name="rThree">R3 data model</param>
<param name="authInfo">Authorization data model</param>
<param name="sampleId">Sample id</param>
<returns>KeyValuePair of senging status messages, where the key is a short description and the value is a detailed one</returns>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.GetAuthorizationData(RnD.Model.EF.RnDConnection)">
<summary>
Getting authorization data model
</summary>
<param name="databaseContext">Database context</param>
<returns>Authorization data model</returns>
<exception cref="T:System.Exception">Error about the absence of authorization data in the database</exception>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.WriteSendStatus(RnD.Model.ISample,System.String)">
<summary>
Recording the status of sending to the info card
</summary>
<param name="sample">Sample data model</param>
<param name="message">Message for recording </param>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.JsonSerialization(IntegraitonR3.Models.R3)">
<summary>
Serialization of the data model R3 in json format
</summary>
<param name="rThree">R3 data model</param>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.AddCountingPoint(IntegraitonR3.Models.R3@)">
<summary>
Add counting point into R3 data model
</summary>
<param name="rThree">R3 data model</param>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.AddSamplingPlace(IntegraitonR3.Models.R3@,System.String)">
<summary>
Add sampling place into R3 data model
</summary>
<param name="rThree">R3 data model</param>
<param name="batchNumber">Bath number</param>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.BasicAuthorization(System.String,System.String)">
<summary>
Basic authorization
</summary>
<param name="login">Login</param>
<param name="password">Password</param>
<returns>Authentication header value</returns>
</member>
<member name="M:IntegraitonR3.Commands.R3Commads.NullOrEmptyFormatter(System.String)">
<summary>
Formatting empty values in a string
</summary>
<param name="line">string</param>
<returns>Formatted string</returns>
</member>
<member name="T:IntegraitonR3.Models.PasportMainTable">
<summary xml:lang="en">
Passport main layout table model
</summary>
<summary xml:lang="ru">
Модель таблицы основного паспорта
</summary>
</member>
<member name="T:IntegraitonR3.Models.PassportLayoutTable">
<summary xml:lang="en">
Passport layout table model
</summary>
<summary xml:lang="ru">
Модель таблицы макета паспорта
</summary>
</member>
<member name="T:IntegraitonR3.Models.RndaAuthorization">
<summary xml:lang="en">
R3 authorization model
</summary>
<summary xml:lang="ru">
R3 модель авторизация
</summary>
</member>
<member name="T:IntegraitonR3.Models.R3">
<summary xml:lang="en">
R3 model
</summary>
<summary xml:lang="ru">
R3 модель
</summary>
</member>
<member name="T:IntegraitonR3.Models.R3Qualitiy">
<summary xml:lang="en">
R3 quality data model
</summary>
<summary xml:lang="ru">
R3 модель показателя качества
</summary>
</member>
<member name="T:IntegraitonR3.Properties.Resources">
<summary>
A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
<member name="P:IntegraitonR3.Properties.Resources.ResourceManager">
<summary>
Returns the cached ResourceManager instance used by this class.
</summary>
</member>
<member name="P:IntegraitonR3.Properties.Resources.Culture">
<summary>
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
</summary>
</member>
<member name="P:IntegraitonR3.Properties.Resources.Key">
<summary>
Looks up a localized string similar to da983189246a4520a94764a751fa466a.
</summary>
</member>
<member name="T:IntegraitonR3.RDnL.ActionBarButtons.JsonGenerateRThree">
<summary>
Integration R3 button class
</summary>
</member>
<member name="M:IntegraitonR3.RDnL.ActionBarButtons.JsonGenerateRThree.Execute(System.Collections.Generic.List{RnD.Model.ICustomizationObject})">
<summary>
The method of clicking on the integration button
</summary>
<param name="aCustomisationObject">Custom object (expect Sample)</param>
<returns>Result of integration</returns>
</member>
<member name="M:IntegraitonR3.RDnL.ActionBarButtons.JsonGenerateRThree.GetActionBarButtonMetadata">
<summary>
Filling in button properties
</summary>
<returns>Button properties</returns>
</member>
</members>
</doc>
Russian
===================================================================================================
Вам нужно переместить два файла, которые находятся в папке /Core:
- IntegrationR3.dll
- IntegrationR3.pdb
пример пути к папке, куда установлен RDnL: C:\Users\Public\OpcenterRDnL\DynamicLibraries\Approved
===================================================================================================
English
===================================================================================================
You need to move two files, which are located in the folder /Core:
- IntegrationR3.dll
- IntegrationR3.pdb
to the folder where RDnL is installed example path: C:\Users\Public\OpcenterRDnL\DynamicLibraries\Approved
===================================================================================================
\ No newline at end of file
using System;
using System.IO;
namespace IntegraitonR3.Cryptography
{
public static class AesExtensions
{
public static string DecryptStringFromBytesAes(this byte[] cipherText, byte[] key, byte[] IV)
{
if (cipherText == null || cipherText.Length <= 0) throw new ArgumentNullException(nameof(cipherText));
if (key == null || key.Length <= 0) throw new ArgumentNullException(nameof(key));
if (IV == null || IV.Length <= 0) throw new ArgumentNullException(nameof(IV));
string plaintext = null;
using (var aesAlg = System.Security.Cryptography.Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = IV;
var decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
using (MemoryStream msDecrypt = new MemoryStream(cipherText))
{
using (var csDecrypt = new System.Security.Cryptography.CryptoStream(msDecrypt, decryptor, System.Security.Cryptography.CryptoStreamMode.Read))
{
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{
plaintext = srDecrypt.ReadToEnd();
}
}
}
}
return plaintext;
}
}
}
This diff is collapsed.
<?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>{41110DAF-C971-4BE6-A9EB-727E068B14FA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IntegraitonR3</RootNamespace>
<AssemblyName>IntegraitonR3</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>
<DocumentationFile>bin\Release\IntegraitonR3.xml</DocumentationFile>
</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>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Distr\OpcenterRDnL_9.1.0.0.3\Implementation\ABP\Opcenter_RDnL_V9.1.0.3_applied_best_practices\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</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>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<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="Commands\Cryptography\AesExtensions.cs" />
<Compile Include="Commands\R3Commad.cs" />
<Compile Include="Models\PasportMainTable.cs" />
<Compile Include="Models\PassportLayoutTable.cs" />
<Compile Include="Models\RndaAuthorization.cs" />
<Compile Include="Models\R3.cs" />
<Compile Include="Models\R3Qualitiy.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="RDnL\ActionBarButtons\JsonGenerateRThree.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetDir)$(TargetName).pdb" "%25Public%25\OpcenterRDnL\DynamicLibraries\Approved\" /F /R /Y /I
xcopy "$(TargetPath)" "%25Public%25\OpcenterRDnL\DynamicLibraries\Approved\" /F /R /Y /I</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
namespace IntegraitonR3.Models
{
/// <summary>
/// Passport main table data model
/// </summary>
public class PasportMainTable
{
public int number { get; set; }
public decimal PA { get; set; }
public string DESCRIPTION_RUS { get; set; }
public string METHOD_RUS { get; set; }
public string VALUE_RUS { get; set; }
public string NORM_STO_RUS { get; set; }
public string TP_TC { get; set; }
}
}
namespace IntegraitonR3.Models
{
/// <summary>
/// Passport layout table data model
/// </summary>
public class PassportLayoutTable
{
public decimal locationId { get; set; }
public string productName { get; set; }
public string batchNumber { get; set; }
public string passportNumber { get; set; }
public string passportIssueDate { get; set; }
public string userFullName { get; set; }
public string languageName { get; set; }
}
}
using Newtonsoft.Json;
using System.Collections.Generic;
namespace IntegraitonR3.Models
{
/// <summary>
/// R3 data model
/// </summary>
public class R3
{
[JsonProperty("Idpcmag")]
public int Idpcmag { get; set; }
[JsonProperty("IdPNPMag")]
public int IdPNPMag { get; set; }
[JsonProperty("KSSS")]
public string KSSS { get; set; }
[JsonProperty("Idunomenc")]
public int ProductCode { get; set; }
[JsonProperty("NameNomenc")]
public string ProductName { get; set; }
[JsonProperty("DocDateStr")]
public string PassportIssueDate { get; set; }
[JsonProperty("Docnumber")]
public string PassportNumber { get; set; }
//[JsonProperty("BatchNumber")]
//public string BatchNumber { get; set; }
[JsonProperty("Doctype")]
public string DocumentType { get; set; }
[JsonProperty("DocMode")]
public int DocumentMode { get; set; }
[JsonProperty("Idudate")]
public int SampleCode { get; set; }
[JsonProperty("Status")]
public string Status { get; set; }
[JsonProperty("Fio")]
public string FullName { get; set; }
[JsonProperty("Qualities")]
public List<R3Qualitiy> Qualities { get; set; } = new List<R3Qualitiy>();
}
}
using Newtonsoft.Json;
namespace IntegraitonR3.Models
{
/// <summary>
/// R3 quality data model
/// </summary>
public class R3Qualitiy
{
[JsonProperty("Npp")]
public int NumberParameter { get; set; }
[JsonProperty("Iduquality")]
public string Iduquality { get; set; }
[JsonProperty("NameQuality")]
public string NameQuality { get; set; }
[JsonProperty("NameUnit")]
public string NameUnit { get; set; }
[JsonProperty("SampleValue")]
public string SampleValue { get; set; }
[JsonProperty("Iduunit")]
public int UnitKSSSId { get; set; }
[JsonProperty("Norm")]
public string NormativeValue { get; set; }
[JsonProperty("In_Ok")]
public int CorrespondsNorm { get; set; }
}
}
namespace IntegraitonR3.Models
{
/// <summary>
/// Authorization data model
/// </summary>
public class RndaAuthorization
{
public string Login { get; set; }
public string Password { get; set; }
public string Url { get; set; }
}
}
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("IntegraitonR3")]
[assembly: AssemblyDescription("Creator by Sergey Bryzgalov (@l1sonnn)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PROF-IT Group")]
[assembly: AssemblyProduct("IntegraitonR3")]
[assembly: AssemblyCopyright("Created by Sergey Bryzgalov (@l1sonnn)")]
[assembly: AssemblyTrademark("PROF-IT Group")]
[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("41110daf-c971-4be6-a9eb-727e068b14fa")]
// 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")]
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace IntegraitonR3.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IntegraitonR3.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to da983189246a4520a94764a751fa466a.
/// </summary>
internal static string Key {
get {
return ResourceManager.GetString("Key", resourceCulture);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Key" xml:space="preserve">
<value>da983189246a4520a94764a751fa466a</value>
</data>
</root>
\ No newline at end of file
using IntegraitonR3.Models;
using NLog;
using RnD.API;
using RnD.Attributes;
using RnD.Common.Enums;
using RnD.Common.Model.ActionBarButtons;
using RnD.CustomFunctionTypes;
using RnD.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using IntegraitonR3.Commands;
using System.Data.SqlClient;
namespace IntegraitonR3.RDnL.ActionBarButtons
{
/// <summary>
/// Integration R3 button class
/// </summary>
[CustomFunction("IntegrationR3CutomActionBar")]
public class JsonGenerateRThree : AdvancedCustomFunction, ICustomActionBarButton
{
#region Constructors
public JsonGenerateRThree(IAPI aAPI) : base(aAPI) { }
#endregion
#region Methods
/// <summary>
/// The method of clicking on the integration button
/// </summary>
/// <param name="aCustomisationObject">Custom object (expect Sample)</param>
/// <returns>Result of integration</returns>
public ActionBarButtonResult Execute(List<ICustomizationObject> aCustomisationObject)
{
var sampleEntity = aCustomisationObject.FirstOrDefault(c => c is ISample) as ISample;
if (sampleEntity == null)
{
return new ActionBarButtonResult { Message = $"Объект не является пробой", MessageType = MessageType.Error };
}
var sample = API.Sample.GetSample(sampleEntity.ID);
var passportLayoutTable = DatabaseContext.Database
.SqlQuery<PassportLayoutTable>($"SELECT * FROM [RndSuite].[PasportLayoutTable] WHERE [SC] = @SampleId", new SqlParameter("@SampleId", sampleEntity.ID))
.FirstOrDefault(c => c.languageName == "RUS");
var passportMainTables = DatabaseContext.Database
.SqlQuery<PasportMainTable>($"SELECT * FROM [RndSuite].[PasportMainTable] WHERE [SC] = @SampleId", new SqlParameter("@SampleId", sampleEntity.ID))
.ToList();
if (passportLayoutTable == null)
{
return new ActionBarButtonResult { Message = $"Не найденны данные паспорта качества по пробе {sample.ShortDescription}", MessageType = MessageType.Error };
}
decimal permLocation = 2; //Location of Perm
if (passportLayoutTable.locationId != permLocation)
{
return new ActionBarButtonResult { Message = $"Локация паспорт качества не соответствует заданной", MessageType = MessageType.Error };
}
var logger = LogManager.GetCurrentClassLogger();
try
{
R3 rThree = R3Commads.FillRThree(sample, passportLayoutTable, passportMainTables, DatabaseContext); // RThree model formation
if (rThree.Qualities.Count == 0)
{
R3Commads.WriteSendStatus(sample, "Not filled in"); //Write send status to info field
return new ActionBarButtonResult { Message = "Отсутствуют передаваемые параметры.", MessageType = MessageType.Error };
}
#region Hardcode by technical task
R3Commads.AddCountingPoint(ref rThree);
R3Commads.AddSamplingPlace(ref rThree, passportLayoutTable.batchNumber);
#endregion
#region Send KSSH
RndaAuthorization authData = R3Commads.GetAuthorizationData(DatabaseContext); // Get auth data for authorization on web api
var message = R3Commads.SendPostRequestKssh(logger, rThree, authData, sample.ID); //Send post request to KSSH
#endregion
//#region Test json serializtion
//R3Commad.JsonSerialization(rThree); //Test serialization json on disk
//#endregion
R3Commads.WriteSendStatus(sample, message.Key); //Write send status to info field
var messageType = message.Key == "Failed" ? MessageType.Error : MessageType.Information;
return new ActionBarButtonResult { Message = message.Value, MessageType = messageType };
}
catch (Exception ex)
{
logger.Error(ex);
return new ActionBarButtonResult { Message = $"Внутренняя ошибка программы, {ex.Message}", MessageType = MessageType.Error };
}
}
/// <summary>
/// Filling in button properties
/// </summary>
/// <returns>Button properties</returns>
public ActionBarButtonMetadata GetActionBarButtonMetadata() =>
new ActionBarButtonMetadata
{
Description = "Передать ПК в R3",
Position = 5,
IconClass = "icon-cmdJson24",
DropdownIdentifier = "Экспорт ПК",
IsVisibleWhen = new List<ActionBarButtonVisibility> { ActionBarButtonVisibility.Sample },
};
#endregion
}
}
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\bin\Debug\IntegraitonR3.dll
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\bin\Debug\IntegraitonR3.pdb
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.csproj.AssemblyReference.cache
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.csproj.CoreCompileInputs.cache
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.dll
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.pdb
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.Properties.Resources.resources
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Debug\IntegraitonR3.csproj.GenerateResource.cache
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\bin\Release\IntegraitonR3.dll
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\bin\Release\IntegraitonR3.pdb
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.csproj.AssemblyReference.cache
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.Properties.Resources.resources
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.csproj.GenerateResource.cache
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.csproj.CoreCompileInputs.cache
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.dll
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\obj\Release\IntegraitonR3.pdb
C:\Bryzgalov\Projects\IntegraitonR3\IntegraitonR3\bin\Release\IntegraitonR3.xml
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
</packages>
\ No newline at end of file
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