Migrated projects to dotnet8

migrated all projects over to .net8
incomplete feature for gui shipments
This commit is contained in:
Bobbie Hodgetts
2024-11-20 16:37:42 +00:00
committed by GitHub
parent 270eebca9a
commit 7a12b49b44
78 changed files with 4127 additions and 1339 deletions

View File

@@ -1,18 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{CF330C30-8231-4D54-B60C-FF0644713502}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.ScheduledTasks", "src\bnhtrade.ScheduledTasks\bnhtrade.ScheduledTasks.csproj", "{5D6E1D66-3901-4340-95C6-EE65051AB623}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bnhtrade.ScheduledTasks", "src\bnhtrade.ScheduledTasks\bnhtrade.ScheduledTasks.csproj", "{5D6E1D66-3901-4340-95C6-EE65051AB623}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.Core", "src\bnhtrade.Core\bnhtrade.Core.csproj", "{339D7413-3DA7-46EA-A55C-255A9A6B95EB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bnhtrade.Core", "src\bnhtrade.Core\bnhtrade.Core.csproj", "{339D7413-3DA7-46EA-A55C-255A9A6B95EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.ComTypeLib", "src\bnhtrade.ComTypeLib\bnhtrade.ComTypeLib.csproj", "{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bnhtrade.ComTypeLib", "src\bnhtrade.ComTypeLib\bnhtrade.ComTypeLib.csproj", "{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{3D90C0F5-02E7-44E5-A89D-F5E217C6602F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bnhtrade.gui", "src\bnhtrade.gui\bnhtrade.gui.csproj", "{92788EE6-6B75-45BE-A0F3-9E4F51CDEB3F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -31,6 +32,10 @@ Global
{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Release|Any CPU.Build.0 = Release|Any CPU
{92788EE6-6B75-45BE-A0F3-9E4F51CDEB3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92788EE6-6B75-45BE-A0F3-9E4F51CDEB3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92788EE6-6B75-45BE-A0F3-9E4F51CDEB3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92788EE6-6B75-45BE-A0F3-9E4F51CDEB3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1 +0,0 @@
Build customizations (custom msbuild files/psake/fake/albacore/etc) scripts

View File

@@ -1,19 +0,0 @@
@set batchpath=%~dp0
@set dllpath=%batchpath%
::bnhtrade Database Client\bin\Release\
@copy "%dllpath%bnhtradeCOM.dll" "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
@copy "%dllpath%bnhtradeCOM.dll" "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
@c:
@cd\Windows\Microsoft.NET\Framework\v4.*
regasm.exe /codebase /tlb "bnhtradeCOM.dll"
@cd\Windows\Microsoft.NET\Framework64\v4.*
regasm.exe /codebase /tlb "bnhtradeCOM.dll"
@echo.
@echo Finished running regasm install script.
@echo.
@rem if no arguments passed, pause
@IF "%~1"=="" @pause

View File

@@ -1,7 +0,0 @@
@set mypath=%~dp0
call "%mypath%bnhtrade.ComTypeLib.RegAsmUninstall.bat" nopause
call "%mypath%bnhtrade.ComTypeLib.RegAsmInstall.bat" nopause
@echo Completed regasm refresh
@echo.
@pause

View File

@@ -1,17 +0,0 @@
@c:
@cd\Windows\Microsoft.NET\Framework\v4.*
regasm.exe /u "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
@cd\Windows\Microsoft.NET\Framework64\v4.*
regasm.exe /u "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
cd
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.tlb"
@del /q "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
@del /q "%SYSTEMROOT%\System32\bnhtradeCOM.tlb"
@echo.
@echo Finished running regasm uninstall script.
@rem if no arguments passed, pause
@echo.
@IF "%~1"=="" @pause

View File

@@ -1 +0,0 @@
Documentation stuff, markdown files, help files etc.

View File

@@ -1 +0,0 @@
Things that can NEVER exist in a nuget package

View File

@@ -35,26 +35,26 @@ namespace bnhtrade.ComTypeLib
public int AccountJournalInsert(ConnectionCredential sqlConnCred, int journalTypeId, DateTime entryDate,
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false)
{
return Core.Account.AccountQuery.AccountJournalInsert(sqlConnCred.ConnectionString, journalTypeId, entryDate,
return new Core.Logic.Account.Journal().AccountJournalInsert(journalTypeId, entryDate,
currencyCode, amount, debitAccountId, creditAccountId, lockEntry);
}
public bool AccountJournalDelete(ConnectionCredential sqlConnCred, int accountJournalId)
{
return Core.Account.AccountQuery.AccountJournalDelete(sqlConnCred.ConnectionString, accountJournalId);
return new Core.Logic.Account.Journal().AccountJournalDelete(accountJournalId);
}
[return: MarshalAs(UnmanagedType.Currency)]
public decimal CurrencyConvertToGbp(ConnectionCredential sqlConnCred, string currencyCode,
[MarshalAs(UnmanagedType.Currency)] decimal amount, DateTime conversionDate)
{
return Core.Account.AccountQuery.CurrencyConvertToGbp(sqlConnCred.ConnectionString, currencyCode, amount, conversionDate);
return new Core.Logic.Account.Currency().CurrencyConvertToGbp(currencyCode, amount, conversionDate);
}
public int CurrencyExchangeRateInsert(ConnectionCredential sqlConnCred, int exchangeRateSource, string currencyCode,
[MarshalAs(UnmanagedType.Currency)] decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false)
{
return Core.Account.AccountQuery.CurrencyExchangeRateInsert(sqlConnCred.ConnectionString, exchangeRateSource, currencyCode,
return new Core.Logic.Account.Currency().CurrencyExchangeRateInsert(exchangeRateSource, currencyCode,
currencyUnitsPerGbp, periodStart, periodEnd, checkOverride);
}
}

View File

@@ -1,16 +1,6 @@
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("bnhtrade COM Type Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("bnhtrade")]
[assembly: AssemblyProduct("bnhtradeCOMAsm")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -21,16 +11,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c3405e9d-b47a-4569-b6a3-bc9e7aa71ee5")]
// 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")]

View File

@@ -34,6 +34,70 @@
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.ProtectedData" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.60.3.0" newVersion="4.60.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.39.0.0" newVersion="1.39.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Identity" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.11.3.0" newVersion="1.11.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols.OpenIdConnect" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.JsonWebTokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory.Data" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>

View File

@@ -1,38 +1,19 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}</ProjectGuid>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bnhtrade.ComTypeLib</RootNamespace>
<AssemblyName>bnhtradeCOM</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\Debug\com\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Debug\</OutputPath>
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\Release\com\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<RegisterForComInterop>false</RegisterForComInterop>
</PropertyGroup>
@@ -40,54 +21,23 @@
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<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" />
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="Account\Account.cs" />
<Compile Include="Credential\ConnectionCredential.cs" />
<Compile Include="Ebay\EbayListing.cs" />
<Compile Include="Product\Product.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Purchase\PurchaseLine.cs" />
<Compile Include="Stock\Stock.cs" />
<Compile Include="Utility\LoadComObjextIntoStringArray.cs" />
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.31" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="_RegAsmInstall.bat" />
<None Include="_RegAsmRefresh.bat" />
<None Include="_RegAsmUninstall.bat" />
<None Include="ILRepack.targets" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj">
<Project>{339d7413-3da7-46ea-a55c-255a9a6b95eb}</Project>
<Name>bnhtrade.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<PostBuildEvent>copy "$(ProjectDir)_RegAsmInstall.bat" "$(TargetDir)"
copy "$(ProjectDir)_RegAsmRefresh.bat" "$(TargetDir)"
copy "$(ProjectDir)_RegAsmUninstall.bat" "$(TargetDir)"</PostBuildEvent>
<AssemblyTitle>bnhtrade COM Type Library</AssemblyTitle>
<Company>bnhtrade</Company>
<Product>bnhtradeCOMAsm</Product>
<Copyright>Copyright © 2019</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
<Import Project="..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.31" targetFramework="net472" developmentDependency="true" />
</packages>

View File

@@ -42,6 +42,70 @@
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.ProtectedData" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.60.3.0" newVersion="4.60.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.39.0.0" newVersion="1.39.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Identity" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.11.3.0" newVersion="1.11.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols.OpenIdConnect" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.JsonWebTokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory.Data" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -7,7 +7,6 @@ using System.IO;
using static FikaAmazonAPI.Utils.Constants;
using System.Linq;
using CsvHelper.Configuration;
using NUnit.Framework.Interfaces;
namespace bnhtrade.Core.Data.Amazon.Report
{

View File

@@ -86,6 +86,25 @@ namespace bnhtrade.Core.Data.Amazon.Report
ReportProcessingStatus = ProcessingStatus.NULL;
}
/// <summary>
/// Return a list of report that are currently available filtered parameters set in class
/// </summary>
/// <returns>report list</returns>
protected IList<FikaAmazonAPI.AmazonSpApiSDK.Models.Reports.Report> ListAvailableReports()
{
var parameters = new ParameterReportList();
parameters.reportTypes = new List<ReportTypes>() { reportType };
parameters.marketplaceIds.Add(amznConn.GetCurrentMarketplace.ID);
// request from amazon
return amznConn.Reports.GetReports(parameters);
}
/// <summary>
/// For reports that require a start and end period to report over.
/// </summary>
@@ -169,6 +188,22 @@ namespace bnhtrade.Core.Data.Amazon.Report
}
}
DownloadReport(reportId);
}
protected void DownloadByReportId(string reportId)
{
Init();
DownloadReport(reportId);
}
private void DownloadReport(string reportId)
{
if (report == null)
{
WaitWhileProcessing(reportId);
}
// test for processing status
if (report.ProcessingStatus == FikaAmazonAPI.AmazonSpApiSDK.Models.Reports.Report.ProcessingStatusEnum.DONE)
{
@@ -246,12 +281,19 @@ namespace bnhtrade.Core.Data.Amazon.Report
}
// save to file
string reportFilePath = Config.GetTempFileDirectoryPath() + @"\SP-API-Reports\ " + report.ReportType.ToString() + " reportId_" + reportId + ".txt";
string dirPath = Config.GetTempFileDirectoryPath() + @"\SP-API-Reports\";
System.IO.Directory.CreateDirectory(dirPath);
string reportFilePath = dirPath + report.ReportType.ToString() + " reportId_" + reportId + ".txt";
System.IO.File.WriteAllText(reportFilePath, reportString);
log.LogInformation("Amazon report #" + reportId + " sucessfully saved to disk.");
this.ReportFilePath = reportFilePath;
}
/// <summary>
/// If a duplicate report has been recently requested, Amazon may return 'FATAL'. This method tests for, and attempts to retrive the duplicate report that is causing the error.
/// </summary>

View File

@@ -1,6 +1,7 @@
using bnhtrade.Core.Data.Amazon.SellingPartnerAPI;
using FikaAmazonAPI;
using FikaAmazonAPI.Parameter.Report;
using FikaAmazonAPI.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,11 +11,9 @@ using static FikaAmazonAPI.Utils.Constants;
namespace bnhtrade.Core.Data.Amazon.Report
{
public class SettlementReport
public class SettlementReport : ReportLogic
{
private AmazonConnection amznConn = new SpApiConnection().Connection;
public SettlementReport ()
public SettlementReport () : base(ReportTypes.GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2)
{
}
@@ -25,28 +24,22 @@ namespace bnhtrade.Core.Data.Amazon.Report
public List<string> ListAvaliableReports()
{
UI.Console.WriteLine("Requesting list of avaliable settlement reports form Amazon SP-API");
var reportList = ListAvailableReports();
// set parameters
var parameters = new ParameterReportList();
parameters.reportTypes = new List<ReportTypes>() { ReportTypes.GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2};
parameters.marketplaceIds.Add(amznConn.GetCurrentMarketplace.ID);
// request from amazon
var result = amznConn.Reports.GetReports(parameters);
var returnList = new List<string>();
foreach (var report in result)
var reportIdList = new List<string>();
foreach (var report in reportList)
{
returnList.Add(report.ReportId);
reportIdList.Add(report.ReportId);
}
UI.Console.WriteLine("{0} Settlement reports avaible on Amazon SP-API");
return returnList;
return reportIdList;
}
public string GetFile(string reportId)
public string GetReportFile(string reportId)
{
return amznConn.Reports.GetReportFile(reportId);
DownloadByReportId(reportId);
return ReportFilePath;
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
//using System.Data.SqlClient;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

View File

@@ -0,0 +1,208 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace bnhtrade.Core.Data.Database.Account
{
internal class CreateJournal : Connection
{
/// <summary>
/// Old code needs sorting
/// </summary>
public int AccountJournalInsert(int journalTypeId, DateTime entryDate, string currencyCode,
decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false)
{
int defaultDebit = 0;
int defaultCredit = 0;
// ensure date is UTC
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
// debit and credit locks are checked in journal post method
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
// insert the journal entry
int journalId;
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournal
(AccountJournalTypeID, EntryDate, IsLocked)
OUTPUT INSERTED.AccountJournalID
VALUES
(@journalTypeId, @entryDate, @lockEntry)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@journalTypeId", journalTypeId);
cmd.Parameters.AddWithValue("@entryDate", entryDate.ToUniversalTime());
cmd.Parameters.AddWithValue("@lockEntry", lockEntry);
//execute
journalId = (int)cmd.ExecuteScalar();
}
// insert journal entries
//bool postResult = AccountJournalPostInsert(sqlConnectionString, journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
bool postResult = AccountJournalPostInsert(journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
scope.Complete();
return journalId;
}
}
/// <summary>
/// Old code needs sorting
/// </summary>
internal bool AccountJournalPostInsert(int journalId, DateTime entryDate,
string currencyCode, decimal amount, int debitAccountId = 0, int creditAccountId = 0)
{
int defaultDebit;
int defaultCredit;
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
// ensure their are no other entries
using (SqlCommand cmd = new SqlCommand(@"
SELECT
Count(tblAccountJournalPost.AccountJournalPostID) AS CountOfAccountJournalPostID
FROM
tblAccountJournalPost
WHERE
(((tblAccountJournalPost.AccountJournalID)=@AccountJournalID));
", conn))
{
cmd.Parameters.AddWithValue("@AccountJournalID", journalId);
int count = (int)cmd.ExecuteScalar();
if (count > 0)
{
throw new Exception("Unable the insert journal posts, post already present AccountJournalID=" + journalId);
}
}
//checks
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournalType.ChartOfAccountID_Debit, tblAccountJournalType.ChartOfAccountID_Credit
FROM
tblAccountJournal
INNER JOIN tblAccountJournalType
ON tblAccountJournal.AccountJournalTypeID = tblAccountJournalType.AccountJournalTypeID
WHERE
(((tblAccountJournal.AccountJournalID)=@journalId));
", conn))
{
cmd.Parameters.AddWithValue("@journalId", journalId);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
// debit check
if (reader.IsDBNull(0))
{
if (debitAccountId == 0)
{
throw new Exception("Debit Account ID required, default not set for journal type");
}
}
else
{
defaultDebit = reader.GetInt32(0);
if (debitAccountId == 0)
{
debitAccountId = defaultDebit;
}
else if (debitAccountId != defaultDebit)
{
throw new Exception("Debit Account ID supplied does not match default set for journal type");
}
}
// credit check
if (reader.IsDBNull(1))
{
if (creditAccountId == 0)
{
throw new Exception("Credit Account ID required, default not set for journal type");
}
}
else
{
defaultCredit = reader.GetInt32(1);
if (creditAccountId == 0)
{
creditAccountId = defaultCredit;
}
else if (creditAccountId != defaultCredit)
{
throw new Exception("Credit Account ID supplied does not match default set for journal type");
}
}
}
else
{
throw new Exception("AccountJournalID '" + journalId + "' does not exist.");
}
}
}
// currency conversion
if (currencyCode != "GBP")
{
amount = new Data.Database.Account.Currency().CurrencyConvertToGbp(currencyCode, amount, entryDate);
}
// ensure decimal is rounded
amount = Math.Round(amount, 2);
// insert debit post
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournalPost
(AccountJournalID, AccountChartOfID, AmountGbp)
VALUES
(@AccountJournalId, @AccountChartOfId, @AmountGbp)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@AccountJournalId", journalId);
cmd.Parameters.AddWithValue("@AccountChartOfId", debitAccountId);
cmd.Parameters.AddWithValue("@AmountGbp", amount);
cmd.ExecuteNonQuery();
}
// insert credit post
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournalPost
(AccountJournalID, AccountChartOfID, AmountGbp)
VALUES
(@AccountJournalId, @AccountChartOfId, @AmountGbp)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@AccountJournalId", journalId);
cmd.Parameters.AddWithValue("@AccountChartOfId", creditAccountId);
cmd.Parameters.AddWithValue("@AmountGbp", (amount * -1));
cmd.ExecuteNonQuery();
}
scope.Complete();
return true;
}
}
}
}

View File

@@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Data.Database.Account
{
internal class Currency : Connection
{
public decimal CurrencyConvertToGbp(string currencyCode, decimal amount, DateTime conversionDate)
{
if (currencyCode == "GBP" || amount == 0M)
{
return amount;
}
if (currencyCode.Length != 3)
{
throw new Exception("Invalid currency code '" + currencyCode + "'");
}
using (SqlConnection sqlConn = new SqlConnection(SqlConnectionString))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE CurrencyCode=@currencyCode AND StartDate<=@conversionDate AND EndDate>@conversionDate
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
cmd.Parameters.AddWithValue("@conversionDate", conversionDate);
object result = cmd.ExecuteScalar();
if (result != null)
{
return amount / Convert.ToDecimal(result);
}
}
// return reason for no record found
using (SqlCommand cmd = new SqlCommand(@"
SELECT CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE CurrencyCode=@currencyCode
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
object result = cmd.ExecuteScalar();
if (result == null)
{
throw new Exception("Currency code '" + currencyCode + "' does not exist in Exchange Rate table");
}
else
{
throw new Exception("Date range for " + currencyCode + " " + conversionDate.ToShortDateString() + " " +
conversionDate.ToLongTimeString() + "' does not exist in Exchange Rate table");
}
}
}
}
public int CurrencyExchangeRateInsert(int exchangeRateSource, string currencyCode,
decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false)
{
currencyUnitsPerGbp = decimal.Round(currencyUnitsPerGbp, 4);
periodStart = DateTime.SpecifyKind(periodStart, DateTimeKind.Utc);
periodEnd = DateTime.SpecifyKind(periodEnd, DateTimeKind.Utc);
// CHECKS
// HMRC source only
if (exchangeRateSource != 1)
{
throw new Exception("Function does not currently accept exchange rates from sources other than HMRC");
}
// currency code upper case only
currencyCode = currencyCode.ToUpper();
if (currencyCode.Length != 3)
{
throw new Exception("Invalid currency code '" + currencyCode + "'");
}
if (periodEnd <= periodStart)
{
throw new Exception("Invalid date period.");
}
if (checkOverride == false && (periodEnd - periodStart).Days > 31)
{
throw new Exception("Date period is greater than 31 days.");
}
// retirve previous data
DateTime? periodEndLast = null;
using (SqlConnection sqlConn = new SqlConnection(SqlConnectionString))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT Max(tblAccountExchangeRate.EndDate) AS MaxOfEndDate
FROM tblAccountExchangeRate
WHERE (((tblAccountExchangeRate.CurrencyCode) = @currencyCode))
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
object obj = cmd.ExecuteScalar();
// currency code not existing
if (obj == DBNull.Value && checkOverride == false)
{
throw new Exception("Currency code '" + currencyCode + "' does not exist in table");
}
// currency code exists
else
{
periodEndLast = DateTime.SpecifyKind(Convert.ToDateTime(obj), DateTimeKind.Utc);
if (periodStart != periodEndLast)
{
throw new Exception("Invalid period start date -- must equal previous period end-date.");
}
}
}
// retrive previous exchange rate and check
decimal currencyUnitsPerGbpLast = 0;
if (periodEndLast != null)
{
using (SqlCommand cmd = new SqlCommand(@"
SELECT tblAccountExchangeRate.AccountExchangeRateID, tblAccountExchangeRate.CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE (tblAccountExchangeRate.EndDate = @periodEndLast)
AND (CurrencyCode = @currencyCode);
", sqlConn))
{
cmd.Parameters.AddWithValue("@periodEndLast", periodEndLast);
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
using (var reader = cmd.ExecuteReader())
{
if (reader.Read())
{
currencyUnitsPerGbpLast = reader.GetDecimal(1);
}
else
{
throw new Exception("Error that shouldn't happen! Check code @ 5129f3e6-2f7e-4883-bc73-b317d8fa4050");
}
// error if >1 line
if (reader.Read())
{
string errText = "Multiple lines in currency exchange table for '" + currencyCode + "' where [EndDate]=" + periodEndLast.ToString();
new Logic.Log.LogEvent().LogError(errText);
throw new Exception(errText);
}
}
}
}
// check difference between current and previous exchange rates isn't too great
if (checkOverride == false &&
(currencyUnitsPerGbpLast > (currencyUnitsPerGbp * 1.05m) || currencyUnitsPerGbpLast < (currencyUnitsPerGbp * 0.95m))
)
{
throw new Exception("Difference between supplied and previous exchange rates is greater than 5%");
}
// MAKE THE INSERT
int recordId = 0;
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountExchangeRate (ExchangeRateSource, CurrencyCode, CurrencyUnitsPerGBP, StartDate, EndDate)
OUTPUT INSERTED.AccountExchangeRateID
VALUES (@exchangeRateSource, @currencyCode, @currencyUnitsPerGbp, @periodStart, @periodEnd);
", sqlConn))
{
cmd.Parameters.AddWithValue("@exchangeRateSource", exchangeRateSource);
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
cmd.Parameters.AddWithValue("@currencyUnitsPerGbp", currencyUnitsPerGbp);
cmd.Parameters.AddWithValue("@periodStart", periodStart);
cmd.Parameters.AddWithValue("@periodEnd", periodEnd);
recordId = (int)cmd.ExecuteScalar();
if (recordId < 1)
{
throw new Exception("Error inserting record, did not retrive new record ID.");
}
}
return recordId;
}
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace bnhtrade.Core.Data.Database.Account
{
internal class DeleteJournal : Connection
{
/// <summary>
/// Old code needs sorting
/// </summary>
public bool AccountJournalDelete(int accountJournalId)
{
// check if journal entry is locked
using (TransactionScope scope = new TransactionScope())
{
bool IsLocked = new Data.Database.Account.ReadJournal().EntryIsLocked(accountJournalId);
if (IsLocked == true)
{
return false;
}
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
// make the delete
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM tblAccountJournalPost
WHERE AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", accountJournalId);
int rows = cmd.ExecuteNonQuery();
if (rows == 0)
{
throw new Exception("Journal entry and/or entry posts do not exist for AccountJournalId=" + accountJournalId);
}
}
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM tblAccountJournal
WHERE AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", accountJournalId);
cmd.ExecuteNonQuery();
}
scope.Complete();
return true;
}
}
}
}
}

View File

@@ -10,7 +10,6 @@ namespace bnhtrade.Core.Data.Database.Account
public class ReadAccountCode : Connection
{
private Data.Database.SqlWhereBuilder sqlWhere = new SqlWhereBuilder();
private List<Model.Account.Account> resultList;
public ReadAccountCode()
{
@@ -27,26 +26,45 @@ namespace bnhtrade.Core.Data.Database.Account
var dictionary = new Dictionary<uint, Model.Account.Account>();
foreach (var item in list)
{
dictionary.Add(item.Id, item);
dictionary.Add(item.Value.Id, item.Value);
}
return dictionary;
}
public List<Model.Account.Account> ByAccountCode(List<int> accountCodeList)
public Dictionary<uint, Model.Account.Account> ByAccountId(List<uint> accountIdList)
{
Innit();
var resultDict = new Dictionary<uint, Model.Account.Account>();
if (accountIdList == null || !accountIdList.Any())
{
return resultDict;
}
sqlWhere.In("tblAccountChartOf.AccountChartOfID", accountIdList, " WHERE ");
resultDict = Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
return resultDict;
}
public Dictionary<uint, Model.Account.Account> ByAccountCode(List<int> accountCodeList)
{
Innit();
var resultDict = new Dictionary<uint, Model.Account.Account>();
if (accountCodeList == null || !accountCodeList.Any())
{
return resultList;
return resultDict;
}
sqlWhere.In("tblAccountChartOf.AccountCode", accountCodeList, " WHERE ");
return Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
resultDict = Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
return resultDict;
}
private List<Model.Account.Account> Execute(string sqlWhere, Dictionary<string, object> parameters)
private Dictionary<uint, Model.Account.Account> Execute(string sqlWhere, Dictionary<string, object> parameters)
{
var resultDict = new Dictionary<uint, Model.Account.Account>();
//build sql query
string sqlString = @"
SELECT tblAccountChartOf.AccountChartOfID
@@ -91,18 +109,18 @@ namespace bnhtrade.Core.Data.Database.Account
int multiplier = reader.GetInt32(6);
var result = new Model.Account.Account(tablePk, accountCode, title, description, type, basicType, multiplier);
resultList.Add(result);
resultDict.Add(tablePk, result);
}
}
return resultList;
}
}
}
return resultDict;
}
private void Innit()
{
resultList = new List<Model.Account.Account>();
sqlWhere.Init();
}
}
}

View File

@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadContact : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
public List<int> ContactIdList { get; set; }
public ReadContact()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
ContactIdList = new List<int>();
}
public Dictionary<int, Model.Account.Contact> Read()
{
var returnList = new Dictionary<int, Model.Account.Contact>();
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT [ContactID]
,[ContactName]
,[PaypalName]
,[PaypalEmail]
,[EbayUsername]
,[EbayEmail]
,[RecordCreated]
,[RecordModified]
FROM [e2A].[dbo].[tblContact]
WHERE 1=1 ";
// build the where statments
if (ContactIdList.Any())
{
sqlBuilder.In("[ContactID]", ContactIdList, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
int contactId = reader.GetInt32(0);
string contactName = null;
if (!reader.IsDBNull(1)) { contactName = reader.GetString(1); }
string paypalName = null;
if (!reader.IsDBNull(2)) { paypalName = reader.GetString(2); }
string paypalEmail = null;
if (!reader.IsDBNull(3)) { paypalEmail = reader.GetString(3); }
string ebayUsername = null;
if (!reader.IsDBNull(4)) { ebayUsername = reader.GetString(4); }
string ebayEmail = null;
if (!reader.IsDBNull(5)) { ebayEmail = reader.GetString(5); }
DateTime recordCreated = DateTime.SpecifyKind(reader.GetDateTime(6), DateTimeKind.Utc);
DateTime? recordModified = null;
if (!reader.IsDBNull(7)) { recordModified = DateTime.SpecifyKind(reader.GetDateTime(7), DateTimeKind.Utc); }
var contact = new Model.Account.Contact();
contact.ContactId = contactId;
contact.ContantName = contactName;
contact.ContactPaypalName = paypalName;
contact.ContactPaypalEmail = paypalEmail;
contact.ContactEbayName = ebayUsername;
contact.ContactEbayEmail = ebayEmail;
contact.Created = recordCreated;
contact.Modified = recordModified;
returnList.Add(contactId, contact);
}
}
}
}
}
return returnList;
}
}
}

View File

@@ -0,0 +1,242 @@
using FikaAmazonAPI.AmazonSpApiSDK.Models.CatalogItems;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Runtime.InteropServices.Marshalling;
using System.Text;
using System.Threading.Tasks;
using static System.ComponentModel.Design.ObjectSelectorEditor;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadJournal : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
/// <summary>
/// Filter the read results
/// </summary>
public List<uint> AccountJournalId { get; set; }
public ReadJournal()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
AccountJournalId = new List<uint>();
}
/// <summary>
///
/// </summary>
/// <returns>Dictionary were key is the table primary key</returns>
public Dictionary<uint, Core.Model.Account.Journal> Read()
{
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT tblAccountJournal.AccountJournalID
,tblAccountJournal.AccountJournalTypeID
,tblAccountJournal.EntryDate
,tblAccountJournal.PostDate
,tblAccountJournal.LastModified
,tblAccountJournal.IsLocked
,tblAccountJournalPost.AccountJournalPostID
,tblAccountJournalPost.AccountChartOfID
,tblAccountJournalPost.AmountGbp
FROM tblAccountJournal
INNER JOIN tblAccountJournalPost ON tblAccountJournal.AccountJournalID = tblAccountJournalPost.AccountJournalID
WHERE 1 = 1 ";
// build the where statments
if (AccountJournalId.Any())
{
sqlBuilder.In("tblAccountJournal.AccountJournalID", AccountJournalId, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
// build tuple list
var dbJournalList = new List<(
uint AccountJournalId
, uint AccountJournalTypeId
, DateTime EntryDate
, DateTime PostDate
, DateTime LastModified
, bool IsLocked
)>();
var dbJournalPostList = new List<(
uint AccountJournalId
, uint AccountJournalPostId
, uint AccountChartOfId
, decimal AmountGbp
)>();
bool hasRows = false;
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
hasRows = true;
uint lastJournalId = 0;
while (reader.Read())
{
// read journal header
uint journalId = (uint)reader.GetInt32(0);
if (journalId != lastJournalId)
{
lastJournalId = journalId;
(uint AccountJournalId
, uint AccountJournalTypeId
, DateTime EntryDate
, DateTime PostDate
, DateTime LastModified
, bool IsLocked
)
journal =
( journalId
, (uint)reader.GetInt32(1)
, DateTime.SpecifyKind(reader.GetDateTime(2), DateTimeKind.Utc)
, DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Utc)
, DateTime.SpecifyKind(reader.GetDateTime(4), DateTimeKind.Utc)
, reader.GetBoolean(5)
);
dbJournalList.Add(journal);
}
// read journal posts
(uint AccountJournalId
, uint AccountJournalPostId
, uint AccountChartOfId
, decimal AmountGbp
)
journalPost =
( journalId
, (uint)reader.GetInt32(6)
, (uint)reader.GetInt32(7)
, reader.GetDecimal(8)
);
dbJournalPostList.Add(journalPost);
}
}
}
}
}
var returnList = new Dictionary<uint, Core.Model.Account.Journal>();
if (hasRows)
{
// build lists to filter db results by
var journalTypeIdList = new List<uint>();
var accountIdList = new List<uint>();
foreach (var item in dbJournalList)
{
journalTypeIdList.Add(item.AccountJournalTypeId);
}
foreach (var item in dbJournalPostList)
{
accountIdList.Add(item.AccountChartOfId);
}
// get journalTypes from db
var dbJournalType = new Data.Database.Account.ReadJournalType();
dbJournalType.IdList = journalTypeIdList;
var journalTypeDict = dbJournalType.Read();
// get accounts from db
var dbAccount = new Data.Database.Account.ReadAccountCode();
var accountDict = dbAccount.ByAccountId(accountIdList);
// build final return dictionary
foreach (var dbJournal in dbJournalList)
{
// build posts
var newPosts = new List<Core.Model.Account.Journal.Post>();
foreach (var dbJournalPost in dbJournalPostList)
{
if (dbJournalPost.AccountJournalId == dbJournal.AccountJournalId)
{
var newPost = new Core.Model.Account.Journal.Post(
dbJournalPost.AccountJournalPostId
, accountDict[dbJournalPost.AccountChartOfId]
, dbJournalPost.AmountGbp);
newPosts.Add(newPost);
}
}
// create the journal
var newJournal = new Core.Model.Account.Journal(
dbJournal.AccountJournalId
, journalTypeDict[dbJournal.AccountJournalTypeId]
, newPosts
, dbJournal.EntryDate
, dbJournal.PostDate
, dbJournal.LastModified
, dbJournal.IsLocked);
returnList.Add(dbJournal.AccountJournalId, newJournal);
}
}
// all done, return the list herevar
return returnList;
}
/// <summary>
/// Test for locked journal entry
/// </summary>
/// <returns>False on locked journal entry</returns>
public bool EntryIsLocked(int journalId)
{
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournal.IsLocked
FROM
tblAccountJournal
WHERE
tblAccountJournal.AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
object obj = cmd.ExecuteScalar();
if (obj == null)
{
throw new Exception("Journal entry not found for AccountJournalID=" + journalId);
}
else
{
return (bool)obj;
}
}
}
}
}
}

View File

@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadJournalType : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
/// <summary>
/// Results filter
/// </summary>
public List<uint> IdList { get; set; }
/// <summary>
/// Searches for the specificed phases within the item description. Uses the LIKE AND sql function
/// </summary>
public List<string> TitleList { get; set; }
public ReadJournalType()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
IdList = new List<uint>();
TitleList = new List<string>();
}
/// <summary>
///
/// </summary>
/// <returns>Dictionary where key is the table primary key</returns>
public Dictionary<uint, Model.Account.JournalType> Read()
{
// create the return (emptyP list) here
var returnList = new Dictionary<uint, Model.Account.JournalType>();
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT [AccountJournalTypeID]
,[TypeTitle]
,[ChartOfAccountID_Debit]
,[ChartOfAccountID_Credit]
FROM [e2A].[dbo].[tblAccountJournalType]
WHERE 1 = 1 ";
// build the where statments
if (IdList.Any())
{
sqlBuilder.In("AccountJournalTypeID", IdList, "AND");
}
if (TitleList.Any())
{
sqlBuilder.In("TypeTitle", TitleList, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
// create dictionary to add credit/debit accounts on after db read
var creditDict = new Dictionary<uint, uint>();
var debitDict = new Dictionary<uint, uint>();
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
// read from db and create object
uint journalTypeId = (uint)reader.GetInt32(0);
string title = reader.GetString(1);
int? debitAccountId = null;
if (!reader.IsDBNull(2)) { debitAccountId = reader.GetInt32(2); }
int? creditAccountId = null;
if (!reader.IsDBNull(3)) { creditAccountId = reader.GetInt32(3); }
// build return list
var item = new Model.Account.JournalType(journalTypeId, title);
returnList.Add(journalTypeId, item);
// build dictionaries
if (debitAccountId != null)
{
debitDict.Add(journalTypeId, (uint)debitAccountId);
}
if (creditAccountId != null)
{
creditDict.Add(journalTypeId, (uint)creditAccountId);
}
}
}
}
}
}
// get account objects from db
var accountIdList = debitDict.Values.ToList();
accountIdList.AddRange(creditDict.Values.ToList());
var dbaccount = new Data.Database.Account.ReadAccountCode();
var dbDict = dbaccount.ByAccountId(accountIdList);
// add to the returnlist
foreach (var account in returnList.Values)
{
Model.Account.Account debitAccount = null;
if (debitDict.ContainsKey(account.JournalTypeId))
{
debitAccount = dbDict[debitDict[account.JournalTypeId]];
}
Model.Account.Account creditAccount = null;
if (creditDict.ContainsKey(account.JournalTypeId))
{
creditAccount = dbDict[creditDict[account.JournalTypeId]]; // key of 59 needed
}
account.AddDefaultAccounts(creditAccount, debitAccount);
}
// all done, return the list here
return returnList;
}
}
}

View File

@@ -0,0 +1,178 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.ComponentModel.Design.ObjectSelectorEditor;
namespace bnhtrade.Core.Data.Database.Account
{
public class ReadPurchaseInvoice : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
public List<int> PurchaseInvoiceIdList { get; set; }
public ReadPurchaseInvoice()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
PurchaseInvoiceIdList = new List<int>();
}
public Dictionary<int, Model.Account.PurchaseInvoice> Read()
{
var returnList = new Dictionary<int, Model.Account.PurchaseInvoice>();
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT tblPurchase.PurchaseID
,tblPurchase.PurchaseNumber
,tblPurchase.RecordID
,tblPurchase.PurchaseDate
,tblPurchase.ContactID
,tblPurchase.SupplierRef
,tblPurchase.PurchaseTotalAmount
,tblPurchase.VatInclusiveAmounts
,tblPurchase.RecordCreated
,tblPurchase.RecordModified
,tblPurchase.IsActive
,tblAccountCurrency.CurrencyCode
,tblPurchaseChannel.PurchaseChannelName
,tblPurchaseStatus.PurchaseStatus
FROM tblPurchase
LEFT OUTER JOIN tblAccountCurrency ON tblPurchase.AccountCurrencyID = tblAccountCurrency.AccountCurrencyID
LEFT OUTER JOIN tblPurchaseStatus ON tblPurchase.PurchaseStatusID = tblPurchaseStatus.PurchaseStatusID
LEFT OUTER JOIN tblPurchaseChannel ON tblPurchase.PurchaseChannelID = tblPurchaseChannel.PurchaseChannelID
WHERE 1 = 1
";
// build the where statments
if (PurchaseInvoiceIdList.Any())
{
sqlBuilder.In("[PurchaseID]", PurchaseInvoiceIdList, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
// dictionary so we can fill in details afterwards
var invoiceContactDict = new Dictionary<int, int>();
var purchaseIdList = new List<int>();
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
int purchaseID = reader.GetInt32(0);
int purchaseNumber = reader.GetInt32(1);
int? recordID = null;
if (!reader.IsDBNull(2)) { recordID = reader.GetInt32(2); }
DateTime purchaseDate = DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Utc);
int? contactID = null;
if (!reader.IsDBNull(4)) { contactID = reader.GetInt32(4);}
string supplierRef = null;
if (!reader.IsDBNull(5)) { supplierRef = reader.GetString(5);}
decimal? purchaseTotalAmount = null;
if (!reader.IsDBNull(6)) { purchaseTotalAmount = reader.GetDecimal(6);}
bool vatInclusiveAmounts = reader.GetBoolean(7);
DateTime recordCreated = DateTime.SpecifyKind(reader.GetDateTime(8), DateTimeKind.Utc);
DateTime recordModified = DateTime.SpecifyKind(reader.GetDateTime(9), DateTimeKind.Utc);
bool isActive = reader.GetBoolean(10);
string currencyCode = reader.GetString(11);
string purchaseChannelName = reader.GetString(12);
string purchaseStatus = null;
if (!reader.IsDBNull(13)) { purchaseStatus = reader.GetString(13);}
var invoice = new Model.Account.PurchaseInvoice();
invoice.PurchaseID = purchaseID;
invoice.PurchaseNumber = purchaseNumber;
invoice.RecordID = recordID;
invoice.PurchaseDate = purchaseDate;
invoice.SupplierRef = supplierRef;
//invoice.PurchaseTotalAmount = purchaseTotalAmount;
invoice.VatInclusiveAmounts = vatInclusiveAmounts;
invoice.RecordCreated = recordCreated;
invoice.RecordModified = recordModified;
invoice.IsActive = isActive;
invoice.CurrencyCode = currencyCode;
invoice.PurchaseChannel = purchaseChannelName;
// is there contact info that needs to be added?
if (contactID != null)
{
invoiceContactDict.Add(purchaseID, (int)contactID);
}
purchaseIdList.Add(purchaseID);
returnList.Add(purchaseID, invoice);
}
}
}
}
}
// add contact info
if (invoiceContactDict.Any())
{
var readContact = new Data.Database.Account.ReadContact();
readContact.ContactIdList = invoiceContactDict.Values.ToList();
var contactDict = readContact.Read();
if (contactDict.Any())
{
foreach ( var invoice in returnList)
{
if (invoiceContactDict.ContainsKey(invoice.Value.PurchaseID))
{
int contactId = invoiceContactDict[invoice.Value.PurchaseID];
invoice.Value.Contact = contactDict[contactId];
}
}
}
}
// add invoice lines
var readLines = new Data.Database.Account.ReadPurchaseInvoiceLine();
readLines.InvoiceIdList = purchaseIdList;
var lines = readLines.Read();
foreach(var invoice in returnList.Values)
{
foreach(var line in lines.Values)
{
if (line.PurchaseId == invoice.PurchaseID)
{
if (invoice.InvoiceLines == null)
{
invoice.InvoiceLines = new List<Model.Account.PurchaseInvoice.Line>();
}
invoice.InvoiceLines.Add(line);
}
}
}
return returnList;
}
}
}

View File

@@ -0,0 +1,212 @@
using Amazon.Runtime.Internal.Transform;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.ComponentModel.Design.ObjectSelectorEditor;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadPurchaseInvoiceLine : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
/// <summary>
/// Results filter
/// </summary>
public List<int> InvoiceIdList { get; set; }
/// <summary>
/// Results filter
/// </summary>
public List<int> InvoiceLineIdList { get; set; }
/// <summary>
/// Results filter
/// </summary>
public List<string> StatusList { get; set; }
/// <summary>
/// Searches for the specificed phases within the item description. Uses the LIKE AND sql function
/// </summary>
public List<string> ItemDescription { get; set; }
public ReadPurchaseInvoiceLine()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
InvoiceIdList = new List<int>();
InvoiceLineIdList = new List<int>();
StatusList = new List<string>();
ItemDescription = new List<string>();
}
public Dictionary<int, Model.Account.PurchaseInvoice.Line> Read()
{
var returnList = new Dictionary<int, Model.Account.PurchaseInvoice.Line>();
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT tblPurchaseLine.PurchaseLineID
,tblPurchaseLine.PurchaseID
,tblPurchaseLineStatus.PurchaseLineStatus
,tblPurchaseLine.SupplierRef
,tblPurchaseLine.CheckedIn
,tblPurchaseLine.ItemDescription
,tblPurchaseLine.ItemQuantity
,tblPurchaseLine.ItemGross
,tblPurchaseLine.ItemTax
,tblPurchaseLine.ShippingGross
,tblPurchaseLine.ShippingTax
,tblPurchaseLine.OtherGross
,tblPurchaseLine.OtherTax
,tblPurchaseLine.AccountTaxCodeID
,tblPurchaseLine.Tax_AccountTransactionID
,tblPurchaseLine.Net_AccountChartOfID
,tblPurchaseLine.Net_AccountTransactionID
,tblPurchaseLine.RecordCreated
,tblPurchaseLine.RecordModified
,tblPurchaseLine.IsActive
,tblAccountTaxCode.TaxCode
FROM tblPurchaseLine
INNER JOIN tblPurchaseLineStatus ON tblPurchaseLine.PurchaseLineStatusID = tblPurchaseLineStatus.PurchaseLineStatusID
LEFT OUTER JOIN tblAccountTaxCode ON tblPurchaseLine.AccountTaxCodeID = tblAccountTaxCode.AccountTaxCodeID
WHERE 1 = 1 ";
// build the where statments
if (InvoiceIdList.Any())
{
sqlBuilder.In("PurchaseID", InvoiceLineIdList, "AND");
}
if (InvoiceLineIdList.Any())
{
sqlBuilder.In("PurchaseLineID", InvoiceLineIdList, "AND");
}
if (StatusList.Any())
{
sqlBuilder.In("PurchaseLineStatus", InvoiceLineIdList, "AND");
}
if (ItemDescription.Any())
{
sqlBuilder.LikeAnd("ItemDescription", ItemDescription, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
// catch taxcode to add in after db read
var lineTaxCodeDict = new Dictionary<int, string>();
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
int purchaseLineID = reader.GetInt32(0);
int purchaseID = reader.GetInt32(1);
string purchaseLineStatus = reader.GetString(2);
string supplierRef = null;
if (!reader.IsDBNull(3)) { supplierRef = reader.GetString(3); }
DateTime? checkedIn = null;
if (!reader.IsDBNull(4)) { checkedIn = DateTime.SpecifyKind(reader.GetDateTime(4), DateTimeKind.Utc); }
string itemDescription = null;
if (!reader.IsDBNull(5)) { itemDescription = reader.GetString(5); }
int itemQuantity = reader.GetInt32(6);
decimal itemGross = 0;
if (!reader.IsDBNull(7)) { itemGross = reader.GetDecimal(7); }
decimal itemTax = 0;
if (!reader.IsDBNull(8)) { itemTax = reader.GetDecimal(8); }
decimal shippingGross = 0;
if (!reader.IsDBNull(9)) { shippingGross = reader.GetDecimal(9); }
decimal shippingTax = 0;
if (!reader.IsDBNull(10)) { shippingTax = reader.GetDecimal(10); }
decimal otherGross = 0;
if (!reader.IsDBNull(11)) { otherGross = reader.GetDecimal(11); }
decimal otherTax = 0;
if (!reader.IsDBNull(12)) { otherTax = reader.GetDecimal(12); }
int accountTaxCodeID = reader.GetInt32(13);
int? tax_AccountTransactionID = null;
if (!reader.IsDBNull(14)) { tax_AccountTransactionID = reader.GetInt32(14); }
int net_AccountChartOfID = reader.GetInt32(15);
int? net_AccountTransactionID = null;
if (!reader.IsDBNull(16)) { net_AccountTransactionID = reader.GetInt32(16); }
DateTime recordModified;
DateTime recordCreated = DateTime.SpecifyKind(reader.GetDateTime(17), DateTimeKind.Utc);
if (reader.IsDBNull(18)) { recordModified = recordCreated; }
else { recordModified = DateTime.SpecifyKind(reader.GetDateTime(18), DateTimeKind.Utc); }
bool isActive = reader.GetBoolean(19);
string accountTaxCode = reader.GetString(20);
var line = new Model.Account.PurchaseInvoice.Line();
line.PurchaseLineId = purchaseLineID;
line.PurchaseId = purchaseID;
line.Status = purchaseLineStatus;
line.SupplierRef = supplierRef;
line.CheckedIn = checkedIn;
line.ItemDescription = itemDescription;
line.ItemQuantity = itemQuantity;
line.ItemGross = itemGross;
line.ItemTax = itemTax;
line.ShippingGross = shippingGross;
line.ShippingTax = shippingTax;
line.OtherGross = otherGross;
line.OtherTax = otherTax;
line.Tax_AccountTransactionId = tax_AccountTransactionID;
line.Net_AccountChartOfId = net_AccountChartOfID;
line.Net_AccountTransactionId = net_AccountTransactionID;
line.RecordModified = recordModified;
line.RecordCreated = recordCreated;
line.IsActive = isActive;
returnList.Add(purchaseLineID, line);
lineTaxCodeDict.Add(purchaseLineID, accountTaxCode);
}
}
}
}
}
// read tax codes form db and add to return object
var taxcodeList = new Data.Database.Account.ReadTaxCode().GetByTaxCode(lineTaxCodeDict.Values.ToList());
foreach (var line in returnList.Values)
{
foreach(var taxcode in taxcodeList)
{
if (taxcode.TaxCode == lineTaxCodeDict[line.PurchaseLineId])
{
line.AccountTaxCode = taxcode;
break;
}
}
if (line.AccountTaxCode == null)
{
throw new Exception("Fail safe, this really shouodn't happen");
}
}
// all done
return returnList;
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadPurchaseInvoiceLineStatus : Connection
{
public Dictionary<int, Model.Account.PurchaseInvoiceLineStatus> Read()
{
var returnList = new Dictionary<int, Model.Account.PurchaseInvoiceLineStatus>();
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT [PurchaseLineStatusID]
,[PurchaseLineStatus]
,[ListSort]
,[TimeStamp]
FROM [e2A].[dbo].[tblPurchaseLineStatus]
ORDER BY [ListSort]
", conn))
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (!reader.HasRows)
{
// do something
}
else
{
while (reader.Read())
{
int id = reader.GetInt32(0);
string name = reader.GetString(1);
int lineSort = reader.GetInt32(2);
var returnItem = new Model.Account.PurchaseInvoiceLineStatus(id, name,lineSort);
returnList.Add(id, returnItem );
}
}
}
}
}
return returnList;
}
}
}

View File

@@ -0,0 +1,91 @@
using FikaAmazonAPI.AmazonSpApiSDK.Models.ProductFees;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.ComponentModel.Design.ObjectSelectorEditor;
namespace bnhtrade.Core.Data.Database.Account
{
internal class ReadPurchaseInvoiceLineSummary : Connection
{
public List<Model.Account.PurchaseInvoiceLineSummary> Read(DateTime periodTo, string lineStatus, List<string> descriptionSearch)
{
var returnList = new List<Model.Account.PurchaseInvoiceLineSummary>();
var sqlBuilder = new bnhtrade.Core.Data.Database.SqlWhereBuilder();
//build sql query
string sql = @"
SELECT tblPurchase.PurchaseDate
,tblPurchase.PurchaseID
,tblPurchase.PurchaseNumber
,tblPurchaseLine.PurchaseLineID
,tblPurchaseLine.ItemDescription
,tblPurchaseLineStatus.PurchaseLineStatus
FROM tblPurchase
INNER JOIN tblPurchaseLine ON tblPurchase.PurchaseID = tblPurchaseLine.PurchaseID
INNER JOIN tblPurchaseLineStatus ON tblPurchaseLine.PurchaseLineStatusID = tblPurchaseLineStatus.PurchaseLineStatusID
WHERE tblPurchase.PurchaseDate <= @purchaseDate
";
if (lineStatus != null)
{
sql = sql + " AND PurchaseLineStatus = @purchaseLineStatus ";
}
// build the where statments
if (descriptionSearch.Any())
{
sqlBuilder.LikeAnd("ItemDescription", descriptionSearch, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.AddWithValue("@purchaseDate", periodTo);
if (lineStatus != null)
{
cmd.Parameters.AddWithValue("@purchaseLineStatus", lineStatus);
}
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DateTime purchaseDate = DateTime.SpecifyKind(reader.GetDateTime(0), DateTimeKind.Utc);
int purchaseID = reader.GetInt32(1);
int purchaseNumber = reader.GetInt32(2);
int purchaseLineID = reader.GetInt32(3);
string itemDescription = reader.GetString(4);
string purchaseLineStatus = reader.GetString(5);
var item = new Model.Account.PurchaseInvoiceLineSummary();
item.PurchaseDate = purchaseDate;
item.PurchaseId = purchaseID;
item.PurchaseNumber = purchaseNumber;
item.PurchaseLineId = purchaseLineID;
item.ItemDescription = itemDescription;
item.LineStatus = purchaseLineStatus;
returnList.Add(item);
}
}
}
}
return returnList;
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace bnhtrade.Core.Data.Database.Account
{
internal class UpdateJournal : Connection
{
public bool AccountJournalPostUpdate(int journalId, string currencyCode, decimal amount, int debitAccountId = 0, int creditAccountId = 0)
{
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
// retrive journal entry date
DateTime entryDate;
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournal.EntryDate
FROM
tblAccountJournal
WHERE
(((tblAccountJournal.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
entryDate = DateTime.SpecifyKind((DateTime)cmd.ExecuteScalar(), DateTimeKind.Utc);
}
// delete the original posts
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM
tblAccountJournalPost
WHERE
(((tblAccountJournalPost.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
cmd.ExecuteNonQuery();
}
//insert new posts
//bool postResult = AccountJournalPostInsert(sqlConnectionString, journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
bool postResult = new Data.Database.Account.CreateJournal().AccountJournalPostInsert(journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
// update modified date on journal
using (SqlCommand cmd = new SqlCommand(@"
UPDATE
tblAccountJournal
SET
tblAccountJournal.LastModified=@utcNow
WHERE
(((tblAccountJournal.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
cmd.Parameters.AddWithValue("@utcNow", DateTime.UtcNow);
cmd.ExecuteNonQuery();
}
scope.Complete();
}
return true;
}
}
}

View File

@@ -104,7 +104,7 @@ namespace bnhtrade.Core.Data.Database.Export
cmd.Parameters.AddWithValue("@invoiceID", invoiceId);
cmd.Parameters.AddWithValue("@itemCode", invoiceList[i].InvoiceLineList[j].ItemCode);
cmd.Parameters.AddWithValue("@netAmount", invoiceList[i].InvoiceLineList[j].UnitAmount);
cmd.Parameters.AddWithValue("@accountCode", invoiceList[i].InvoiceLineList[j].AccountCode.AccountCode);
cmd.Parameters.AddWithValue("@accountCode", (int)invoiceList[i].InvoiceLineList[j].AccountCode.AccountCode);
cmd.Parameters.AddWithValue("@taxAmount", invoiceList[i].InvoiceLineList[j].TaxAmount);
cmd.Parameters.AddWithValue("@taxCode", invoiceList[i].InvoiceLineList[j].TaxCode.TaxCode);

View File

@@ -1,6 +1,5 @@
using FikaAmazonAPI.AmazonSpApiSDK.Models.Finances;
using FikaAmazonAPI.ConstructFeed.Messages;
using NUnit.Framework.Constraints;
using System;
using System.Collections.Generic;
using System.Data;
@@ -11,7 +10,7 @@ using System.Runtime.ConstrainedExecution;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
//using System.Web.UI.WebControls;
namespace bnhtrade.Core.Data.Database.Import
{

View File

@@ -9,7 +9,7 @@ using System.Transactions;
namespace bnhtrade.Core.Data.Database.Sku
{
public class InsertSku : Connection
internal class InsertSku : Connection
{
public int InsertNew(int productId, int conditionId, int accountTaxCodeId)
{

View File

@@ -64,6 +64,89 @@ namespace bnhtrade.Core.Data.Database
}
}
/// <summary>
/// Append an 'Like' statement (with AND between each like string) and parameter list to the class properties
/// </summary>
/// <param name="columnReference">Name of the column to used to for the condition statement</param>
/// <param name="phraseList">List of phrases to test in condition statement</param>
/// <param name="wherePrefix">Optional prefix that gets added to the sql string result</param>
public void LikeAnd(string columnReference, List<string> phraseList, string wherePrefix = null)
{
Like(columnReference, phraseList, true, wherePrefix);
}
/// <summary>
/// Append an 'Like' statement (with OR between each like string) and parameter list to the class properties
/// </summary>
/// <param name="columnReference">Name of the column to used to for the condition statement</param>
/// <param name="phraseList">List of phrases to test in condition statement</param>
/// <param name="wherePrefix">Optional prefix that gets added to the sql string result</param>
public void LikeOr(string columnReference, List<string> phraseList, string wherePrefix = null)
{
Like(columnReference, phraseList, false, wherePrefix);
}
private void Like(string columnReference, List<string> phraseList, bool isAnd, string wherePrefix = null)
{
if (phraseList == null || !phraseList.Any())
{
return;
}
// ensure no values are repeated
var distinctList = phraseList.ToList();
// clean the list
for (int i = 0; i < distinctList.Count; i++)
{
if (string.IsNullOrEmpty(distinctList[i]))
{
distinctList.RemoveAt(i);
i--;
}
}
// check again
if (distinctList == null || !distinctList.Any())
{
return;
}
string sqlWhere = @"
";
if (wherePrefix != null)
{
sqlWhere += wherePrefix;
}
int listCount = distinctList.Count();
for (int i = 0; i < listCount; i++, parameterCount++)
{
if (i > 0)
{
if (isAnd)
{
sqlWhere += " AND ";
}
else
{
sqlWhere += " OR ";
}
}
sqlWhere += " ( " + columnReference + " LIKE '%' + ";
string param = "@parameter" + parameterCount;
sqlWhere += param;
ParameterList.Add(param, distinctList[i]);
sqlWhere += " + '%' ) ";
}
SqlWhereString = SqlWhereString + sqlWhere;
}
/// <summary>
/// Append an 'In' statement and parameter list to the class properties
/// </summary>
@@ -126,5 +209,26 @@ namespace bnhtrade.Core.Data.Database
In(columnReference, stringList, wherePrefix);
}
/// <summary>
/// Append an 'In' statement and parameter list to the class properties
/// </summary>
/// <param name="columnReference">Name of the column to used to for the condition statement</param>
/// <param name="orValueList">List of values to test in condition statement</param>
/// <param name="wherePrefix">Optional prefix that gets added to the sql string result</param>
public void In(string columnReference, List<uint> orValueList, string wherePrefix = null)
{
var stringList = new List<string>();
if (orValueList != null || !orValueList.Any())
{
foreach (uint value in orValueList)
{
stringList.Add(value.ToString());
}
}
In(columnReference, stringList, wherePrefix);
}
}
}

View File

@@ -1,5 +1,4 @@
using NUnit.Framework.Internal;
using System;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Account
{
public class Currency
{
public decimal CurrencyConvertToGbp(string currencyCode, decimal amount, DateTime conversionDate)
{
return new Data.Database.Account.Currency().CurrencyConvertToGbp(currencyCode, amount, conversionDate);
}
public int CurrencyExchangeRateInsert(int exchangeRateSource, string currencyCode,
decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false)
{
return new Data.Database.Account.Currency().CurrencyExchangeRateInsert(exchangeRateSource, currencyCode,
currencyUnitsPerGbp, periodStart, periodEnd, checkOverride);
}
}
}

View File

@@ -35,7 +35,7 @@ namespace bnhtrade.Core.Logic.Account
public List<Model.Account.Account> ByAccountCode(List<int> accountCodeList)
{
return readAccountCode.ByAccountCode(accountCodeList);
return readAccountCode.ByAccountCode(accountCodeList).Values.ToList();
}
public Dictionary<int, Model.Account.Account> ConvertToDictionary(List<Model.Account.Account> accountCodeList)

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace bnhtrade.Core.Logic.Account
{
public class Journal
{
public int AccountJournalInsert(int journalTypeId, DateTime entryDate, string currencyCode,
decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false)
{
return new Data.Database.Account.CreateJournal().AccountJournalInsert(journalTypeId, entryDate, currencyCode,
amount, debitAccountId, creditAccountId, lockEntry);
}
public bool AccountJournalDelete(int accountJournalId)
{
return new Data.Database.Account.DeleteJournal().AccountJournalDelete(accountJournalId);
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Account
{
public class PurchaseInvoice : Core.Data.Database.Account.ReadPurchaseInvoice
{
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Account
{
public class PurchaseInvoiceMisc
{
public List<Model.Account.PurchaseInvoiceLineStatus> ReadLineStatusToList()
{
return new Data.Database.Account.ReadPurchaseInvoiceLineStatus().Read().Values.ToList();
}
public List<Model.Account.PurchaseInvoiceLineSummary> GetLineSummary(DateTime maxDate, string lineStatus, List<string> wordSearchList)
{
return new Data.Database.Account.ReadPurchaseInvoiceLineSummary().Read(maxDate,lineStatus, wordSearchList);
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Linq;
using bnhtrade.Core.Data.Amazon.Report;
using System.Linq;
namespace bnhtrade.Core.Logic.Import
{
@@ -10,6 +11,7 @@ namespace bnhtrade.Core.Logic.Import
public AmazonSettlement()
{
amazonReport = new Data.Amazon.Report.SettlementReport();
}
public void SyncDatabase()
@@ -53,12 +55,12 @@ namespace bnhtrade.Core.Logic.Import
}
// import into database
var dbImport = new Data.Database.Import.AmazonSettlementInsert();
var dbInsert = new Data.Database.Import.AmazonSettlementInsert();
for (int i = 0; i < spapiReportIdList.Count(); i++)
{
UI.Console.WriteLine("Importing settlement report " + (i + 1) + " of " + spapiReportIdList.Count() + " (ReportID:" + spapiReportIdList[i] + ").");
var filePath = amazonReport.GetFile(spapiReportIdList[i]);
bool ack = dbImport.ByFlatFile(filePath, spapiReportIdList[i]);
var filePath = amazonReport.GetReportFile(spapiReportIdList[i]);
bool ack = dbInsert.ByFlatFile(filePath, spapiReportIdList[i]);
log.LogInformation("Settlment Report imported (ReportID:" + spapiReportIdList[i] + ").");
}

View File

@@ -28,8 +28,10 @@ namespace bnhtrade.Core.Logic.Sku
{
return 0;
}
return new Data.Database.Sku.InsertSku().InsertNew(productId, conditionId, accountTaxCodeId);
else
{
return new Data.Database.Sku.InsertSku().InsertNew(productId, conditionId, accountTaxCodeId);
}
}
}
}

View File

@@ -5,7 +5,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using System.Web.UI;
namespace bnhtrade.Core.Logic.Stock
{

View File

@@ -4,7 +4,6 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace bnhtrade.Core.Model.Account
{

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class Contact
{
public int ContactId { get; set; }
public string ContantName { get; set; }
public string ContactEbayName { get; set; }
public string ContactEbayEmail { get; set; }
public string ContactPaypalName { get; set; }
public string ContactPaypalEmail { get; set; }
public DateTime Created { get; set; }
public DateTime? Modified { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class Journal : IValidatableObject
{
internal Journal(uint journalId, Core.Model.Account.JournalType type, List<Post> posts, DateTime entryDate, DateTime postDate, DateTime lastModifed, bool isLocked)
{
JournalId = journalId;
Type = type;
Posts = posts;
EntryDate = entryDate;
PostDate = postDate;
LastModified = lastModifed;
IsLocked = isLocked;
}
public uint JournalId { get; private set; }
public Core.Model.Account.JournalType Type { get; private set; }
public List<Post> Posts { get; private set; } = new List<Post>();
public DateTime EntryDate { get; private set; }
public DateTime PostDate { get; private set; }
public DateTime LastModified { get;private set; }
public bool IsLocked { get; private set; }
public class Post
{
internal Post(uint postId, Core.Model.Account.Account account, decimal amountGbp)
{
PostId = postId;
Account = account;
AmountGbp = amountGbp;
}
public uint PostId { get; private set; }
public Core.Model.Account.Account Account { get; private set; }
public decimal AmountGbp { get; private set; }
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
// get total of posts
decimal postTotal = 0;
foreach (var post in Posts)
{
postTotal = postTotal + post.AmountGbp;
}
if (postTotal != 0)
{
result.Add(new ValidationResult("Account journal posts do not equal zero"));
}
throw new NotImplementedException();
return result;
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class JournalType
{
internal JournalType(uint journalTypeId, string title, Model.Account.Account defaultCreditAccount = null, Model.Account.Account defaultDebitAccount = null)
{
JournalTypeId = journalTypeId;
Title = title;
DefaultCreditAccount = defaultCreditAccount;
DefaultDebitAccount = defaultDebitAccount;
}
internal void AddDefaultAccounts(Model.Account.Account defaultCreditAccount = null, Model.Account.Account defaultDebitAccount = null)
{
DefaultCreditAccount = defaultCreditAccount;
DefaultDebitAccount = defaultDebitAccount;
}
public uint JournalTypeId { get ; private set; }
public string Title { get; private set; }
public Model.Account.Account DefaultDebitAccount { get; private set; }
public bool IsSetDefaultDebitAccount
{
get { return DefaultDebitAccount != null; }
}
public Model.Account.Account DefaultCreditAccount { get; private set; }
public bool IsSetDefaultCreditAccount
{
get { return DefaultCreditAccount != null; }
}
}
}

View File

@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class PurchaseInvoice
{
public int PurchaseID { get; set; }
public int PurchaseNumber { get; set; }
public int? RecordID { get; set; }
public DateTime PurchaseDate { get; set; }
public Model.Account.Contact Contact { get; set; }
public string SupplierRef { get; set; }
public string AccountCurrency { get; set; }
public string PurchaseChannel { get; set; }
public string CurrencyCode { get; set; }
public decimal InvoiceNetAmount
{
get
{
return InvoiceGrossAmount - InvoiceTaxAmount;
}
}
public decimal InvoiceTaxAmount
{
get
{
decimal amount = 0;
foreach (var item in InvoiceLines)
{
amount = amount + item.LineTotalTax;
}
return amount;
}
}
public decimal InvoiceGrossAmount
{
get
{
decimal amount = 0;
foreach (var item in InvoiceLines)
{
amount = amount + item.LineTotalGross;
}
return amount;
}
}
/// <summary>
/// Value stored in database to check invoice lines against
/// </summary>
public decimal InvoiceGrossAmountCheck { get; set; }
/// <summary>
/// Don't know what this is for, all the amounts in the db are gross, so this is always true
/// </summary>
public bool VatInclusiveAmounts { get; set; }
public DateTime RecordCreated { get; set; }
public DateTime RecordModified { get; set; }
public bool IsActive { get; set; }
public List<Model.Account.PurchaseInvoice.Line> InvoiceLines { get; set; }
public class Line
{
public int PurchaseLineId { get; set; }
public int PurchaseId { get; set; }
public string Status { get; set; }
public string SupplierRef { get; set; }
public DateTime? CheckedIn { get; set; }
public string ItemDescription { get; set; }
public int ItemQuantity { get; set; }
public decimal ItemNet
{
get
{
return ItemGross - ItemTax;
}
}
public decimal ItemGross { get; set; }
public decimal ItemTax { get; set; }
public decimal ShippingNet
{
get
{
return ShippingGross - ShippingTax;
}
}
public decimal ShippingGross { get; set; }
public decimal ShippingTax { get; set; }
public decimal OtherNet
{
get
{
return OtherGross - OtherTax;
}
}
public decimal OtherGross { get; set; }
public decimal OtherTax { get; set; }
public decimal LineTotalNet
{
get
{
return (ItemGross + ShippingGross + OtherGross) - (ItemTax + ShippingTax + OtherTax);
}
}
public decimal LineTotalTax
{
get
{
return ItemTax + ShippingTax + OtherTax;
}
}
public decimal LineTotalGross
{
get
{
return ItemGross + ShippingGross + OtherGross;
}
}
public bnhtrade.Core.Model.Account.TaxCodeInfo AccountTaxCode { get; set; }
public int? Tax_AccountTransactionId { get; set; }
public int Net_AccountChartOfId { get; set; }
public int? Net_AccountTransactionId { get; set; }
public DateTime RecordCreated { get; set; }
public DateTime RecordModified { get; set; }
public bool IsActive { get; set; }
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class PurchaseInvoiceLineStatus
{
public PurchaseInvoiceLineStatus(int statusId, string statusName, int listSort)
{
PurchaseLineStatusId = statusId;
PurchaseLineStatusName = statusName;
ListSort = listSort;
}
public int PurchaseLineStatusId { get; private set; }
public string PurchaseLineStatusName { get; private set; }
public int ListSort { get; private set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public class PurchaseInvoiceLineSummary
{
public int PurchaseId { get; set; }
public int PurchaseNumber { get; set; }
public int PurchaseLineId { get; set; }
public DateTime PurchaseDate { get; set; }
public string ItemDescription { get; set; }
public string LineStatus { get; set; }
}
}

View File

@@ -9,7 +9,7 @@ namespace bnhtrade.Core.Model.Account
{
public class TaxCodeInfo : IValidatableObject
{
public TaxCodeInfo(string taxCodeId, string title, string description, decimal taxRatePercent, bool isMarginSchemeRate,
public TaxCodeInfo(string taxCode, string title, string description, decimal taxRatePercent, bool isMarginSchemeRate,
bool isValidOnExpense, bool isValidOnIncome, string taxType, bool isActive)
{
if (TaxRate < 0)
@@ -24,7 +24,7 @@ namespace bnhtrade.Core.Model.Account
throw new Exception("Tax rate is >= 100%");
}
TaxCode = taxCodeId;
TaxCode = taxCode;
TaxCodeDescription = description;
TaxRate = taxRatePercent;
IsMarginScheme = isMarginSchemeRate;

View File

@@ -9,24 +9,35 @@ namespace bnhtrade.Core.Model.Credentials
public class bnhtradeDB
{
public string DataSource { get; private set; }
public string UserId { get; private set; }
public string UserPassword { get; private set; }
public string InitialCatalog { get; private set; } = "e2A";
public bool PersistSecurityInfo { get; private set; } = true;
public bool MultipleActiveResultSets { get; private set; } = true;
public uint ConnectionTimeout { get; private set; }
public string ConnectionString
{ get
{
get
{
return "Data Source=" + DataSource + ";Initial Catalog=" + InitialCatalog + ";Persist Security Info=" + PersistSecurityInfo.ToString()
+ ";User ID=" + UserId + ";Password=" + UserPassword + ";MultipleActiveResultSets=" + MultipleActiveResultSets.ToString();
+ ";User ID=" + UserId + ";Password=" + UserPassword + ";MultipleActiveResultSets=" + MultipleActiveResultSets.ToString()
+ ";Connect Timeout=" + ConnectionTimeout;
}
}
public bnhtradeDB (string source, string userId, string userPassword)
public bnhtradeDB (string source, string userId, string userPassword, uint connectionTimeout = 30)
{
this.DataSource = source;
this.UserId = userId;
this.UserPassword = userPassword;
this.ConnectionTimeout = connectionTimeout;
}
}
}

View File

@@ -1,5 +1,4 @@
using CsvHelper.Configuration.Attributes;
using NUnit.Framework.Interfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@@ -7,7 +7,6 @@ using System.Runtime.ConstrainedExecution;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace bnhtrade.Core.Model.Import
{

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Purchase
{
public class PurchaseLineStatus
{
public PurchaseLineStatus(int statusId, string statusName, int listSort)
{
PurchaseLineStatusId = statusId;
PurchaseLineStatusName = statusName;
ListSort = listSort;
}
public int PurchaseLineStatusId {get; private set;}
public string PurchaseLineStatusName { get; private set;}
public int ListSort { get; private set;}
}
}

View File

@@ -60,7 +60,7 @@ namespace bnhtrade.Core
)
{
// first off, check if listing-item already exists, return id if it does
int listingItemId = EbayListingItemGet(sqlConnectionString, itemNumber, listingEnd);
int listingItemId = EbayListingItemGet(sqlConnectionString, itemNumber, listingEnd);
if (listingItemId > 0)
{ return (listingItemId, false, false); }
@@ -229,642 +229,6 @@ namespace bnhtrade.Core
}
}
namespace Account
{
public class AccountQuery
{
public static decimal CurrencyConvertToGbp(string sqlConnectionString, string currencyCode, decimal amount, DateTime conversionDate)
{
if (currencyCode == "GBP" || amount == 0M)
{
return amount;
}
if (currencyCode.Length != 3)
{
throw new Exception("Invalid currency code '" + currencyCode + "'");
}
using (SqlConnection sqlConn = new SqlConnection(sqlConnectionString))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE CurrencyCode=@currencyCode AND StartDate<=@conversionDate AND EndDate>@conversionDate
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
cmd.Parameters.AddWithValue("@conversionDate", conversionDate);
object result = cmd.ExecuteScalar();
if (result != null)
{
return amount / Convert.ToDecimal(result);
}
}
// return reason for no record found
using (SqlCommand cmd = new SqlCommand(@"
SELECT CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE CurrencyCode=@currencyCode
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
object result = cmd.ExecuteScalar();
if (result == null)
{
throw new Exception("Currency code '" + currencyCode + "' does not exist in Exchange Rate table");
}
else
{
throw new Exception("Date range for " + currencyCode + " " + conversionDate.ToShortDateString() + " " +
conversionDate.ToLongTimeString() + "' does not exist in Exchange Rate table");
}
}
}
}
public static int CurrencyExchangeRateInsert(string sqlConnectionString, int exchangeRateSource, string currencyCode,
decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false)
{
currencyUnitsPerGbp = decimal.Round(currencyUnitsPerGbp, 4);
periodStart = DateTime.SpecifyKind(periodStart, DateTimeKind.Utc);
periodEnd = DateTime.SpecifyKind(periodEnd, DateTimeKind.Utc);
// CHECKS
// HMRC source only
if (exchangeRateSource != 1)
{
throw new Exception("Function does not currently accept exchange rates from sources other than HMRC");
}
// currency code upper case only
currencyCode = currencyCode.ToUpper();
if (currencyCode.Length != 3)
{
throw new Exception("Invalid currency code '" + currencyCode +"'");
}
if (periodEnd <= periodStart)
{
throw new Exception("Invalid date period.");
}
if (checkOverride == false && (periodEnd - periodStart).Days > 31)
{
throw new Exception("Date period is greater than 31 days.");
}
// retirve previous data
DateTime? periodEndLast = null;
using (SqlConnection sqlConn = new SqlConnection(sqlConnectionString))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT Max(tblAccountExchangeRate.EndDate) AS MaxOfEndDate
FROM tblAccountExchangeRate
WHERE (((tblAccountExchangeRate.CurrencyCode) = @currencyCode))
", sqlConn))
{
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
object obj = cmd.ExecuteScalar();
// currency code not existing
if (obj == DBNull.Value && checkOverride == false)
{
throw new Exception("Currency code '" + currencyCode + "' does not exist in table");
}
// currency code exists
else
{
periodEndLast = DateTime.SpecifyKind(Convert.ToDateTime(obj), DateTimeKind.Utc);
if (periodStart != periodEndLast)
{
throw new Exception("Invalid period start date -- must equal previous period end-date.");
}
}
}
// retrive previous exchange rate and check
decimal currencyUnitsPerGbpLast = 0;
if (periodEndLast != null)
{
using (SqlCommand cmd = new SqlCommand(@"
SELECT tblAccountExchangeRate.AccountExchangeRateID, tblAccountExchangeRate.CurrencyUnitsPerGBP
FROM tblAccountExchangeRate
WHERE (tblAccountExchangeRate.EndDate = @periodEndLast)
AND (CurrencyCode = @currencyCode);
", sqlConn))
{
cmd.Parameters.AddWithValue("@periodEndLast", periodEndLast);
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
using (var reader = cmd.ExecuteReader())
{
if (reader.Read())
{
currencyUnitsPerGbpLast = reader.GetDecimal(1);
}
else
{
throw new Exception("Error that shouldn't happen! Check code @ 5129f3e6-2f7e-4883-bc73-b317d8fa4050");
}
// error if >1 line
if (reader.Read())
{
string errText = "Multiple lines in currency exchange table for '" + currencyCode + "' where [EndDate]=" + periodEndLast.ToString();
new Logic.Log.LogEvent().LogError(errText);
throw new Exception(errText);
}
}
}
}
// check difference between current and previous exchange rates isn't too great
if (checkOverride == false &&
(currencyUnitsPerGbpLast > (currencyUnitsPerGbp * 1.05m) || currencyUnitsPerGbpLast < (currencyUnitsPerGbp * 0.95m))
)
{
throw new Exception("Difference between supplied and previous exchange rates is greater than 5%");
}
// MAKE THE INSERT
int recordId = 0;
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountExchangeRate (ExchangeRateSource, CurrencyCode, CurrencyUnitsPerGBP, StartDate, EndDate)
OUTPUT INSERTED.AccountExchangeRateID
VALUES (@exchangeRateSource, @currencyCode, @currencyUnitsPerGbp, @periodStart, @periodEnd);
", sqlConn))
{
cmd.Parameters.AddWithValue("@exchangeRateSource", exchangeRateSource);
cmd.Parameters.AddWithValue("@currencyCode", currencyCode);
cmd.Parameters.AddWithValue("@currencyUnitsPerGbp", currencyUnitsPerGbp);
cmd.Parameters.AddWithValue("@periodStart", periodStart);
cmd.Parameters.AddWithValue("@periodEnd", periodEnd);
recordId = (int)cmd.ExecuteScalar();
if (recordId < 1)
{
throw new Exception("Error inserting record, did not retrive new record ID.");
}
}
return recordId;
}
}
public static bool AccountJournalEntryIsLocked(string sqlConnectionString, int journalId)
{
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournal.IsLocked
FROM
tblAccountJournal
WHERE
tblAccountJournal.AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
object obj = cmd.ExecuteScalar();
if (obj == null)
{
throw new Exception("Journal entry not found for AccountJournalID=" + journalId);
}
else
{
return (bool)obj;
}
}
}
}
public static int AccountJournalInsert(string sqlConnectionString, int journalTypeId, DateTime entryDate, string currencyCode,
decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false)
{
int defaultDebit = 0;
int defaultCredit = 0;
// ensure date is UTC
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
// debit and credit locks are checked in journal post method
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
// insert the journal entry
int journalId;
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournal
(AccountJournalTypeID, EntryDate, IsLocked)
OUTPUT INSERTED.AccountJournalID
VALUES
(@journalTypeId, @entryDate, @lockEntry)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@journalTypeId", journalTypeId);
cmd.Parameters.AddWithValue("@entryDate", entryDate.ToUniversalTime());
cmd.Parameters.AddWithValue("@lockEntry", lockEntry);
//execute
journalId = (int)cmd.ExecuteScalar();
}
// insert journal entries
bool postResult = AccountJournalPostInsert(sqlConnectionString, journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
scope.Complete();
return journalId;
}
}
// return false on locked journal entry
public static bool AccountJournalDelete(string sqlConnectionString, int accountJournalId)
{
// check if journal entry is locked
using (TransactionScope scope = new TransactionScope())
{
bool IsLocked = Account.AccountQuery.AccountJournalEntryIsLocked(sqlConnectionString, accountJournalId);
if (IsLocked == true)
{
return false;
}
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
// make the delete
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM tblAccountJournalPost
WHERE AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", accountJournalId);
int rows = cmd.ExecuteNonQuery();
if (rows == 0)
{
throw new Exception("Journal entry and/or entry posts do not exist for AccountJournalId=" + accountJournalId);
}
}
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM tblAccountJournal
WHERE AccountJournalID=@accountJournalId;
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", accountJournalId);
cmd.ExecuteNonQuery();
}
scope.Complete();
return true;
}
}
}
private static bool AccountJournalPostInsert(string sqlConnectionString, int journalId, DateTime entryDate,
string currencyCode, decimal amount, int debitAccountId = 0, int creditAccountId = 0)
{
int defaultDebit;
int defaultCredit;
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
// ensure their are no other entries
using (SqlCommand cmd = new SqlCommand(@"
SELECT
Count(tblAccountJournalPost.AccountJournalPostID) AS CountOfAccountJournalPostID
FROM
tblAccountJournalPost
WHERE
(((tblAccountJournalPost.AccountJournalID)=@AccountJournalID));
", conn))
{
cmd.Parameters.AddWithValue("@AccountJournalID", journalId);
int count = (int)cmd.ExecuteScalar();
if (count > 0)
{
throw new Exception("Unable the insert journal posts, post already present AccountJournalID=" + journalId);
}
}
//checks
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournalType.ChartOfAccountID_Debit, tblAccountJournalType.ChartOfAccountID_Credit
FROM
tblAccountJournal
INNER JOIN tblAccountJournalType
ON tblAccountJournal.AccountJournalTypeID = tblAccountJournalType.AccountJournalTypeID
WHERE
(((tblAccountJournal.AccountJournalID)=@journalId));
", conn))
{
cmd.Parameters.AddWithValue("@journalId", journalId);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
// debit check
if (reader.IsDBNull(0))
{
if (debitAccountId == 0)
{
throw new Exception("Debit Account ID required, default not set for journal type");
}
}
else
{
defaultDebit = reader.GetInt32(0);
if (debitAccountId == 0)
{
debitAccountId = defaultDebit;
}
else if (debitAccountId != defaultDebit)
{
throw new Exception("Debit Account ID supplied does not match default set for journal type");
}
}
// credit check
if (reader.IsDBNull(1))
{
if (creditAccountId == 0)
{
throw new Exception("Credit Account ID required, default not set for journal type");
}
}
else
{
defaultCredit = reader.GetInt32(1);
if (creditAccountId == 0)
{
creditAccountId = defaultCredit;
}
else if (creditAccountId != defaultCredit)
{
throw new Exception("Credit Account ID supplied does not match default set for journal type");
}
}
}
else
{
throw new Exception("AccountJournalID '" + journalId + "' does not exist.");
}
}
}
// currency conversion
if (currencyCode != "GBP")
{
amount = Core.Account.AccountQuery.CurrencyConvertToGbp(sqlConnectionString, currencyCode, amount, entryDate);
}
// ensure decimal is rounded
amount = Math.Round(amount, 2);
// insert debit post
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournalPost
(AccountJournalID, AccountChartOfID, AmountGbp)
VALUES
(@AccountJournalId, @AccountChartOfId, @AmountGbp)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@AccountJournalId", journalId);
cmd.Parameters.AddWithValue("@AccountChartOfId", debitAccountId);
cmd.Parameters.AddWithValue("@AmountGbp", amount);
cmd.ExecuteNonQuery();
}
// insert credit post
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblAccountJournalPost
(AccountJournalID, AccountChartOfID, AmountGbp)
VALUES
(@AccountJournalId, @AccountChartOfId, @AmountGbp)
", conn))
{
// add parameters
cmd.Parameters.AddWithValue("@AccountJournalId", journalId);
cmd.Parameters.AddWithValue("@AccountChartOfId", creditAccountId);
cmd.Parameters.AddWithValue("@AmountGbp", (amount * -1));
cmd.ExecuteNonQuery();
}
scope.Complete();
return true;
}
}
public static bool AccountJournalPostUpdate(string sqlConnectionString, int journalId, string currencyCode, decimal amount,
int debitAccountId = 0, int creditAccountId = 0)
{
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
// retrive journal entry date
DateTime entryDate;
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblAccountJournal.EntryDate
FROM
tblAccountJournal
WHERE
(((tblAccountJournal.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
entryDate = DateTime.SpecifyKind((DateTime)cmd.ExecuteScalar(), DateTimeKind.Utc);
}
// delete the original posts
using (SqlCommand cmd = new SqlCommand(@"
DELETE FROM
tblAccountJournalPost
WHERE
(((tblAccountJournalPost.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
cmd.ExecuteNonQuery();
}
//insert new posts
bool postResult = AccountJournalPostInsert(sqlConnectionString, journalId, entryDate, currencyCode, amount, debitAccountId, creditAccountId);
// update modified date on journal
using (SqlCommand cmd = new SqlCommand(@"
UPDATE
tblAccountJournal
SET
tblAccountJournal.LastModified=@utcNow
WHERE
(((tblAccountJournal.AccountJournalID)=@accountJournalId));
", conn))
{
cmd.Parameters.AddWithValue("@accountJournalId", journalId);
cmd.Parameters.AddWithValue("@utcNow", DateTime.UtcNow);
cmd.ExecuteNonQuery();
}
scope.Complete();
}
return true;
}
}
}
namespace Sku
{
public class Sku
{
public static int GetSkuIdByType(string sqlConnectionString, int productId, int conditionId, int accountTaxCodeId, bool noMatchInsertNew)
{
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
// look for existing entry
using (SqlCommand cmd = new SqlCommand(@"
SELECT
tblSku.skuSkuID
FROM
tblSku
WHERE
(((tblSku.skuProductID)=@productId) AND ((tblSku.skuSkuConditionID)=@conditionId) AND ((tblSku.AccountTaxCodeID)=@accountTaxCodeId));
", conn))
{
cmd.Parameters.AddWithValue("@productId", productId);
cmd.Parameters.AddWithValue("@conditionId", conditionId);
cmd.Parameters.AddWithValue("@accountTaxCodeId", accountTaxCodeId);
object obj = cmd.ExecuteScalar();
if (obj != null)
{
return (int)obj;
}
}
// value check insert bool
if (noMatchInsertNew == false)
{
return 0;
}
else
{
// get this far, check tax code id is a valid for SKU
using (SqlCommand cmd = new SqlCommand(@"
SELECT tblAccountTaxCode.InvoiceSales
FROM tblAccountTaxCode
WHERE (((tblAccountTaxCode.AccountTaxCodeID)=@accountTaxCodeId));
", conn))
{
cmd.Parameters.AddWithValue("@accountTaxCodeId", accountTaxCodeId);
object obj = cmd.ExecuteScalar();
if (obj == null)
{
throw new Exception("AccountTaxCodeID=" + accountTaxCodeId + " doesn't exist!");
}
else
{
bool result = (bool)obj;
if (result == false)
{
throw new Exception("AccountTaxCodeID=" + accountTaxCodeId + " is not a valid type for an SKU.");
}
}
}
// get info to create sku number
int skuCount;
int skuSuffix;
using (SqlCommand cmd = new SqlCommand("SELECT NEXT VALUE FOR SkuCountSequence;", conn))
{
skuCount = (int)cmd.ExecuteScalar();
}
using (SqlCommand cmd = new SqlCommand(@"
SELECT tblSkuCondition.scnSkuNumberSuffix
FROM tblSkuCondition
WHERE (((tblSkuCondition.scnSkuConditionID)=@conditionId));
", conn))
{
cmd.Parameters.AddWithValue("@conditionId", conditionId);
try
{
skuSuffix = (int)cmd.ExecuteScalar();
}
catch (Exception ex)
{
throw new Exception("Error retriving SKU number suffix for SkuConditionID=" + conditionId + "." +
System.Environment.NewLine + "Error Message: " + ex.Message);
}
}
string skuNumber = skuCount.ToString("D6") + "-" + skuSuffix.ToString("D2");
// insert new sku
int skuId;
using (SqlCommand cmd = new SqlCommand(@"
INSERT INTO tblSku
(skuSkuNumber, skuProductID, skuSkuConditionID, AccountTaxCodeID)
OUTPUT INSERTED.skuSkuID
VALUES
(@skuNumber, @productId, @conditionId, @accountTaxCodeId)
", conn))
{
cmd.Parameters.AddWithValue("@skuNumber", skuNumber);
cmd.Parameters.AddWithValue("@productId", productId);
cmd.Parameters.AddWithValue("@conditionId", conditionId);
cmd.Parameters.AddWithValue("@accountTaxCodeId", accountTaxCodeId);
skuId = (int)cmd.ExecuteScalar();
}
scope.Complete();
return skuId;
}
}
}
}
}
namespace Stock
{
public class StockCreate
@@ -878,7 +242,7 @@ namespace bnhtrade.Core
conn.Open();
// add account journal entry
int accountJournalId = Account.AccountQuery.AccountJournalInsert(sqlConnectionString, accountJournalType, entryDate, currencyCode, amount);
int accountJournalId = new Logic.Account.Journal().AccountJournalInsert(accountJournalType, entryDate, currencyCode, amount);
// make the stock insert
int stockId = WIP_StockInsertSub(sqlConnectionString, productId, conditionId, accountTaxCodeId,
@@ -1068,7 +432,7 @@ namespace bnhtrade.Core
}
else
{
throw new Exception("Manual delete of this stock type is not supported, use the moethod that created it!");
throw new Exception("Manual delete of this stock type is not supported, use the method that created it!");
}
// check there is only one stock journal entry for stock item
@@ -1248,7 +612,7 @@ namespace bnhtrade.Core
}
// delete account journal entry
Account.AccountQuery.AccountJournalDelete(sqlConnectionString, accountJournalId);
new Data.Database.Account.DeleteJournal().AccountJournalDelete(accountJournalId);
scope.Complete();
}
@@ -1398,6 +762,7 @@ namespace bnhtrade.Core
}
// insert journal posts into database
//new Data.Database.Stock
Core.Stock.StockJournal.StockJournalPostInsert(conn, stockId, stockJournalId, journalPosts, isNewStock);
// consistency check
@@ -1979,8 +1344,8 @@ namespace bnhtrade.Core
conn.Open();
// create account journal entry
int journalId = Account.AccountQuery.AccountJournalInsert(
sqlConnectionString, accountJournalTypeIdNet, entryDate, currencyCode, amountNet, debitAccountId);
int journalId = new Data.Database.Account.CreateJournal().AccountJournalInsert(
accountJournalTypeIdNet, entryDate, currencyCode, amountNet, debitAccountId);
// add transaction to purchase line transaction table
using (SqlCommand cmd = new SqlCommand(@"
@@ -2042,8 +1407,7 @@ namespace bnhtrade.Core
}
// make the update
bool result = Core.Account.AccountQuery.AccountJournalPostUpdate(sqlConnectionString,
accountJouranlId, currencyCode, amountNet, debitAccountId, creditAccountId);
bool result = new Data.Database.Account.UpdateJournal().AccountJournalPostUpdate(accountJouranlId, currencyCode, amountNet, debitAccountId, creditAccountId);
scope.Complete();
}
@@ -2140,7 +1504,7 @@ namespace bnhtrade.Core
}
// delete account journal entry
Account.AccountQuery.AccountJournalDelete(sqlConnectionString, accountJournalId);
new Data.Database.Account.DeleteJournal().AccountJournalDelete(accountJournalId);
scope.Complete();
}

View File

@@ -1,36 +0,0 @@
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("bnhtrade Database Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("bnhtrade Database Client")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("339d7413-3da7-46ea-a55c-255a9a6b95eb")]
// 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")]

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.Design;
namespace bnhtrade.Core.Test.Account
{
@@ -10,10 +11,28 @@ namespace bnhtrade.Core.Test.Account
{
public Account()
{
//var inst = new Data.Database.Account.GetTaxCode(sqlConnectionString);
//inst.
Journal();
}
//var taxInfo = inst.GetAll();
public void PurchaseInvoice()
{
var read = new Data.Database.Account.ReadPurchaseInvoice();
read.PurchaseInvoiceIdList = new List<int> { 14718, 100, 101, 102, 300, 400, 1200, 2734, 6339, 9999 }; // 10 in total
var result = read.Read();
}
public void PurchaseInvoiceLine()
{
var read = new Data.Database.Account.ReadPurchaseInvoiceLine();
read.ItemDescription = new List<string> { "xbox", "kill" };
var result = read.Read();
}
public void Journal()
{
var read = new Data.Database.Account.ReadJournal();
read.AccountJournalId = new List<uint> { 123, 300, 324, 5678, 22 };
var result = read.Read();
}
}
}

View File

@@ -0,0 +1,94 @@
using bnhtrade.Core.Data.Database;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Test._BoilerPlate
{
internal class xxxxxxxYourClassNameHerexxxxxxxx : Connection
{
private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
/// <summary>
/// Results filter
/// </summary>
public List<int> ColumnTitle1List { get; set; }
/// <summary>
/// Searches for the specificed phases within the item description. Uses the LIKE AND sql function
/// </summary>
public List<string> ColumnTitle2List { get; set; }
public xxxxxxxYourClassNameHerexxxxxxxx()
{
Init();
}
public void Init()
{
sqlBuilder = new SqlWhereBuilder();
ColumnTitle1List = new List<int>();
ColumnTitle2List = new List<string>();
}
/// <summary>
///
/// </summary>
/// <returns>Dictionary were key is the table primary key</returns>
public Dictionary<int, string> Read()
{
// create the return (emptyP list) here
var returnList = new Dictionary<int, string>();
sqlBuilder.Init();
//build sql query
string sql = @"
SELECT item1, item2, item3
FROM tblPurchaseLine
WHERE 1 = 1 ";
// build the where statments
if (ColumnTitle1List.Any())
{
sqlBuilder.In("xxxxxxxxxxxxxxColumnTitle1xxxxxxxxxxxxxxxxxx", ColumnTitle1List, "AND");
}
if (ColumnTitle2List.Any())
{
sqlBuilder.In("xxxxxxxxxxxxxxColumnTitle2xxxxxxxxxxxxxxxxxx", ColumnTitle2List, "AND");
}
// append where string to the sql
if (sqlBuilder.IsSetSqlWhereString)
{
sql = sql + sqlBuilder.SqlWhereString;
}
using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
sqlBuilder.AddParametersToSqlCommand(cmd);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
// read from db and create object
// and add to return list
}
}
}
}
}
// all done, return the list here
return returnList;
}
}
}

View File

@@ -1,356 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\NUnit.4.1.0\build\NUnit.props" Condition="Exists('..\..\packages\NUnit.4.1.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{339D7413-3DA7-46EA-A55C-255A9A6B95EB}</ProjectGuid>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bnhtrade.Core</RootNamespace>
<AssemblyName>bnhtrade.Core</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\Debug\core\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\Release\core\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\..\packages\AWSSDK.Core.3.7.303.15\lib\net45\AWSSDK.Core.dll</HintPath>
</Reference>
<Reference Include="AWSSDK.SecurityToken, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\..\packages\AWSSDK.SecurityToken.3.7.300.76\lib\net45\AWSSDK.SecurityToken.dll</HintPath>
</Reference>
<Reference Include="AWSSDK.SQS, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\..\packages\AWSSDK.SQS.3.7.300.75\lib\net45\AWSSDK.SQS.dll</HintPath>
</Reference>
<Reference Include="CsvHelper, Version=31.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\..\packages\CsvHelper.31.0.4\lib\net47\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="Dapper, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Dapper.2.1.35\lib\net461\Dapper.dll</HintPath>
</Reference>
<Reference Include="Dapper.Contrib, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Dapper.Contrib.2.0.78\lib\net461\Dapper.Contrib.dll</HintPath>
</Reference>
<Reference Include="FikaAmazonAPI, Version=1.7.17.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\CSharpAmazonSpAPI.1.7.17\lib\netstandard2.0\FikaAmazonAPI.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
<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="nunit.framework, Version=4.0.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.4.1.0\lib\net462\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="nunit.framework.legacy, Version=4.0.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.4.1.0\lib\net462\nunit.framework.legacy.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="RestSharp.Serializers.NewtonsoftJson, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestSharp.Serializers.NewtonsoftJson.110.2.0\lib\net471\RestSharp.Serializers.NewtonsoftJson.dll</HintPath>
</Reference>
<Reference Include="StandardSocketsHttpHandler, Version=2.2.0.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\StandardSocketsHttpHandler.2.2.0.8\lib\netstandard2.0\StandardSocketsHttpHandler.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<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" />
<Compile Remove="Data\Database\Inventory\**" />
<EmbeddedResource Remove="Data\Database\Inventory\**" />
<None Remove="Data\Database\Inventory\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="Data\Amazon\FbaInventory\GetFbaInventoryInfo.cs" />
<Compile Include="Data\Amazon\Feeds\GetFeed.cs" />
<Compile Include="Data\Amazon\Feeds\SubmittFeed.cs" />
<Compile Include="Data\Amazon\Feeds\SampleFeeds.cs" />
<Compile Include="Data\Amazon\FulFillmentInbound\GetShipmentItems.cs" />
<Compile Include="Data\Amazon\FulFillmentInbound\GetShipments.cs" />
<Compile Include="Data\Amazon\FulFillmentInbound\CreateInboundShipmentPlan.cs" />
<Compile Include="Data\Amazon\ProductFee\GetFeeEstimate.cs" />
<Compile Include="Data\Amazon\ProductPricing\GetCompetitivePricing.cs" />
<Compile Include="Data\Amazon\Report\FbaInventoryAdustment.cs" />
<Compile Include="Data\Amazon\Report\FbaInventoryAge.cs" />
<Compile Include="Data\Amazon\Report\FbaInventory.cs" />
<Compile Include="Data\Amazon\Report\FbaInventoryReceipt.cs" />
<Compile Include="Data\Amazon\Report\FbaCustomerReturn.cs" />
<Compile Include="Data\Amazon\Report\FbaInventoryLedgerDetailed.cs" />
<Compile Include="Data\Amazon\Report\FbaReimbursement.cs" />
<Compile Include="Data\Amazon\Report\FbaRemovalOrder.cs" />
<Compile Include="Data\Amazon\Report\FbaSaleShipment.cs" />
<Compile Include="Data\Amazon\Report\ReportLogic.cs" />
<Compile Include="Data\Amazon\SellingPartnerAPI\SpApiConnection.cs" />
<Compile Include="Data\Amazon\SellingPartnerAPI\Defaults.cs" />
<Compile Include="Data\Amazon\Report\SettlementReport.cs" />
<Compile Include="Data\Amazon\SellingPartnerAPI\Services\ReportService.cs" />
<Compile Include="Data\Amazon\SellingPartnerAPI\Utils\CurrentDateTime.cs" />
<Compile Include="Config.cs" />
<Compile Include="Data\Database\Account\CreateInvoiceLineItem.cs" />
<Compile Include="Data\Database\Account\ReadAccountCode.cs" />
<Compile Include="Data\Database\Account\ReadTaxCode.cs" />
<Compile Include="Data\Database\Amazon\FeeEstimate.cs" />
<Compile Include="Data\Database\Connection.cs" />
<Compile Include="Data\Database\Consistency\ImportAmazonSettlement.cs" />
<Compile Include="Data\Database\Account\ReadInvoiceLineItem.cs" />
<Compile Include="Data\Database\Constants.cs" />
<Compile Include="Data\Database\Export\CreateAmazonFeedSubmission.cs" />
<Compile Include="Data\Database\Export\ReadAmazonFeedSubmission.cs" />
<Compile Include="Data\Database\Export\UpdateAmazonFeedSubmission.cs" />
<Compile Include="Data\Database\AmazonFba\ReadShipmentInfo.cs" />
<Compile Include="Data\Database\AmazonFba\ReadShipmentPrimaryKey.cs" />
<Compile Include="Data\Database\AmazonFba\SetShipmentInfo.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryAdjustment.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryLedgerDetail.cs" />
<Compile Include="Data\Database\Product\ReadProduct.cs" />
<Compile Include="Data\Database\Product\ReadProductId.cs" />
<Compile Include="Data\Database\ReadRandomData.cs" />
<Compile Include="Data\Database\Sku\InsertSku.cs" />
<Compile Include="Data\Database\Sku\ReadSku.cs" />
<Compile Include="Data\Database\Stock\InsertSkuTransactionType.cs" />
<Compile Include="Data\Database\Stock\JournalCrud.cs" />
<Compile Include="Data\Database\Stock\ReadStatusTypeBalance.cs" />
<Compile Include="Data\Database\Stock\Status.cs" />
<Compile Include="Data\Database\Stock\StatusType.cs" />
<Compile Include="Logic\Amazon\Fba\Fnsku.cs" />
<Compile Include="Logic\Amazon\Fba\Stock.cs" />
<Compile Include="Logic\Import\Amazon.cs" />
<Compile Include="Logic\Import\AmazonFbaInventoryAdjustment.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryAgeData.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryData.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryReceipt.cs" />
<Compile Include="Data\Database\Import\AmazonFbaReimbursement.cs" />
<Compile Include="Data\Database\Import\AmazonFbaRemovalOrder.cs" />
<Compile Include="Data\Database\Import\AmazonFbaCustomerReturn.cs" />
<Compile Include="Data\Database\Import\AmazonFbaSaleShipment.cs" />
<Compile Include="Data\Database\Import\AmazonSettlementInsert.cs" />
<Compile Include="Data\Database\Import\AmazonSettlementRead.cs" />
<Compile Include="Data\Database\Import\AmazonSettlementHeaderRead.cs" />
<Compile Include="Data\Database\Import\AmazonFbaInventoryAgeRead.cs" />
<Compile Include="Data\Database\Import\AmazonSettlementUpdate.cs" />
<Compile Include="Data\Database\Product\CreateCompetitivePrice.cs" />
<Compile Include="Data\Database\Product\ReadCompetitivePrice.cs" />
<Compile Include="Data\Database\Sku\Price\CreatePricingDetail.cs" />
<Compile Include="Data\Database\Sku\Price\ReadPricingDetail.cs" />
<Compile Include="Data\Database\Sku\Price\ReadParameter.cs" />
<Compile Include="Data\Database\Log\DateTimeLog.cs" />
<Compile Include="Data\Database\Log\LogEvent.cs" />
<Compile Include="Data\Database\Programmability\Sequence.cs" />
<Compile Include="Data\Database\Sku\ReadSkuConditionInfo.cs" />
<Compile Include="Data\Database\Stock\InsertSkuTransaction.cs" />
<Compile Include="Data\Database\Stock\DeleteSkuTransaction.cs" />
<Compile Include="Data\Database\Stock\ReadSkuTransaction.cs" />
<Compile Include="Data\Database\Stock\ReadSkuTransactionType.cs" />
<Compile Include="Data\Database\Stock\ReadStatusBalance.cs" />
<Compile Include="Data\Database\Stock\ReadStatusTransaction.cs" />
<Compile Include="Data\Database\Stock\ReadStockId.cs" />
<Compile Include="Data\Database\Stock\UpdateSkuTransaction.cs" />
<Compile Include="Data\Database\SqlWhereBuilder.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Logic\Account\GetAccountCodeInfo.cs" />
<Compile Include="Logic\Account\GetInvoiceLineItem.cs" />
<Compile Include="Logic\Account\TaxCalculation.cs" />
<Compile Include="Logic\Account\GetTaxCodeInfo.cs" />
<Compile Include="Logic\Import\AmazonFbaInventory.cs" />
<Compile Include="Logic\Import\AmazonFbaInventoryAge.cs" />
<Compile Include="Logic\Import\AmazonFbaInventoryLedgerDetail.cs" />
<Compile Include="Logic\Import\AmazonFbaInventoryReceipt.cs" />
<Compile Include="Logic\Import\AmazonFbaCustomerReturn.cs" />
<Compile Include="Logic\Import\AmazonFbaReimbursement.cs" />
<Compile Include="Logic\Import\AmazonFbaRemovalOrder.cs" />
<Compile Include="Logic\Import\AmazonFbaSaleShipment.cs" />
<Compile Include="Logic\Import\AmazonSettlement.cs" />
<Compile Include="Logic\Product\AmazonCompetitivePrice.cs" />
<Compile Include="Logic\Product\AmazonEstimateFee.cs" />
<Compile Include="Logic\Product\GetProductInfo.cs" />
<Compile Include="Logic\Sku\GetSkuInfo.cs" />
<Compile Include="Logic\Stock\StatusTypeBalance.cs" />
<Compile Include="Logic\Stock\SkuTransactionImport.cs" />
<Compile Include="Logic\Stock\StatusBalance.cs" />
<Compile Include="Logic\Utilities\EasyMD5.cs" />
<Compile Include="Logic\Utilities\File.cs" />
<Compile Include="Logic\Utilities\NightlyRoutine.cs" />
<Compile Include="Logic\Validate\AccountCode.cs" />
<Compile Include="Logic\Validate\CurrencyCode.cs" />
<Compile Include="Logic\Validate\SalesInvoice.cs" />
<Compile Include="Logic\AmazonFBAInbound\ShipmentInfoPersistanceUpdate.cs" />
<Compile Include="Data\Database\Export\CreateSalesInvoice.cs" />
<Compile Include="Logic\Export\AmazonSubmitFile.cs" />
<Compile Include="Logic\Sku\GetSkuConditionInfo.cs" />
<Compile Include="Logic\Stock\StatusReallocate.cs" />
<Compile Include="Logic\Stock\SkuTransactionReconcile.cs" />
<Compile Include="Logic\Stock\SkuTransactionCrud.cs" />
<Compile Include="Logic\Stock\SkuTransactionTypeCrud.cs" />
<Compile Include="Logic\Export\SalesInvoice.cs" />
<Compile Include="Logic\Export\AmazonSettlement.cs" />
<Compile Include="Logic\Validate\AmazonSettlement.cs" />
<Compile Include="Logic\Product\GetCompetitivePrice.cs" />
<Compile Include="Logic\Sku\Price\FbaPricing.cs" />
<Compile Include="Logic\Sku\Price\UpdateRepricingValues.cs" />
<Compile Include="Logic\Utilities\CalculateMD5.cs" />
<Compile Include="Logic\Utilities\DateTimeParse.cs" />
<Compile Include="Logic\Validate\AmazonIventoryLoaderFile.cs" />
<Compile Include="Logic\Validate\Format.cs" />
<Compile Include="Logic\Validate\SkuTransaction.cs" />
<Compile Include="Logic\Validate\TaxCodeInfo.cs" />
<Compile Include="Logic\Validate\Validate.cs" />
<Compile Include="Logic\Log\LogEvent.cs" />
<Compile Include="Logic\Utilities\DateTimeCheck.cs" />
<Compile Include="Logic\Utilities\DecimalCheck.cs" />
<Compile Include="Logic\Utilities\PropertyCheck.cs" />
<Compile Include="Logic\Utilities\StringCheck.cs" />
<Compile Include="Logic\Utilities\AccountVat.cs" />
<Compile Include="Logic\Validate\SkuPriceInfo.cs" />
<Compile Include="Model\Account\Account.cs" />
<Compile Include="Model\Account\InvoiceHeader.cs" />
<Compile Include="Model\Account\Invoice.cs" />
<Compile Include="Model\Account\InvoiceLineItem.cs" />
<Compile Include="Model\Account\SalesInvoice.cs" />
<Compile Include="Model\Account\TaxCodeInfo.cs" />
<Compile Include="Model\AmazonFba\ShippingPlanItem.cs" />
<Compile Include="Model\Amazon\ProductFeeEstimate.cs" />
<Compile Include="Model\Credentials\AmazonSPAPI.cs" />
<Compile Include="Model\Credentials\bnhtradeDB.cs" />
<Compile Include="Model\Data\DatabaseFileStream.cs" />
<Compile Include="Model\Export\AmazonFeedSubmission.cs" />
<Compile Include="Model\Export\AmazonIventoryLoaderFile.cs" />
<Compile Include="Model\Import\AmazonFbaInventoryLedgerDetail.cs" />
<Compile Include="Model\Import\AmazonFbaReimbursement.cs" />
<Compile Include="Model\Import\AmazonSettlement.cs" />
<Compile Include="Model\Import\AmazonSettlementHeader.cs" />
<Compile Include="Model\Product\CompetitivePrice.cs" />
<Compile Include="Model\Product\ProductInfo.cs" />
<Compile Include="Model\Amazon\ProductCompetitivePrice.cs" />
<Compile Include="Model\Sku\Price\DetailRequest.cs" />
<Compile Include="Model\Sku\Price\DetailResponce.cs" />
<Compile Include="Model\Sku\Price\PriceInfo.cs" />
<Compile Include="Model\Sku\Price\SkuPriceParameter.cs" />
<Compile Include="Model\Sku\Price\SkuRepriceInfo.cs" />
<Compile Include="Model\Sku\Sku.cs" />
<Compile Include="Model\Sku\SkuConditionInfo.cs" />
<Compile Include="Model\Stock\JournalEntry.cs" />
<Compile Include="Model\Stock\SkuTransactionDepreciated.cs" />
<Compile Include="Model\Stock\SkuTransactionCreate.cs" />
<Compile Include="Model\Stock\SkuTransactionType.cs" />
<Compile Include="Model\Stock\SkuTransaction.cs" />
<Compile Include="Model\Stock\Status.cs" />
<Compile Include="Model\Stock\StatusBalance.cs" />
<Compile Include="Model\Stock\StatusTransaction.cs" />
<Compile Include="Model\Stock\StatusType.cs" />
<Compile Include="Test\Account\Account.cs" />
<Compile Include="Test\Amazon\SP-API\FulfillmentInboundV0.cs" />
<Compile Include="Test\Amazon\SP-API\Reports.cs" />
<Compile Include="Test\Amazon\SP-API\VariousCalls.cs" />
<Compile Include="Test\AutoExec.cs" />
<Compile Include="Test\Export\Export.cs" />
<Compile Include="Test\Import\Report.cs" />
<Compile Include="Test\InboundShipmentInfo.cs" />
<Compile Include="Logic\AmazonFBAInbound\ShipmentAddByFNSKU.cs" />
<Compile Include="Test\InboundShipmentInfoSync.cs" />
<Compile Include="Test\Amazon\Amazon.cs" />
<Compile Include="Test\Logic\Export.cs" />
<Compile Include="Test\Sku\Sku.cs" />
<Compile Include="Test\SQLLoop.cs" />
<Compile Include="Model\AmazonFba\ShipmentInfo.cs" />
<Compile Include="Test\Stock\Stock.cs" />
<Compile Include="Test\_BoilerPlate\ClassFromSql.cs" />
<Compile Include="Test\_BoilerPlate\Sql.cs" />
<Compile Include="UI\Console.cs" />
<Compile Include="Model\AmazonFba\ShipmentItemInfo.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Logic\Sku\GetSkuId.cs" />
<Compile Include="Data\Database\Sku\GetSkuId.cs" />
<Compile Include="UI\ConsoleProgressBar.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\Database\Inventory\" />
<Folder Include="Model\Inventory\" />
<Folder Include="Model\Product\ProductPricing\" />
<Folder Include="Test\Product\" />
@@ -361,18 +35,23 @@
<Analyzer Include="..\..\packages\AWSSDK.SQS.3.7.300.75\analyzers\dotnet\cs\AWSSDK.SQS.CodeAnalysis.dll" />
<Analyzer Include="..\..\packages\AWSSDK.SQS.3.7.300.75\analyzers\dotnet\cs\SharedAnalysisCode.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\NUnit.4.1.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit.4.1.0\build\NUnit.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<PackageReference Include="AWSSDK.Core" Version="3.7.303.15" />
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.300.76">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="CSharpAmazonSpAPI" Version="1.7.17" />
<PackageReference Include="CsvHelper" Version="31.0.4" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.Contrib" Version="2.0.78">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="110.2.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Data\Database\Product\UpdateAmazonFeeEstimate.cs" />
</ItemGroup>
</Project>

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AWSSDK.Core" version="3.7.303.15" targetFramework="net472" />
<package id="AWSSDK.SecurityToken" version="3.7.300.76" targetFramework="net472" />
<package id="AWSSDK.SQS" version="3.7.300.75" targetFramework="net472" />
<package id="CSharpAmazonSpAPI" version="1.7.17" targetFramework="net472" />
<package id="CsvHelper" version="31.0.4" targetFramework="net472" />
<package id="Dapper" version="2.1.35" targetFramework="net472" />
<package id="Dapper.Contrib" version="2.0.78" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net472" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net471" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NUnit" version="4.1.0" targetFramework="net472" />
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
<package id="RestSharp.Serializers.NewtonsoftJson" version="110.2.0" targetFramework="net472" />
<package id="StandardSocketsHttpHandler" version="2.2.0.8" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Collections" version="4.3.0" targetFramework="net472" />
<package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Reflection" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net471" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net471" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>

View File

@@ -39,6 +39,70 @@
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.ProtectedData" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.60.3.0" newVersion="4.60.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.39.0.0" newVersion="1.39.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Identity" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.11.3.0" newVersion="1.11.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols.OpenIdConnect" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Protocols" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.JsonWebTokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory.Data" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,16 +1,6 @@
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("bnhtrade Scheduled Tasks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("bnhtrade Scheduled Tasks")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -21,16 +11,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5d6e1d66-3901-4340-95c6-ee65051ab623")]
// 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")]

View File

@@ -1,16 +1,9 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5D6E1D66-3901-4340-95C6-EE65051AB623}</ProjectGuid>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>bnhtrade_Scheduled_Tasks</RootNamespace>
<AssemblyName>bnhtradeScheduledTasks</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -26,56 +19,30 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\Debug\console\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\Release\console\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>..\..\bin\$(AssemblyName)\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<StartupObject>bnhtradeScheduledTasks.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
@@ -93,13 +60,18 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj">
<Project>{339d7413-3da7-46ea-a55c-255a9a6b95eb}</Project>
<Name>bnhtrade.Core</Name>
</ProjectReference>
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /E /Y "$(TargetDir)" "C:\Users\Bobbie\Dropbox\Apps\bnhtrade"</PostBuildEvent>
<AssemblyTitle>bnhtrade Scheduled Tasks</AssemblyTitle>
<Product>bnhtrade Scheduled Tasks</Product>
<Copyright>Copyright © 2018</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,514 @@
namespace bnhtrade.gui.Forms.Account
{
partial class PurchaseInvoice
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
bsInvoice = new BindingSource(components);
textBoxEbayUsername = new TextBox();
bsContact = new BindingSource(components);
label1 = new Label();
label2 = new Label();
textBoxEbayEmail = new TextBox();
label3 = new Label();
textBoxPaypalUsername = new TextBox();
label4 = new Label();
textBoxPaypalEmail = new TextBox();
label5 = new Label();
textBoxUsername = new TextBox();
labelPurchaseInvoiceNumber = new Label();
labelSupplierRef = new Label();
textBox1 = new TextBox();
dateTimeOrderDate = new DateTimePicker();
textBoxTotalAmount = new TextBox();
textBoxTaxAmount = new TextBox();
textBoxNetAmount = new TextBox();
label6 = new Label();
label7 = new Label();
label8 = new Label();
label = new Label();
label11 = new Label();
dataGridView1 = new DataGridView();
itemDescriptionDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
statusDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
itemQuantityDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
PurchaseId = new DataGridViewTextBoxColumn();
PurchaseLineId = new DataGridViewTextBoxColumn();
ItemNet = new DataGridViewTextBoxColumn();
ShippingNet = new DataGridViewTextBoxColumn();
OtherNet = new DataGridViewTextBoxColumn();
LineTotalTax = new DataGridViewTextBoxColumn();
LineTotalGross = new DataGridViewTextBoxColumn();
bsInvoiceLines = new BindingSource(components);
textBoxOrderChannel = new TextBox();
tabControl1 = new TabControl();
tabPageAccountTransactions = new TabPage();
tabPageNotes = new TabPage();
((System.ComponentModel.ISupportInitialize)bsInvoice).BeginInit();
((System.ComponentModel.ISupportInitialize)bsContact).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
((System.ComponentModel.ISupportInitialize)bsInvoiceLines).BeginInit();
tabControl1.SuspendLayout();
SuspendLayout();
//
// bsInvoice
//
bsInvoice.DataSource = typeof(Core.Model.Account.PurchaseInvoice);
//
// textBoxEbayUsername
//
textBoxEbayUsername.DataBindings.Add(new Binding("Text", bsContact, "ContactEbayName", true));
textBoxEbayUsername.Location = new Point(118, 83);
textBoxEbayUsername.Name = "textBoxEbayUsername";
textBoxEbayUsername.Size = new Size(215, 23);
textBoxEbayUsername.TabIndex = 0;
//
// bsContact
//
bsContact.DataSource = typeof(Core.Model.Account.Contact);
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(16, 86);
label1.Name = "label1";
label1.Size = new Size(87, 15);
label1.TabIndex = 1;
label1.Text = "ebay username";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(16, 115);
label2.Name = "label2";
label2.Size = new Size(64, 15);
label2.TabIndex = 3;
label2.Text = "ebay email";
//
// textBoxEbayEmail
//
textBoxEbayEmail.DataBindings.Add(new Binding("Text", bsContact, "ContactEbayEmail", true));
textBoxEbayEmail.Location = new Point(118, 112);
textBoxEbayEmail.Name = "textBoxEbayEmail";
textBoxEbayEmail.Size = new Size(215, 23);
textBoxEbayEmail.TabIndex = 2;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(16, 144);
label3.Name = "label3";
label3.Size = new Size(97, 15);
label3.TabIndex = 5;
label3.Text = "paypal username";
//
// textBoxPaypalUsername
//
textBoxPaypalUsername.DataBindings.Add(new Binding("Text", bsContact, "ContactPaypalName", true));
textBoxPaypalUsername.Location = new Point(118, 141);
textBoxPaypalUsername.Name = "textBoxPaypalUsername";
textBoxPaypalUsername.Size = new Size(215, 23);
textBoxPaypalUsername.TabIndex = 4;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(16, 173);
label4.Name = "label4";
label4.Size = new Size(74, 15);
label4.TabIndex = 7;
label4.Text = "paypal email";
//
// textBoxPaypalEmail
//
textBoxPaypalEmail.DataBindings.Add(new Binding("Text", bsContact, "ContactPaypalEmail", true));
textBoxPaypalEmail.Location = new Point(118, 170);
textBoxPaypalEmail.Name = "textBoxPaypalEmail";
textBoxPaypalEmail.Size = new Size(215, 23);
textBoxPaypalEmail.TabIndex = 6;
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(16, 57);
label5.Name = "label5";
label5.Size = new Size(39, 15);
label5.TabIndex = 9;
label5.Text = "Name";
//
// textBoxUsername
//
textBoxUsername.DataBindings.Add(new Binding("Text", bsContact, "ContantName", true));
textBoxUsername.Location = new Point(118, 54);
textBoxUsername.Name = "textBoxUsername";
textBoxUsername.Size = new Size(215, 23);
textBoxUsername.TabIndex = 8;
//
// labelPurchaseInvoiceNumber
//
labelPurchaseInvoiceNumber.AutoSize = true;
labelPurchaseInvoiceNumber.Font = new Font("Segoe UI", 18F, FontStyle.Regular, GraphicsUnit.Point, 0);
labelPurchaseInvoiceNumber.Location = new Point(12, 9);
labelPurchaseInvoiceNumber.Name = "labelPurchaseInvoiceNumber";
labelPurchaseInvoiceNumber.Size = new Size(213, 32);
labelPurchaseInvoiceNumber.TabIndex = 10;
labelPurchaseInvoiceNumber.Text = "Purchase Invoice #";
//
// labelSupplierRef
//
labelSupplierRef.AutoSize = true;
labelSupplierRef.Location = new Point(16, 202);
labelSupplierRef.Name = "labelSupplierRef";
labelSupplierRef.Size = new Size(73, 15);
labelSupplierRef.TabIndex = 12;
labelSupplierRef.Text = "Supplier Ref.";
//
// textBox1
//
textBox1.DataBindings.Add(new Binding("Text", bsInvoice, "SupplierRef", true));
textBox1.Location = new Point(118, 199);
textBox1.Name = "textBox1";
textBox1.Size = new Size(215, 23);
textBox1.TabIndex = 11;
//
// dateTimeOrderDate
//
dateTimeOrderDate.Anchor = AnchorStyles.Top | AnchorStyles.Right;
dateTimeOrderDate.DataBindings.Add(new Binding("Value", bsInvoice, "PurchaseDate", true, DataSourceUpdateMode.Never));
dateTimeOrderDate.Location = new Point(915, 51);
dateTimeOrderDate.Name = "dateTimeOrderDate";
dateTimeOrderDate.Size = new Size(143, 23);
dateTimeOrderDate.TabIndex = 14;
//
// textBoxTotalAmount
//
textBoxTotalAmount.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBoxTotalAmount.DataBindings.Add(new Binding("Text", bsInvoice, "InvoiceGrossAmount", true));
textBoxTotalAmount.Location = new Point(915, 167);
textBoxTotalAmount.Name = "textBoxTotalAmount";
textBoxTotalAmount.Size = new Size(143, 23);
textBoxTotalAmount.TabIndex = 18;
//
// textBoxTaxAmount
//
textBoxTaxAmount.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBoxTaxAmount.DataBindings.Add(new Binding("Text", bsInvoice, "InvoiceTaxAmount", true));
textBoxTaxAmount.Location = new Point(915, 138);
textBoxTaxAmount.Name = "textBoxTaxAmount";
textBoxTaxAmount.Size = new Size(143, 23);
textBoxTaxAmount.TabIndex = 17;
//
// textBoxNetAmount
//
textBoxNetAmount.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBoxNetAmount.DataBindings.Add(new Binding("Text", bsInvoice, "InvoiceNetAmount", true));
textBoxNetAmount.Location = new Point(915, 109);
textBoxNetAmount.Name = "textBoxNetAmount";
textBoxNetAmount.Size = new Size(143, 23);
textBoxNetAmount.TabIndex = 16;
//
// label6
//
label6.Anchor = AnchorStyles.Top | AnchorStyles.Right;
label6.AutoSize = true;
label6.Location = new Point(824, 83);
label6.Name = "label6";
label6.Size = new Size(84, 15);
label6.TabIndex = 19;
label6.Text = "Order Channel";
//
// label7
//
label7.Anchor = AnchorStyles.Top | AnchorStyles.Right;
label7.AutoSize = true;
label7.Location = new Point(824, 141);
label7.Name = "label7";
label7.Size = new Size(69, 15);
label7.TabIndex = 20;
label7.Text = "Tax amount";
//
// label8
//
label8.Anchor = AnchorStyles.Top | AnchorStyles.Right;
label8.AutoSize = true;
label8.Location = new Point(824, 112);
label8.Name = "label8";
label8.Size = new Size(71, 15);
label8.TabIndex = 21;
label8.Text = "Net amount";
//
// label
//
label.Anchor = AnchorStyles.Top | AnchorStyles.Right;
label.AutoSize = true;
label.Location = new Point(824, 57);
label.Name = "label";
label.Size = new Size(64, 15);
label.TabIndex = 23;
label.Text = "Order Date";
//
// label11
//
label11.Anchor = AnchorStyles.Top | AnchorStyles.Right;
label11.AutoSize = true;
label11.Location = new Point(824, 170);
label11.Name = "label11";
label11.Size = new Size(79, 15);
label11.TabIndex = 24;
label11.Text = "Total Amount";
//
// dataGridView1
//
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView1.AutoGenerateColumns = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { itemDescriptionDataGridViewTextBoxColumn, statusDataGridViewTextBoxColumn, itemQuantityDataGridViewTextBoxColumn, PurchaseId, PurchaseLineId, ItemNet, ShippingNet, OtherNet, LineTotalTax, LineTotalGross });
dataGridView1.DataSource = bsInvoiceLines;
dataGridView1.Location = new Point(16, 259);
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowTemplate.Height = 30;
dataGridView1.Size = new Size(1042, 280);
dataGridView1.TabIndex = 25;
//
// itemDescriptionDataGridViewTextBoxColumn
//
itemDescriptionDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
itemDescriptionDataGridViewTextBoxColumn.DataPropertyName = "ItemDescription";
itemDescriptionDataGridViewTextBoxColumn.HeaderText = "Description";
itemDescriptionDataGridViewTextBoxColumn.Name = "itemDescriptionDataGridViewTextBoxColumn";
itemDescriptionDataGridViewTextBoxColumn.ReadOnly = true;
//
// statusDataGridViewTextBoxColumn
//
statusDataGridViewTextBoxColumn.DataPropertyName = "Status";
statusDataGridViewTextBoxColumn.HeaderText = "Status";
statusDataGridViewTextBoxColumn.Name = "statusDataGridViewTextBoxColumn";
statusDataGridViewTextBoxColumn.ReadOnly = true;
//
// itemQuantityDataGridViewTextBoxColumn
//
itemQuantityDataGridViewTextBoxColumn.DataPropertyName = "ItemQuantity";
itemQuantityDataGridViewTextBoxColumn.HeaderText = "Qty.";
itemQuantityDataGridViewTextBoxColumn.MinimumWidth = 50;
itemQuantityDataGridViewTextBoxColumn.Name = "itemQuantityDataGridViewTextBoxColumn";
itemQuantityDataGridViewTextBoxColumn.ReadOnly = true;
itemQuantityDataGridViewTextBoxColumn.Width = 50;
//
// PurchaseId
//
PurchaseId.DataPropertyName = "PurchaseId";
PurchaseId.HeaderText = "PurchaseId";
PurchaseId.Name = "PurchaseId";
PurchaseId.ReadOnly = true;
PurchaseId.Visible = false;
//
// PurchaseLineId
//
PurchaseLineId.DataPropertyName = "PurchaseLineId";
PurchaseLineId.HeaderText = "PurchaseLineId";
PurchaseLineId.Name = "PurchaseLineId";
PurchaseLineId.ReadOnly = true;
PurchaseLineId.Visible = false;
//
// ItemNet
//
ItemNet.DataPropertyName = "ItemNet";
ItemNet.HeaderText = "Item";
ItemNet.MinimumWidth = 60;
ItemNet.Name = "ItemNet";
ItemNet.ReadOnly = true;
ItemNet.Width = 60;
//
// ShippingNet
//
ShippingNet.DataPropertyName = "ShippingNet";
ShippingNet.HeaderText = "Ship";
ShippingNet.MinimumWidth = 60;
ShippingNet.Name = "ShippingNet";
ShippingNet.ReadOnly = true;
ShippingNet.Width = 60;
//
// OtherNet
//
OtherNet.DataPropertyName = "OtherNet";
OtherNet.HeaderText = "Adjust";
OtherNet.MinimumWidth = 60;
OtherNet.Name = "OtherNet";
OtherNet.ReadOnly = true;
OtherNet.Width = 60;
//
// LineTotalTax
//
LineTotalTax.DataPropertyName = "LineTotalTax";
LineTotalTax.HeaderText = "Tax";
LineTotalTax.MinimumWidth = 60;
LineTotalTax.Name = "LineTotalTax";
LineTotalTax.ReadOnly = true;
LineTotalTax.Width = 60;
//
// LineTotalGross
//
LineTotalGross.DataPropertyName = "LineTotalGross";
LineTotalGross.HeaderText = "Total";
LineTotalGross.MinimumWidth = 60;
LineTotalGross.Name = "LineTotalGross";
LineTotalGross.ReadOnly = true;
LineTotalGross.Width = 60;
//
// bsInvoiceLines
//
bsInvoiceLines.DataMember = "InvoiceLines";
bsInvoiceLines.DataSource = bsInvoice;
//
// textBoxOrderChannel
//
textBoxOrderChannel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBoxOrderChannel.DataBindings.Add(new Binding("Text", bsInvoice, "PurchaseChannel", true));
textBoxOrderChannel.Location = new Point(915, 80);
textBoxOrderChannel.Name = "textBoxOrderChannel";
textBoxOrderChannel.Size = new Size(143, 23);
textBoxOrderChannel.TabIndex = 26;
//
// tabControl1
//
tabControl1.Controls.Add(tabPageAccountTransactions);
tabControl1.Controls.Add(tabPageNotes);
tabControl1.Location = new Point(16, 561);
tabControl1.Name = "tabControl1";
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(1042, 232);
tabControl1.TabIndex = 27;
//
// tabPageAccountTransactions
//
tabPageAccountTransactions.Location = new Point(4, 24);
tabPageAccountTransactions.Name = "tabPageAccountTransactions";
tabPageAccountTransactions.Padding = new Padding(3);
tabPageAccountTransactions.Size = new Size(1034, 204);
tabPageAccountTransactions.TabIndex = 0;
tabPageAccountTransactions.Text = "Account Transactions";
tabPageAccountTransactions.UseVisualStyleBackColor = true;
//
// tabPageNotes
//
tabPageNotes.Location = new Point(4, 24);
tabPageNotes.Name = "tabPageNotes";
tabPageNotes.Padding = new Padding(3);
tabPageNotes.Size = new Size(1034, 169);
tabPageNotes.TabIndex = 1;
tabPageNotes.Text = "Notes";
tabPageNotes.UseVisualStyleBackColor = true;
//
// PurchaseInvoice
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1070, 805);
Controls.Add(tabControl1);
Controls.Add(textBoxOrderChannel);
Controls.Add(dataGridView1);
Controls.Add(label11);
Controls.Add(label);
Controls.Add(label8);
Controls.Add(label7);
Controls.Add(label6);
Controls.Add(textBoxTotalAmount);
Controls.Add(textBoxTaxAmount);
Controls.Add(textBoxNetAmount);
Controls.Add(dateTimeOrderDate);
Controls.Add(labelSupplierRef);
Controls.Add(textBox1);
Controls.Add(labelPurchaseInvoiceNumber);
Controls.Add(label5);
Controls.Add(textBoxUsername);
Controls.Add(label4);
Controls.Add(textBoxPaypalEmail);
Controls.Add(label3);
Controls.Add(textBoxPaypalUsername);
Controls.Add(label2);
Controls.Add(textBoxEbayEmail);
Controls.Add(label1);
Controls.Add(textBoxEbayUsername);
Name = "PurchaseInvoice";
Text = "PurchaseInvoice";
Load += PurchaseInvoice_Load;
((System.ComponentModel.ISupportInitialize)bsInvoice).EndInit();
((System.ComponentModel.ISupportInitialize)bsContact).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
((System.ComponentModel.ISupportInitialize)bsInvoiceLines).EndInit();
tabControl1.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
#endregion
private BindingSource bsInvoice;
private TextBox textBoxEbayUsername;
private Label label1;
private Label label2;
private TextBox textBoxEbayEmail;
private Label label3;
private TextBox textBoxPaypalUsername;
private Label label4;
private TextBox textBoxPaypalEmail;
private Label label5;
private TextBox textBoxUsername;
private Label labelPurchaseInvoiceNumber;
private Label labelSupplierRef;
private TextBox textBox1;
private DateTimePicker dateTimeOrderDate;
private TextBox textBoxTotalAmount;
private TextBox textBoxTaxAmount;
private TextBox textBoxNetAmount;
private Label label6;
private Label label7;
private Label label8;
private Label label;
private Label label11;
private DataGridView dataGridView1;
private BindingSource bsContact;
private BindingSource bsInvoiceLines;
private DataGridViewTextBoxColumn itemDescriptionDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn statusDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn itemQuantityDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn PurchaseId;
private DataGridViewTextBoxColumn PurchaseLineId;
private DataGridViewTextBoxColumn ItemNet;
private DataGridViewTextBoxColumn ShippingNet;
private DataGridViewTextBoxColumn OtherNet;
private DataGridViewTextBoxColumn LineTotalTax;
private DataGridViewTextBoxColumn LineTotalGross;
private TextBox textBoxOrderChannel;
public TabControl tabControl1;
private TabPage tabPageAccountTransactions;
private TabPage tabPageNotes;
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace bnhtrade.gui.Forms.Account
{
public partial class PurchaseInvoice : Form
{
Core.Model.Account.PurchaseInvoice purchaseInvoice;
public PurchaseInvoice(Core.Model.Account.PurchaseInvoice purchaseInvoice)
{
InitializeComponent();
this.purchaseInvoice = purchaseInvoice;
}
private void PurchaseInvoice_Load(object sender, EventArgs e)
{
bsInvoiceLines.DataSource = purchaseInvoice;
bsContact.DataSource = purchaseInvoice.Contact;
bsInvoice.DataSource = purchaseInvoice;
labelPurchaseInvoiceNumber.Text += purchaseInvoice.PurchaseNumber.ToString("D6");
}
}
}

View File

@@ -0,0 +1,153 @@
<?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>
<metadata name="bsInvoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="bsContact.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>149, 21</value>
</metadata>
<metadata name="bsContact.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>149, 21</value>
</metadata>
<metadata name="PurchaseId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PurchaseLineId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ItemNet.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ShippingNet.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OtherNet.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="LineTotalTax.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="LineTotalGross.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bsInvoiceLines.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>257, 21</value>
</metadata>
</root>

270
src/bnhtrade.gui/Home.Designer.cs generated Normal file
View File

@@ -0,0 +1,270 @@
namespace bnhtrade.gui
{
partial class Home
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
tabControl1 = new TabControl();
tabPage1 = new TabPage();
tabPage2 = new TabPage();
Receiving = new TabPage();
labelDataGridCount = new Label();
dataGridView1 = new DataGridView();
purchaseNumberDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
purchaseDateDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
itemDescriptionDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
purchaseLineIdDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
lineStatusDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
purchaseIdDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
bsReceivingLines = new BindingSource(components);
buttonSearch = new Button();
comboBox1 = new ComboBox();
purchaseLineStatusBindingSource = new BindingSource(components);
dateTimeOrderSearch = new DateTimePicker();
label1 = new Label();
textboxOrderSearch = new TextBox();
tabControl1.SuspendLayout();
Receiving.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
((System.ComponentModel.ISupportInitialize)bsReceivingLines).BeginInit();
((System.ComponentModel.ISupportInitialize)purchaseLineStatusBindingSource).BeginInit();
SuspendLayout();
//
// tabControl1
//
tabControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
tabControl1.Controls.Add(tabPage1);
tabControl1.Controls.Add(tabPage2);
tabControl1.Controls.Add(Receiving);
tabControl1.Location = new Point(12, 12);
tabControl1.Name = "tabControl1";
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(1022, 533);
tabControl1.TabIndex = 0;
tabControl1.SelectedIndexChanged += tabControl1_SelectedIndexChanged;
//
// tabPage1
//
tabPage1.Location = new Point(4, 24);
tabPage1.Name = "tabPage1";
tabPage1.Padding = new Padding(3);
tabPage1.Size = new Size(1014, 505);
tabPage1.TabIndex = 0;
tabPage1.Text = "Home";
tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
tabPage2.AccessibleName = "";
tabPage2.Location = new Point(4, 24);
tabPage2.Name = "tabPage2";
tabPage2.Padding = new Padding(3);
tabPage2.Size = new Size(1014, 505);
tabPage2.TabIndex = 1;
tabPage2.Text = "FBA Shipments";
tabPage2.UseVisualStyleBackColor = true;
//
// Receiving
//
Receiving.Controls.Add(labelDataGridCount);
Receiving.Controls.Add(dataGridView1);
Receiving.Controls.Add(buttonSearch);
Receiving.Controls.Add(comboBox1);
Receiving.Controls.Add(dateTimeOrderSearch);
Receiving.Controls.Add(label1);
Receiving.Controls.Add(textboxOrderSearch);
Receiving.Location = new Point(4, 24);
Receiving.Name = "Receiving";
Receiving.Padding = new Padding(3);
Receiving.Size = new Size(1014, 505);
Receiving.TabIndex = 2;
Receiving.Text = "Receiving";
Receiving.UseVisualStyleBackColor = true;
Receiving.Click += tabPage3_Click;
//
// labelDataGridCount
//
labelDataGridCount.Anchor = AnchorStyles.Right;
labelDataGridCount.ImageAlign = ContentAlignment.MiddleRight;
labelDataGridCount.Location = new Point(857, 70);
labelDataGridCount.Name = "labelDataGridCount";
labelDataGridCount.RightToLeft = RightToLeft.Yes;
labelDataGridCount.Size = new Size(129, 21);
labelDataGridCount.TabIndex = 6;
labelDataGridCount.Text = "labelListCount";
labelDataGridCount.TextAlign = ContentAlignment.MiddleLeft;
//
// dataGridView1
//
dataGridView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView1.AutoGenerateColumns = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { purchaseNumberDataGridViewTextBoxColumn, purchaseDateDataGridViewTextBoxColumn, itemDescriptionDataGridViewTextBoxColumn, purchaseLineIdDataGridViewTextBoxColumn, lineStatusDataGridViewTextBoxColumn, purchaseIdDataGridViewTextBoxColumn });
dataGridView1.DataSource = bsReceivingLines;
dataGridView1.Location = new Point(31, 94);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(955, 396);
dataGridView1.TabIndex = 5;
dataGridView1.DoubleClick += dataGridView1_DoubleClick;
//
// purchaseNumberDataGridViewTextBoxColumn
//
purchaseNumberDataGridViewTextBoxColumn.DataPropertyName = "PurchaseNumber";
purchaseNumberDataGridViewTextBoxColumn.HeaderText = "PurchaseNumber";
purchaseNumberDataGridViewTextBoxColumn.Name = "purchaseNumberDataGridViewTextBoxColumn";
//
// purchaseDateDataGridViewTextBoxColumn
//
purchaseDateDataGridViewTextBoxColumn.DataPropertyName = "PurchaseDate";
purchaseDateDataGridViewTextBoxColumn.HeaderText = "PurchaseDate";
purchaseDateDataGridViewTextBoxColumn.Name = "purchaseDateDataGridViewTextBoxColumn";
//
// itemDescriptionDataGridViewTextBoxColumn
//
itemDescriptionDataGridViewTextBoxColumn.DataPropertyName = "ItemDescription";
itemDescriptionDataGridViewTextBoxColumn.HeaderText = "ItemDescription";
itemDescriptionDataGridViewTextBoxColumn.Name = "itemDescriptionDataGridViewTextBoxColumn";
itemDescriptionDataGridViewTextBoxColumn.Width = 500;
//
// purchaseLineIdDataGridViewTextBoxColumn
//
purchaseLineIdDataGridViewTextBoxColumn.DataPropertyName = "PurchaseLineId";
purchaseLineIdDataGridViewTextBoxColumn.HeaderText = "PurchaseLineId";
purchaseLineIdDataGridViewTextBoxColumn.Name = "purchaseLineIdDataGridViewTextBoxColumn";
//
// lineStatusDataGridViewTextBoxColumn
//
lineStatusDataGridViewTextBoxColumn.DataPropertyName = "LineStatus";
lineStatusDataGridViewTextBoxColumn.HeaderText = "LineStatus";
lineStatusDataGridViewTextBoxColumn.Name = "lineStatusDataGridViewTextBoxColumn";
//
// purchaseIdDataGridViewTextBoxColumn
//
purchaseIdDataGridViewTextBoxColumn.DataPropertyName = "PurchaseId";
purchaseIdDataGridViewTextBoxColumn.HeaderText = "PurchaseId";
purchaseIdDataGridViewTextBoxColumn.Name = "purchaseIdDataGridViewTextBoxColumn";
//
// bsReceivingLines
//
bsReceivingLines.DataSource = typeof(Core.Model.Account.PurchaseInvoiceLineSummary);
//
// buttonSearch
//
buttonSearch.Location = new Point(865, 37);
buttonSearch.Name = "buttonSearch";
buttonSearch.Size = new Size(109, 25);
buttonSearch.TabIndex = 4;
buttonSearch.Text = "Search";
buttonSearch.UseVisualStyleBackColor = true;
buttonSearch.Click += buttonSearch_Click;
//
// comboBox1
//
comboBox1.DataSource = purchaseLineStatusBindingSource;
comboBox1.DisplayMember = "PurchaseLineStatusName";
comboBox1.FormattingEnabled = true;
comboBox1.Location = new Point(195, 39);
comboBox1.Name = "comboBox1";
comboBox1.Size = new Size(189, 23);
comboBox1.TabIndex = 3;
comboBox1.ValueMember = "PurchaseLineStatusId";
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
//
// purchaseLineStatusBindingSource
//
purchaseLineStatusBindingSource.DataSource = typeof(Core.Model.Purchase.PurchaseLineStatus);
purchaseLineStatusBindingSource.CurrentChanged += purchaseLineStatusBindingSource_CurrentChanged;
//
// dateTimeOrderSearch
//
dateTimeOrderSearch.Location = new Point(31, 39);
dateTimeOrderSearch.Name = "dateTimeOrderSearch";
dateTimeOrderSearch.Size = new Size(131, 23);
dateTimeOrderSearch.TabIndex = 2;
dateTimeOrderSearch.ValueChanged += dateTimeOrderSearch_ValueChanged;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(31, 21);
label1.Name = "label1";
label1.Size = new Size(75, 15);
label1.TabIndex = 1;
label1.Text = "Order Search";
//
// textboxOrderSearch
//
textboxOrderSearch.Location = new Point(417, 39);
textboxOrderSearch.Name = "textboxOrderSearch";
textboxOrderSearch.Size = new Size(415, 23);
textboxOrderSearch.TabIndex = 0;
textboxOrderSearch.KeyPress += textboxOrderSearch_KeyPress;
//
// Home
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1046, 557);
Controls.Add(tabControl1);
Name = "Home";
Text = "Form1";
Load += Form1_Load;
tabControl1.ResumeLayout(false);
Receiving.ResumeLayout(false);
Receiving.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
((System.ComponentModel.ISupportInitialize)bsReceivingLines).EndInit();
((System.ComponentModel.ISupportInitialize)purchaseLineStatusBindingSource).EndInit();
ResumeLayout(false);
}
#endregion
private TabControl tabControl1;
private TabPage tabPage1;
private TabPage tabPage2;
private TabPage Receiving;
private TextBox textboxOrderSearch;
private Label label1;
private DateTimePicker dateTimeOrderSearch;
private ComboBox comboBox1;
private BindingSource purchaseLineStatusBindingSource;
private Button buttonSearch;
private DataGridView dataGridView1;
private BindingSource bsReceivingLines;
private DataGridViewTextBoxColumn purchaseNumberDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn purchaseDateDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn itemDescriptionDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn purchaseLineIdDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn lineStatusDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn purchaseIdDataGridViewTextBoxColumn;
private Label labelDataGridCount;
}
}

114
src/bnhtrade.gui/Home.cs Normal file
View File

@@ -0,0 +1,114 @@
using bnhtrade.gui.Forms.Account;
namespace bnhtrade.gui
{
public partial class Home : Form
{
bool initTabReceiving = false;
public Home()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void tabPage3_Click(object sender, EventArgs e)
{
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
int index = (sender as TabControl).SelectedIndex;
string name = tabControl1.SelectedTab.Name;
if (name == "Receiving" && initTabReceiving == false)
{
InitialiseTabReceiving();
}
}
private void InitialiseTabReceiving()
{
Cursor.Current = Cursors.WaitCursor;
purchaseLineStatusBindingSource.DataSource = new Core.Logic.Account.PurchaseInvoiceMisc().ReadLineStatusToList();
comboBox1.SelectedIndex = 3;
ListBoxQuery();
initTabReceiving = true;
Cursor.Current = Cursors.Default;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
ListBoxQuery();
textboxOrderSearch.Select();
}
private void purchaseLineStatusBindingSource_CurrentChanged(object sender, EventArgs e)
{
}
private void buttonSearch_Click(object sender, EventArgs e)
{
ListBoxQuery();
}
private void textboxOrderSearch_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
ListBoxQuery();
e.Handled = true;
}
}
private void ListBoxQuery()
{
char[] separator = { ' ' };
var searchList = textboxOrderSearch.Text.Split(separator).ToList();
string comboBox = null;
if (comboBox1.Text != "All")
{
comboBox = comboBox1.Text;
}
bsReceivingLines.DataSource = new Core.Logic.Account.PurchaseInvoiceMisc().GetLineSummary(
dateTimeOrderSearch.Value
, comboBox
, searchList);
labelDataGridCount.Text = bsReceivingLines.Count.ToString();
}
private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{
}
private void dateTimeOrderSearch_ValueChanged(object sender, EventArgs e)
{
ListBoxQuery();
textboxOrderSearch.Select();
}
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
var row = dataGridView1.CurrentCell.RowIndex;
var lineSummary = (bnhtrade.Core.Model.Account.PurchaseInvoiceLineSummary)bsReceivingLines[row];
int purchaseId = lineSummary.PurchaseId;
var dbRead = new Core.Logic.Account.PurchaseInvoice();
dbRead.PurchaseInvoiceIdList = new List<int> { purchaseId };
var dbresult = dbRead.Read();
var purchaseInvoice = dbresult[purchaseId];
var form = new PurchaseInvoice(purchaseInvoice);
form.Show();
}
}
}

126
src/bnhtrade.gui/Home.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="bsReceivingLines.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>250, 17</value>
</metadata>
<metadata name="purchaseLineStatusBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,17 @@
namespace bnhtrade.gui
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Home());
}
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="PurchaseLineStatus" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>bnhtrade.Core.Logic.Purchase.PurchaseLineStatus, bnhtrade.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Contact" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>bnhtrade.Core.Model.Account.Contact, bnhtrade.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="PurchaseInvoice" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>bnhtrade.Core.Model.Account.PurchaseInvoice, bnhtrade.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="PurchaseInvoiceLineSummary" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>bnhtrade.Core.Model.Account.PurchaseInvoiceLineSummary, bnhtrade.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="PurchaseLineStatus" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>bnhtrade.Core.Model.Purchase.PurchaseLineStatus, bnhtrade.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <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 bnhtrade.gui.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("bnhtrade.gui.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;
}
}
}
}

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
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">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</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.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:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<BaseOutputPath>C:\Users\Bobbie\source\repos\stokebob\bnhtrade\bin</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\bin\$(AssemblyName)\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\bin\$(AssemblyName)\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>
</Project>