mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 06:27:15 +00:00
Update/restructure of COM type library
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,8 @@
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
packages/
|
||||
artifacts/
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
|
||||
@@ -5,14 +5,16 @@ VisualStudioVersion = 15.0.27428.2037
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF330C30-8231-4D54-B60C-FF0644713502}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
build\bnhtradeRegasmInstall.bat = build\bnhtradeRegasmInstall.bat
|
||||
build\bnhtradeRegasmRefresh.bat = build\bnhtradeRegasmRefresh.bat
|
||||
build\bnhtradeRegasmUninstall.bat = build\bnhtradeRegasmUninstall.bat
|
||||
build\bnhtrade.ComTypeLib.RegAsmInstall.bat = build\bnhtrade.ComTypeLib.RegAsmInstall.bat
|
||||
build\bnhtrade.ComTypeLib.RegAsmRefresh.bat = build\bnhtrade.ComTypeLib.RegAsmRefresh.bat
|
||||
build\bnhtrade.ComTypeLib.RegAsmUninstall.bat = build\bnhtrade.ComTypeLib.RegAsmUninstall.bat
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtradeDatabaseClient", "src\bnhtrade Database Client\bnhtradeDatabaseClient.csproj", "{339D7413-3DA7-46EA-A55C-255A9A6B95EB}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.ScheduledTasks", "src\bnhtrade.ScheduledTasks\bnhtrade.ScheduledTasks.csproj", "{5D6E1D66-3901-4340-95C6-EE65051AB623}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtradeScheduledTasks", "src\bnhtrade Scheduled Tasks\bnhtradeScheduledTasks.csproj", "{5D6E1D66-3901-4340-95C6-EE65051AB623}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -20,14 +22,18 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5D6E1D66-3901-4340-95C6-EE65051AB623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5D6E1D66-3901-4340-95C6-EE65051AB623}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D6E1D66-3901-4340-95C6-EE65051AB623}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D6E1D66-3901-4340-95C6-EE65051AB623}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{339D7413-3DA7-46EA-A55C-255A9A6B95EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
28
build/bnhtrade.ComTypeLib.RegAsmInstall.bat
Normal file
28
build/bnhtrade.ComTypeLib.RegAsmInstall.bat
Normal file
@@ -0,0 +1,28 @@
|
||||
@set batchpath=%~dp0
|
||||
@set dllpath=%batchpath%
|
||||
::bnhtrade Database Client\bin\Release\
|
||||
|
||||
@copy "%dllpath%bnhtrade.Core.dll" "%SYSTEMROOT%\SysWOW64\bnhtrade.Core.dll"
|
||||
@copy "%dllpath%bnhtradeCOM.dll" "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
|
||||
@copy "%dllpath%ABrain.AmazonMWS.dll" "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.dll"
|
||||
|
||||
@copy "%dllpath%bnhtrade.Core.dll" "%SYSTEMROOT%\System32\bnhtrade.Core.dll"
|
||||
@copy "%dllpath%bnhtradeCOM.dll" "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
|
||||
@copy "%dllpath%ABrain.AmazonMWS.dll" "%SYSTEMROOT%\System32\ABrain.AmazonMWS.dll"
|
||||
|
||||
@c:
|
||||
@cd\Windows\Microsoft.NET\Framework\v4.*
|
||||
rem regasm.exe /codebase /tlb "bnhtrade.Core.dll"
|
||||
regasm.exe /codebase /tlb "bnhtradeCOM.dll"
|
||||
rem regasm.exe /codebase /tlb "ABrain.AmazonMWS.dll"
|
||||
|
||||
@cd\Windows\Microsoft.NET\Framework64\v4.*
|
||||
rem regasm.exe /codebase /tlb "bnhtrade.Core.dll"
|
||||
regasm.exe /codebase /tlb "bnhtradeCOM.dll"
|
||||
rem regasm.exe /codebase /tlb "ABrain.AmazonMWS.dll"
|
||||
|
||||
@echo.
|
||||
@echo Finished running regasm install script.
|
||||
@echo.
|
||||
@rem if no arguments passed, pause
|
||||
@IF "%~1"=="" @pause
|
||||
7
build/bnhtrade.ComTypeLib.RegAsmRefresh.bat
Normal file
7
build/bnhtrade.ComTypeLib.RegAsmRefresh.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
@set mypath=%~dp0
|
||||
|
||||
call "%mypath%bnhtrade.ComTypeLib.RegAsmUninstall.bat" nopause
|
||||
call "%mypath%bnhtrade.ComTypeLib.RegAsmInstall.bat" nopause
|
||||
@echo Completed regasm refresh
|
||||
@echo.
|
||||
@pause
|
||||
29
build/bnhtrade.ComTypeLib.RegAsmUninstall.bat
Normal file
29
build/bnhtrade.ComTypeLib.RegAsmUninstall.bat
Normal file
@@ -0,0 +1,29 @@
|
||||
@c:
|
||||
@cd\Windows\Microsoft.NET\Framework\v4.*
|
||||
rem regasm.exe /u "%SYSTEMROOT%\System32\bnhtrade.Core.dll"
|
||||
regasm.exe /u "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
|
||||
rem regasm.exe /u "%SYSTEMROOT%\System32\ABrain.AmazonMWS.dll"
|
||||
@cd\Windows\Microsoft.NET\Framework64\v4.*
|
||||
rem regasm.exe /u "%SYSTEMROOT%\System32\bnhtrade.Core.dll"
|
||||
regasm.exe /u "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
|
||||
rem regasm.exe /u "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.dll"
|
||||
cd
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\bnhtrade.Core.dll"
|
||||
rem @del /q "%SYSTEMROOT%\SysWOW64\bnhtrade.Core.tlb"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.dll"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeCOM.tlb"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.dll"
|
||||
rem @del /q "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.tlb"
|
||||
|
||||
@del /q "%SYSTEMROOT%\System32\bnhtrade.Core.dll"
|
||||
rem @del /q "%SYSTEMROOT%\System32\bnhtrade.Core.tlb"
|
||||
@del /q "%SYSTEMROOT%\System32\bnhtradeCOM.dll"
|
||||
@del /q "%SYSTEMROOT%\System32\bnhtradeCOM.tlb"
|
||||
@del /q "%SYSTEMROOT%\System32\ABrain.AmazonMWS.dll"
|
||||
rem @del /q "%SYSTEMROOT%\System32\ABrain.AmazonMWS.tlb"
|
||||
|
||||
@echo.
|
||||
@echo Finished running regasm uninstall script.
|
||||
@rem if no arguments passed, pause
|
||||
@echo.
|
||||
@IF "%~1"=="" @pause
|
||||
@@ -1,23 +0,0 @@
|
||||
@set batchpath=%~dp0
|
||||
@set dllpath=%batchpath%bnhtrade Database Client\bin\Release\
|
||||
|
||||
@copy "%dllpath%bnhtradeDatabaseClient.dll" "%SYSTEMROOT%\SysWOW64\bnhtradeDatabaseClient.dll"
|
||||
@copy "%dllpath%ABrain.AmazonMWS.dll" "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.dll"
|
||||
|
||||
@copy "%dllpath%bnhtradeDatabaseClient.dll" "%SYSTEMROOT%\System32\bnhtradeDatabaseClient.dll"
|
||||
@copy "%dllpath%ABrain.AmazonMWS.dll" "%SYSTEMROOT%\System32\ABrain.AmazonMWS.dll"
|
||||
|
||||
@c:
|
||||
@cd\Windows\Microsoft.NET\Framework\v4.*
|
||||
regasm.exe /codebase /tlb "bnhtradeDatabaseClient.dll"
|
||||
regasm.exe /codebase /tlb "ABrain.AmazonMWS.dll"
|
||||
|
||||
@cd\Windows\Microsoft.NET\Framework64\v4.*
|
||||
regasm.exe /codebase /tlb "bnhtradeDatabaseClient.dll"
|
||||
regasm.exe /codebase /tlb "ABrain.AmazonMWS.dll"
|
||||
|
||||
@echo.
|
||||
@echo Finished running regasm install script.
|
||||
@echo.
|
||||
@rem if no arguments passed, pause
|
||||
@IF "%~1"=="" @pause
|
||||
@@ -1,7 +0,0 @@
|
||||
@set mypath=%~dp0
|
||||
|
||||
call "%mypath%bnhtradeRegasmUninstall.bat" nopause
|
||||
call "%mypath%bnhtradeRegasmInstall.bat" nopause
|
||||
@echo Completed regasm refresh
|
||||
@echo.
|
||||
@pause
|
||||
@@ -1,21 +0,0 @@
|
||||
@c:
|
||||
@cd\Windows\Microsoft.NET\Framework\v4.*
|
||||
regasm.exe /u "bnhtradeDatabaseClient.dll"
|
||||
@cd\Windows\Microsoft.NET\Framework64\v4.*
|
||||
regasm.exe /u "bnhtradeDatabaseClient.dll"
|
||||
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeDatabaseClient.dll"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\bnhtradeDatabaseClient.tlb"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.dll"
|
||||
@del /q "%SYSTEMROOT%\SysWOW64\ABrain.AmazonMWS.tlb"
|
||||
|
||||
@del /q "%SYSTEMROOT%\System32\bnhtradeDatabaseClient.dll"
|
||||
@del /q "%SYSTEMROOT%\System32\bnhtradeDatabaseClient.tlb"
|
||||
@del /q "%SYSTEMROOT%\System32\ABrain.AmazonMWS.dll"
|
||||
@del /q "%SYSTEMROOT%\System32\ABrain.AmazonMWS.tlb"
|
||||
|
||||
@echo.
|
||||
@echo Finished running regasm uninstall script.
|
||||
@rem if no arguments passed, pause
|
||||
@echo.
|
||||
@IF "%~1"=="" @pause
|
||||
@@ -1,539 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using bnhtradeDatabaseClient.Product;
|
||||
using bnhtradeDatabaseClient.EbayQuery;
|
||||
using bnhtradeDatabaseClient.Database;
|
||||
using bnhtradeDatabaseClient;
|
||||
using bnhtradeDatabaseClient;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using static Vba6.StockQuery;
|
||||
|
||||
namespace Vba6
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("033326dd-6edb-4343-8334-4c31acf3565e")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IConnectionCredential
|
||||
{
|
||||
string UserId { get; set; }
|
||||
string Password { get; set; }
|
||||
string ConnectionString { get; }
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
[Guid("b670a3fc-feeb-487b-ad25-89a1115e9aa5")]
|
||||
public interface IVbaSqlConnection
|
||||
{
|
||||
SqlConnection GetSqlConnection(ConnectionCredential vbaConnCred);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
[Guid("05860bc9-6a6d-4b8f-a611-3921c4b4755c")]
|
||||
public interface IEbayQuery
|
||||
{
|
||||
int EbayListingItemGet(string itemNumber, DateTime listingEnd, ConnectionCredential sqlConnCred);
|
||||
|
||||
object[] EbayListingItemInsert(string itemNumber, DateTime listingEnd, string listingTitle, string listingDescription, string ebayUser,
|
||||
bool isAuction, [MarshalAs(UnmanagedType.Currency)] decimal price, DateTime priceTime, [MarshalAs(UnmanagedType.Currency)] decimal shipping,
|
||||
string itemLocation, string category, string imageFilePath, ConnectionCredential sqlConnCred);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
[Guid("0fd536ce-b913-438d-9343-9a1a7a40af71")]
|
||||
public interface IAmazonMws
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("90eefc75-11d7-449d-a99f-3e4d1a795ebc")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IPurchaseQuery
|
||||
{
|
||||
void PurchaseLineTransactionNetInsert(ConnectionCredential sqlConnCred, int purchaseLineId, int debitAccountId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet,
|
||||
DateTime entryDate);
|
||||
|
||||
void PurchaseLineTransactionNetUpdate(ConnectionCredential sqlConnCred, int accountJouranlId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet, int debitAccountId);
|
||||
|
||||
void PurchaseLineTransactionDelete(ConnectionCredential sqlConnCred, int purchaseLineId, int accountJournalId);
|
||||
|
||||
int PurchaseLineTransactionStockInsert(ConnectionCredential sqlConnCred, int accountJournalId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId,
|
||||
int accountTaxCodeId, int stockDebitStatusId);
|
||||
|
||||
void PurchaseLineTransactionStockDelete(ConnectionCredential sqlConnCred, int stockId);
|
||||
}
|
||||
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("b6215466-7b84-4d1f-807f-6b305a4c05f0")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IAccountQuery
|
||||
{
|
||||
int AccountJournalInsert(ConnectionCredential sqlConnCred, int journalTypeId, DateTime entryDate,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false);
|
||||
|
||||
bool AccountJournalDelete(ConnectionCredential sqlConnCred, int accountJournalId);
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Currency)]
|
||||
decimal CurrencyConvertToGbp(ConnectionCredential sqlConnCred, string currencyCode,
|
||||
[MarshalAs(UnmanagedType.Currency)] decimal amount, DateTime conversionDate);
|
||||
|
||||
int CurrencyExchangeRateInsert(ConnectionCredential sqlConnCred, int exchangeRateSource, string currencyCode,
|
||||
[MarshalAs(UnmanagedType.Currency)] decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("ca9ef5b4-f0e6-4b77-9602-0d5f123a1d8d")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IProductQuery
|
||||
{
|
||||
string ReturnStringValue(string stringValue);
|
||||
|
||||
double ReturnDateValueAsDouble(string stringValue);
|
||||
|
||||
int ProductGetProductIdByCatId(int catId, ConnectionCredential sqlConnCred);
|
||||
|
||||
string ProductCompetitivePriceGet(int productId, int conditionId, ConnectionCredential sqlConnCred);
|
||||
|
||||
int ProductCompetitivePriceSet(int productId, int conditionId, [MarshalAs(UnmanagedType.Currency)] decimal price, bool isBuyBoxPrice, DateTime priceDate, ConnectionCredential sqlConnCred);
|
||||
|
||||
void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("d595d682-8b1e-4aa4-86b7-700e44950e1b")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IStockQuery
|
||||
{
|
||||
int StockInsertPurchase(ConnectionCredential sqlConnCred, int productId, int conditionId, int accountTaxCodeId, int accountJournalId, int quantity, int statusDebitId);
|
||||
|
||||
int StockInsertOwnerIntroduced(ConnectionCredential sqlConnCred, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId, int accountTaxCodeId, DateTime entryDate, int debitStatusId);
|
||||
|
||||
void StockDeletePurchase(ConnectionCredential sqlConnCred, int stockId);
|
||||
|
||||
void StockDeleteOwnerIntroduced(ConnectionCredential sqlConnCred, int stockId);
|
||||
|
||||
int StockReallocate(ConnectionCredential sqlConnCred, int stockId, int quantity, int debitStatusId, int creditStatusId, DateTime entryDate);
|
||||
|
||||
void StockJournalDelete(ConnectionCredential sqlConnCred, int stockJournalId);
|
||||
|
||||
object ReconcileStockTransactions(ConnectionCredential sqlConnCred);
|
||||
|
||||
bool StockJournalConsistencyCheck(ConnectionCredential sqlConnCred, int stockId);
|
||||
}
|
||||
|
||||
//[ComVisible(true)]
|
||||
//[Guid("0558e6dc-f5d4-41b6-a51c-856426e77e21")]
|
||||
//[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
//public interface IReconcileStockTransactionsResult
|
||||
//{
|
||||
// bool ReconciliationComplete { get; set; }
|
||||
// int StockTransactionId { get; set; }
|
||||
// int StockTransactionTypeId { get; set; }
|
||||
// string ProgressMessage { get; set; }
|
||||
// int ItemsCompleted { get; set; }
|
||||
// int ItemsRemaining { get; set; }
|
||||
// DateTime LastItemDateTime { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[Guid("7aa43409-317a-43ad-85f9-2019b5883ab8")]
|
||||
[ProgId("bnhtradeDb.ConnectionCredential")]
|
||||
public class ConnectionCredential : IConnectionCredential
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=" + UserId +
|
||||
";Password=" + Password + ";MultipleActiveResultSets=true";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[Guid("ab7f6468-42db-4f33-8c94-62dc7e1759ea")]
|
||||
[ProgId("bnhtradeDb.Connection")]
|
||||
public class VbaSqlConnection : IVbaSqlConnection
|
||||
{
|
||||
[ComVisible(false)]
|
||||
public SqlConnection GetSqlConnection(ConnectionCredential vbaConnCred)
|
||||
{
|
||||
Connection.DatabaseConnectionDetail connDetail = new Connection.DatabaseConnectionDetail();
|
||||
connDetail.UserId = vbaConnCred.UserId;
|
||||
connDetail.Password = vbaConnCred.Password;
|
||||
|
||||
SqlConnection sqlConn = new SqlConnection(connDetail.ConnectionString);
|
||||
|
||||
return sqlConn;
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[Guid("e6743dfa-47d3-4aeb-8f2b-d4e0d5312146")]
|
||||
[ProgId("bnhtradeDb.EbayQuery")]
|
||||
public class EbayQuery : IEbayQuery
|
||||
{
|
||||
public int EbayListingItemGet(string itemNumber, DateTime listingEnd, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
Ebay request = new Ebay();
|
||||
return request.EbayListingItemGet(sqlConnCred.ConnectionString, itemNumber, listingEnd);
|
||||
|
||||
}
|
||||
|
||||
public object[] EbayListingItemInsert(string itemNumber, DateTime listingEnd, string listingTitle, string listingDescription, string ebayUser,
|
||||
bool isAuction, [MarshalAs(UnmanagedType.Currency)] decimal price, DateTime priceTime, [MarshalAs(UnmanagedType.Currency)] decimal shipping,
|
||||
string itemLocation, string category, string imageFilePath, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
// load imagefile
|
||||
FileStream imageFile = null;
|
||||
string imageFileExtension = "";
|
||||
if (imageFilePath.Length > 0)
|
||||
{
|
||||
imageFileExtension = Path.GetExtension(imageFilePath);
|
||||
if (imageFileExtension == string.Empty)
|
||||
{
|
||||
throw new Exception("Error parsing file extension from file path.");
|
||||
}
|
||||
imageFileExtension = imageFileExtension.Substring(1);
|
||||
imageFile = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read);
|
||||
}
|
||||
|
||||
// create the return array object
|
||||
Ebay request = new Ebay();
|
||||
(int ListingItemId, bool IsNewListingItem, bool IsNewListing) result =
|
||||
request.EbayListingItemInsert(sqlConnCred.ConnectionString, itemNumber, listingEnd, listingTitle, listingDescription, ebayUser,
|
||||
isAuction, price, priceTime, shipping, itemLocation, category, imageFile, imageFileExtension);
|
||||
if (imageFile != null)
|
||||
{ imageFile.Dispose(); }
|
||||
|
||||
// create return array
|
||||
object[] returnArray = new object[3];
|
||||
returnArray[0] = result.ListingItemId;
|
||||
returnArray[1] = result.IsNewListingItem;
|
||||
returnArray[2] = result.IsNewListing;
|
||||
return returnArray;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("23527370-5f3f-47d8-b6a0-35b73890876c")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtradeDb.AmazonMws")]
|
||||
// [ClassInterface(ClassInterfaceType.AutoDual)]
|
||||
public class AmazonMws : IAmazonMws
|
||||
{
|
||||
static void ProductUpdateAmazonEstimateFee()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("59afd52d-86f4-4863-98e9-7b63a8b3ba51")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtradeDb.ProductQuery")]
|
||||
public class PurchaseQuery : IPurchaseQuery
|
||||
{
|
||||
public void PurchaseLineTransactionNetInsert(ConnectionCredential sqlConnCred, int purchaseLineId, int debitAccountId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet,
|
||||
DateTime entryDate)
|
||||
{
|
||||
bnhtradeDatabaseClient.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetInsert(sqlConnCred.ConnectionString,
|
||||
purchaseLineId, currencyCode, amountNet, entryDate);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionNetUpdate(ConnectionCredential sqlConnCred, int accountJouranlId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet, int debitAccountId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetUpdate(sqlConnCred.ConnectionString,
|
||||
accountJouranlId, currencyCode, amountNet, debitAccountId);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionDelete(ConnectionCredential sqlConnCred, int purchaseLineId, int accountJournalId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionDelete(sqlConnCred.ConnectionString, purchaseLineId, accountJournalId);
|
||||
}
|
||||
|
||||
public int PurchaseLineTransactionStockInsert(ConnectionCredential sqlConnCred, int accountJournalId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId,
|
||||
int accountTaxCodeId, int stockDebitStatusId)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockInsertPurchase(sqlConnCred.ConnectionString, productId, conditionId, accountTaxCodeId, accountJournalId, quantity, stockDebitStatusId);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionStockDelete(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockDeletePurchase(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("debaee08-a3d5-4f9b-b8cf-ad146c3e0ee9")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtradeDb.AccountQuery")]
|
||||
public class AccountQuery : IAccountQuery
|
||||
{
|
||||
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 bnhtradeDatabaseClient.Account.AccountQuery.AccountJournalInsert(sqlConnCred.ConnectionString, journalTypeId, entryDate,
|
||||
currencyCode, amount, debitAccountId, creditAccountId, lockEntry);
|
||||
}
|
||||
|
||||
public bool AccountJournalDelete(ConnectionCredential sqlConnCred, int accountJournalId)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Account.AccountQuery.AccountJournalDelete(sqlConnCred.ConnectionString, accountJournalId);
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Currency)]
|
||||
public decimal CurrencyConvertToGbp(ConnectionCredential sqlConnCred, string currencyCode,
|
||||
[MarshalAs(UnmanagedType.Currency)] decimal amount, DateTime conversionDate)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Account.AccountQuery.CurrencyConvertToGbp(sqlConnCred.ConnectionString, 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 bnhtradeDatabaseClient.Account.AccountQuery.CurrencyExchangeRateInsert(sqlConnCred.ConnectionString, exchangeRateSource, currencyCode,
|
||||
currencyUnitsPerGbp, periodStart, periodEnd, checkOverride);
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("237ac4be-87f0-4500-bd74-0423d1f72c75")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtradeDb.ProductQuery")]
|
||||
public class ProductQuery : IProductQuery
|
||||
{
|
||||
[ComVisible(false)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
public string ReturnStringValue(string stringValue)
|
||||
{
|
||||
return "kj;lk1";
|
||||
}
|
||||
|
||||
[ComVisible(false)]
|
||||
public double ReturnDateValueAsDouble(string stringValue)
|
||||
{
|
||||
DateTime theTimeNow = DateTime.UtcNow;
|
||||
return theTimeNow.ToOADate();
|
||||
// back in vba use the CDate(return) function to convert the double
|
||||
// vba Date --> c# DateTime works without marshalling
|
||||
}
|
||||
|
||||
public int ProductGetProductIdByCatId(int catId, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new bnhtradeDatabaseClient.Product.ProductQuery();
|
||||
int? result = request.ProductGetProductIdByCatId(sqlConnCred.ConnectionString, catId);
|
||||
if (result == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public string ProductCompetitivePriceGet(int productId, int conditionId, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new bnhtradeDatabaseClient.Product.ProductQuery();
|
||||
(decimal? price, DateTime? priceDate) result = request.ProductCompetitivePriceGet(sqlConnCred.ConnectionString, productId, conditionId);
|
||||
if (result.price == null || result.priceDate == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
DateTime priceDate2 = result.priceDate.Value;
|
||||
return result.price.ToString() + ";" + priceDate2.ToOADate();
|
||||
}
|
||||
}
|
||||
public int ProductCompetitivePriceSet(int productId, int conditionId, [MarshalAs(UnmanagedType.Currency)] decimal price, bool isBuyBoxPrice, DateTime priceDate, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new bnhtradeDatabaseClient.Product.ProductQuery();
|
||||
return request.ProductCompetitivePriceSet(sqlConnCred.ConnectionString, productId, conditionId, price, isBuyBoxPrice, priceDate);
|
||||
}
|
||||
|
||||
public void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList)
|
||||
{
|
||||
// get com object in string array
|
||||
var inputTuple = new List<(string asin, decimal priceToEstimate)>();
|
||||
string[] stringArray = Vba6.Functions.LoadComObjectIntoStringArray(inputList);
|
||||
|
||||
foreach (var item in stringArray)
|
||||
{
|
||||
string[] split = item.Split(';');
|
||||
if (split.Length != 2)
|
||||
{
|
||||
throw new Exception("Split function failed on line: " + item);
|
||||
}
|
||||
var tempTuple = (split[0], decimal.Parse(split[1]));
|
||||
inputTuple.Add(tempTuple);
|
||||
}
|
||||
|
||||
bnhtradeDatabaseClient.Product.ProductQuery.ProductUpdateAmazonEstimateFee(sqlConnCred.ConnectionString, inputTuple);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("10ff112d-a94f-4818-add4-8dddabf1fa9e")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtradeDb.StockQuery")]
|
||||
// [ClassInterface(ClassInterfaceType.AutoDual)]
|
||||
public class StockQuery : IStockQuery
|
||||
{
|
||||
public int StockInsertPurchase(ConnectionCredential sqlConnCred, int productId, int conditionId, int accountTaxCodeId, int accountJournalId, int quantity, int statusDebitId)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockInsertPurchase(sqlConnCred.ConnectionString, productId, conditionId, accountTaxCodeId, accountJournalId, quantity, statusDebitId);
|
||||
}
|
||||
|
||||
public int StockInsertOwnerIntroduced(ConnectionCredential sqlConnCred, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId, int accountTaxCodeId, DateTime entryDate, int debitStatusId)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockInsertOwnerIntroduced(sqlConnCred.ConnectionString, amount, quantity, productId, conditionId, accountTaxCodeId, entryDate, debitStatusId);
|
||||
}
|
||||
|
||||
public void StockDeletePurchase(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockDeletePurchase(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
|
||||
public void StockDeleteOwnerIntroduced(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockDeleteOwnerIntroduced(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
|
||||
public int StockReallocate(ConnectionCredential sqlConnCred, int stockId, int quantity, int debitStatusId, int creditStatusId, DateTime entryDate)
|
||||
{
|
||||
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
|
||||
|
||||
return bnhtradeDatabaseClient.Stock.StockJournal.StockReallocateByStockId(sqlConnCred.ConnectionString, 4, stockId, quantity, debitStatusId, creditStatusId, entryDate);
|
||||
}
|
||||
|
||||
public void StockJournalDelete(ConnectionCredential sqlConnCred, int stockJournalId)
|
||||
{
|
||||
bnhtradeDatabaseClient.Stock.StockJournal.StockJournalDelete(sqlConnCred.ConnectionString, stockJournalId);
|
||||
}
|
||||
|
||||
public object ReconcileStockTransactions(ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new bnhtradeDatabaseClient.Stock.StockReconciliation();
|
||||
var result = new bnhtradeDatabaseClient.Stock.StockReconciliation.ReconcileStockTransactionsResult();
|
||||
|
||||
result = request.ReconcileStockTransactions(sqlConnCred.ConnectionString, false);
|
||||
|
||||
//ReconcileStockTransactionsResult returnObject = new ReconcileStockTransactionsResult();
|
||||
|
||||
// copy values between classes
|
||||
|
||||
//PropertyInfo[] infos = typeof(ReconcileStockTransactionsResult).GetProperties();
|
||||
//foreach (PropertyInfo info in infos)
|
||||
//{
|
||||
// info.SetValue(returnObject, info.GetValue(result, null), null);
|
||||
//}
|
||||
|
||||
//foreach (PropertyInfo property in typeof(ReconcileStockTransactionsResult).GetProperties())
|
||||
//{
|
||||
// if (property.CanWrite)
|
||||
// {
|
||||
// property.SetValue(returnObject, property.GetValue(result, null), null);
|
||||
// }
|
||||
//}
|
||||
|
||||
//returnObject.ItemsCompleted = result.ItemsCompleted;
|
||||
//returnObject.ItemsRemaining = result.ItemsRemaining;
|
||||
//returnObject.LastItemDateTime = result.LastItemDateTime;
|
||||
//returnObject.ProgressMessage = result.ProgressMessage;
|
||||
//returnObject.ReconciliationComplete = returnObject.ReconciliationComplete;
|
||||
//returnObject.StockTransactionId = result.StockTransactionId;
|
||||
//returnObject.StockTransactionTypeId = result.StockTransactionTypeId;
|
||||
|
||||
//create the return array
|
||||
object[] returnArray = new object[7];
|
||||
returnArray[0] = result.ReconciliationComplete;
|
||||
returnArray[1] = result.ProgressMessage;
|
||||
returnArray[2] = result.StockTransactionId;
|
||||
returnArray[3] = result.StockTransactionTypeId;
|
||||
returnArray[4] = result.LastItemDateTime;
|
||||
returnArray[5] = result.ItemsCompleted;
|
||||
returnArray[6] = result.ItemsRemaining;
|
||||
return returnArray;
|
||||
|
||||
//return returnObject;
|
||||
|
||||
}
|
||||
|
||||
public bool StockJournalConsistencyCheck(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
return bnhtradeDatabaseClient.Stock.StockJournal.WIP_StockJournalConsistencyCheck(sqlConnCred.ConnectionString, stockId, null);
|
||||
}
|
||||
}
|
||||
|
||||
//[ComVisible(true)]
|
||||
//[Guid("75a40c36-0b36-4954-8f60-3093f040e54f")]
|
||||
//[ClassInterface(ClassInterfaceType.None)]
|
||||
//[ProgId("bnhtradeDb.StockReconciliationResult")]
|
||||
//// [ClassInterface(ClassInterfaceType.AutoDual)]
|
||||
//public class ReconcileStockTransactionsResult : IReconcileStockTransactionsResult
|
||||
//{
|
||||
// public bool ReconciliationComplete { get; set; } = false;
|
||||
// public int StockTransactionId { get; set; }
|
||||
// public int StockTransactionTypeId { get; set; }
|
||||
// public string ProgressMessage { get; set; }
|
||||
// public int ItemsCompleted { get; set; }
|
||||
// public int ItemsRemaining { get; set; }
|
||||
// public DateTime LastItemDateTime { get; set; }
|
||||
//}
|
||||
|
||||
public class Functions
|
||||
{
|
||||
public static string[] LoadComObjectIntoStringArray(object comObject)
|
||||
{
|
||||
Type thisType = comObject.GetType();
|
||||
Type strType = Type.GetType("System.Object[]");
|
||||
//Type strType = Type.GetType("System.String[*]");
|
||||
string[] stringArray = new string[1];
|
||||
// temporary allocation to keep compiler happy.
|
||||
if (thisType == strType)
|
||||
{
|
||||
object[] args = new object[1];
|
||||
|
||||
int numEntries = (int)thisType.InvokeMember("Length", BindingFlags.GetProperty, null, comObject, null);
|
||||
stringArray = new string[numEntries];
|
||||
for (int i = 0; i < numEntries; i++)
|
||||
{
|
||||
args[0] = i; // since VB arrays index from 1, mine doesn't
|
||||
stringArray[i] = (string)thisType.InvokeMember("GetValue", BindingFlags.InvokeMethod, null, comObject, args);
|
||||
}
|
||||
} // End if(thisType == dblType)
|
||||
else
|
||||
{
|
||||
throw new Exception("something went wrong loading object into c# array. Type is '" + thisType.ToString() + "'");
|
||||
}
|
||||
return stringArray;
|
||||
} // End LoadComObjectIntoDoubleArray()
|
||||
}
|
||||
}
|
||||
62
src/bnhtrade.ComTypeLib/Account/Account.cs
Normal file
62
src/bnhtrade.ComTypeLib/Account/Account.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using bnhtrade.ComTypeLib.Credential;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.ComTypeLib
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("17ecbcc2-331b-4a08-86cc-864290a252e9")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IAccount
|
||||
{
|
||||
int AccountJournalInsert(ConnectionCredential sqlConnCred, int journalTypeId, DateTime entryDate,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false);
|
||||
|
||||
bool AccountJournalDelete(ConnectionCredential sqlConnCred, int accountJournalId);
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Currency)]
|
||||
decimal CurrencyConvertToGbp(ConnectionCredential sqlConnCred, string currencyCode,
|
||||
[MarshalAs(UnmanagedType.Currency)] decimal amount, DateTime conversionDate);
|
||||
|
||||
int CurrencyExchangeRateInsert(ConnectionCredential sqlConnCred, int exchangeRateSource, string currencyCode,
|
||||
[MarshalAs(UnmanagedType.Currency)] decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("1624ad76-092c-4f0e-949e-71f084dcba52")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtrade.Account")]
|
||||
public class Account : IAccount
|
||||
{
|
||||
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,
|
||||
currencyCode, amount, debitAccountId, creditAccountId, lockEntry);
|
||||
}
|
||||
|
||||
public bool AccountJournalDelete(ConnectionCredential sqlConnCred, int accountJournalId)
|
||||
{
|
||||
return Core.Account.AccountQuery.AccountJournalDelete(sqlConnCred.ConnectionString, 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);
|
||||
}
|
||||
|
||||
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,
|
||||
currencyUnitsPerGbp, periodStart, periodEnd, checkOverride);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
33
src/bnhtrade.ComTypeLib/Credential/ConnectionCredential.cs
Normal file
33
src/bnhtrade.ComTypeLib/Credential/ConnectionCredential.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace bnhtrade.ComTypeLib.Credential
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("33376d64-a9aa-41e5-b2e7-59f332f020f2")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IConnectionCredential
|
||||
{
|
||||
string UserId { get; set; }
|
||||
string Password { get; set; }
|
||||
string ConnectionString { get; }
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[Guid("24310731-61ad-4f77-92cf-018f5aaacf32")]
|
||||
[ProgId("bnhtrade.ConnectionCredential")]
|
||||
public class ConnectionCredential : IConnectionCredential
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=" + UserId +
|
||||
";Password=" + Password + ";MultipleActiveResultSets=true";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
69
src/bnhtrade.ComTypeLib/Ebay/EbayListing.cs
Normal file
69
src/bnhtrade.ComTypeLib/Ebay/EbayListing.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using bnhtrade.ComTypeLib.Credential;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Core.EbayQuery;
|
||||
using System.IO;
|
||||
|
||||
namespace bnhtrade.ComTypeLib.Ebay
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
[Guid("399ef39c-a63b-4dd4-aa18-f8f0f97f9abe")]
|
||||
public interface IEbayListing
|
||||
{
|
||||
int EbayListingItemGet(string itemNumber, DateTime listingEnd, ConnectionCredential sqlConnCred);
|
||||
|
||||
object[] EbayListingItemInsert(string itemNumber, DateTime listingEnd, string listingTitle, string listingDescription, string ebayUser,
|
||||
bool isAuction, [MarshalAs(UnmanagedType.Currency)] decimal price, DateTime priceTime, [MarshalAs(UnmanagedType.Currency)] decimal shipping,
|
||||
string itemLocation, string category, string imageFilePath, ConnectionCredential sqlConnCred);
|
||||
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[Guid("7e075895-fb50-42b4-a676-bf69cbedab39")]
|
||||
[ProgId("bnhtrade.EbayListing")]
|
||||
public class EbayListing : IEbayListing
|
||||
{
|
||||
public int EbayListingItemGet(string itemNumber, DateTime listingEnd, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
EbayListingGetIdByItemNumber request = new EbayListingGetIdByItemNumber();
|
||||
return request.EbayListingItemGet(sqlConnCred.ConnectionString, itemNumber, listingEnd);
|
||||
}
|
||||
|
||||
public object[] EbayListingItemInsert(string itemNumber, DateTime listingEnd, string listingTitle, string listingDescription, string ebayUser,
|
||||
bool isAuction, [MarshalAs(UnmanagedType.Currency)] decimal price, DateTime priceTime, [MarshalAs(UnmanagedType.Currency)] decimal shipping,
|
||||
string itemLocation, string category, string imageFilePath, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
// load imagefile
|
||||
FileStream imageFile = null;
|
||||
string imageFileExtension = "";
|
||||
if (imageFilePath.Length > 0)
|
||||
{
|
||||
imageFileExtension = Path.GetExtension(imageFilePath);
|
||||
if (imageFileExtension == string.Empty)
|
||||
{
|
||||
throw new Exception("Error parsing file extension from file path.");
|
||||
}
|
||||
imageFileExtension = imageFileExtension.Substring(1);
|
||||
imageFile = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read);
|
||||
}
|
||||
|
||||
// create the return array object
|
||||
EbayListingGetIdByItemNumber request = new EbayListingGetIdByItemNumber();
|
||||
(int ListingItemId, bool IsNewListingItem, bool IsNewListing) result =
|
||||
request.EbayListingItemInsert(sqlConnCred.ConnectionString, itemNumber, listingEnd, listingTitle, listingDescription, ebayUser,
|
||||
isAuction, price, priceTime, shipping, itemLocation, category, imageFile, imageFileExtension);
|
||||
if (imageFile != null)
|
||||
{ imageFile.Dispose(); }
|
||||
|
||||
// create return array
|
||||
object[] returnArray = new object[3];
|
||||
returnArray[0] = result.ListingItemId;
|
||||
returnArray[1] = result.IsNewListingItem;
|
||||
returnArray[2] = result.IsNewListing;
|
||||
return returnArray;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
111
src/bnhtrade.ComTypeLib/Product/Product.cs
Normal file
111
src/bnhtrade.ComTypeLib/Product/Product.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using bnhtrade.ComTypeLib.Credential;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.ComTypeLib
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("030ce07f-3eec-4743-a378-354ece99dd1b")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IProduct
|
||||
{
|
||||
string ReturnStringValue(string stringValue);
|
||||
|
||||
double ReturnDateValueAsDouble(string stringValue);
|
||||
|
||||
int ProductGetProductIdByCatId(int catId, ConnectionCredential sqlConnCred);
|
||||
|
||||
string ProductCompetitivePriceGet(int productId, int conditionId, ConnectionCredential sqlConnCred);
|
||||
|
||||
int ProductCompetitivePriceSet(int productId, int conditionId, [MarshalAs(UnmanagedType.Currency)] decimal price, bool isBuyBoxPrice, DateTime priceDate, ConnectionCredential sqlConnCred);
|
||||
|
||||
void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("3455321c-7f19-4b38-9540-6f8aa7776e71")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtrade.Product")]
|
||||
public class Product : IProduct
|
||||
{
|
||||
[ComVisible(false)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
public string ReturnStringValue(string stringValue)
|
||||
{
|
||||
return "kj;lk1";
|
||||
}
|
||||
|
||||
[ComVisible(false)]
|
||||
public double ReturnDateValueAsDouble(string stringValue)
|
||||
{
|
||||
DateTime theTimeNow = DateTime.UtcNow;
|
||||
return theTimeNow.ToOADate();
|
||||
// back in vba use the CDate(return) function to convert the double
|
||||
// vba Date --> c# DateTime works without marshalling
|
||||
}
|
||||
|
||||
public int ProductGetProductIdByCatId(int catId, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new Core.Product.ProductQuery();
|
||||
int? result = request.ProductGetProductIdByCatId(sqlConnCred.ConnectionString, catId);
|
||||
if (result == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public string ProductCompetitivePriceGet(int productId, int conditionId, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new Core.Product.ProductQuery();
|
||||
(decimal? price, DateTime? priceDate) result = request.ProductCompetitivePriceGet(sqlConnCred.ConnectionString, productId, conditionId);
|
||||
if (result.price == null || result.priceDate == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
DateTime priceDate2 = result.priceDate.Value;
|
||||
return result.price.ToString() + ";" + priceDate2.ToOADate();
|
||||
}
|
||||
}
|
||||
public int ProductCompetitivePriceSet(int productId, int conditionId, [MarshalAs(UnmanagedType.Currency)] decimal price, bool isBuyBoxPrice, DateTime priceDate, ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new Core.Product.ProductQuery();
|
||||
return request.ProductCompetitivePriceSet(sqlConnCred.ConnectionString, productId, conditionId, price, isBuyBoxPrice, priceDate);
|
||||
}
|
||||
|
||||
public void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList)
|
||||
{
|
||||
// get com object in string array
|
||||
var inputTuple = new List<(string asin, decimal priceToEstimate)>();
|
||||
var getArray = new Utility.LoadComObjextIntoStringArray();
|
||||
string[] stringArray = getArray.LoadComObjectIntoStringArray(inputList);
|
||||
|
||||
foreach (var item in stringArray)
|
||||
{
|
||||
string[] split = item.Split(';');
|
||||
if (split.Length != 2)
|
||||
{
|
||||
throw new Exception("Split function failed on line: " + item);
|
||||
}
|
||||
var tempTuple = (split[0], decimal.Parse(split[1]));
|
||||
inputTuple.Add(tempTuple);
|
||||
}
|
||||
|
||||
Core.Product.ProductQuery.ProductUpdateAmazonEstimateFee(sqlConnCred.ConnectionString, inputTuple);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
36
src/bnhtrade.ComTypeLib/Properties/AssemblyInfo.cs
Normal file
36
src/bnhtrade.ComTypeLib/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("bnhtrade COM Type Library")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("bnhtrade")]
|
||||
[assembly: AssemblyProduct("bnhtradeCOMAsm")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[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("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")]
|
||||
67
src/bnhtrade.ComTypeLib/Purchase/PurchaseLine.cs
Normal file
67
src/bnhtrade.ComTypeLib/Purchase/PurchaseLine.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using bnhtrade.ComTypeLib.Credential;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace bnhtrade.ComTypeLib.Purchase
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("d0a5e2f0-04df-4acc-8ab6-2ac192d3e444")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IPurchaseLine
|
||||
{
|
||||
void PurchaseLineTransactionNetInsert(ConnectionCredential sqlConnCred, int purchaseLineId, int debitAccountId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet,
|
||||
DateTime entryDate);
|
||||
|
||||
void PurchaseLineTransactionNetUpdate(ConnectionCredential sqlConnCred, int accountJouranlId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet, int debitAccountId);
|
||||
|
||||
void PurchaseLineTransactionDelete(ConnectionCredential sqlConnCred, int purchaseLineId, int accountJournalId);
|
||||
|
||||
int PurchaseLineTransactionStockInsert(ConnectionCredential sqlConnCred, int accountJournalId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId,
|
||||
int accountTaxCodeId, int stockDebitStatusId);
|
||||
|
||||
void PurchaseLineTransactionStockDelete(ConnectionCredential sqlConnCred, int stockId);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("48939768-5deb-49bf-80eb-a64777c97cff")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtrade.ProductLine")]
|
||||
public class PurchaseLine : IPurchaseLine
|
||||
{
|
||||
public void PurchaseLineTransactionNetInsert(ConnectionCredential sqlConnCred, int purchaseLineId, int debitAccountId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet,
|
||||
DateTime entryDate)
|
||||
{
|
||||
Core.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetInsert(sqlConnCred.ConnectionString,
|
||||
purchaseLineId, currencyCode, amountNet, entryDate);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionNetUpdate(ConnectionCredential sqlConnCred, int accountJouranlId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amountNet, int debitAccountId)
|
||||
{
|
||||
Core.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetUpdate(sqlConnCred.ConnectionString,
|
||||
accountJouranlId, currencyCode, amountNet, debitAccountId);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionDelete(ConnectionCredential sqlConnCred, int purchaseLineId, int accountJournalId)
|
||||
{
|
||||
Core.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionDelete(sqlConnCred.ConnectionString, purchaseLineId, accountJournalId);
|
||||
}
|
||||
|
||||
public int PurchaseLineTransactionStockInsert(ConnectionCredential sqlConnCred, int accountJournalId,
|
||||
string currencyCode, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId,
|
||||
int accountTaxCodeId, int stockDebitStatusId)
|
||||
{
|
||||
return Core.Stock.StockCreate.WIP_StockInsertPurchase(sqlConnCred.ConnectionString, productId, conditionId, accountTaxCodeId, accountJournalId, quantity, stockDebitStatusId);
|
||||
}
|
||||
|
||||
public void PurchaseLineTransactionStockDelete(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
Core.Stock.StockCreate.WIP_StockDeletePurchase(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
125
src/bnhtrade.ComTypeLib/Stock/Stock.cs
Normal file
125
src/bnhtrade.ComTypeLib/Stock/Stock.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using bnhtrade.ComTypeLib.Credential;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.ComTypeLib
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("e0a8c0c3-8d99-402e-b5cb-51fe262ae2ff")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
||||
public interface IStock
|
||||
{
|
||||
int StockInsertPurchase(ConnectionCredential sqlConnCred, int productId, int conditionId, int accountTaxCodeId, int accountJournalId, int quantity, int statusDebitId);
|
||||
|
||||
int StockInsertOwnerIntroduced(ConnectionCredential sqlConnCred, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId, int accountTaxCodeId, DateTime entryDate, int debitStatusId);
|
||||
|
||||
void StockDeletePurchase(ConnectionCredential sqlConnCred, int stockId);
|
||||
|
||||
void StockDeleteOwnerIntroduced(ConnectionCredential sqlConnCred, int stockId);
|
||||
|
||||
int StockReallocate(ConnectionCredential sqlConnCred, int stockId, int quantity, int debitStatusId, int creditStatusId, DateTime entryDate);
|
||||
|
||||
void StockJournalDelete(ConnectionCredential sqlConnCred, int stockJournalId);
|
||||
|
||||
object ReconcileStockTransactions(ConnectionCredential sqlConnCred);
|
||||
|
||||
bool StockJournalConsistencyCheck(ConnectionCredential sqlConnCred, int stockId);
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
[Guid("184ee881-5361-43c3-8c46-d8e22863e099")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("bnhtrade.Stock")]
|
||||
// [ClassInterface(ClassInterfaceType.AutoDual)]
|
||||
public class Stock : IStock
|
||||
{
|
||||
public int StockInsertPurchase(ConnectionCredential sqlConnCred, int productId, int conditionId, int accountTaxCodeId, int accountJournalId, int quantity, int statusDebitId)
|
||||
{
|
||||
return Core.Stock.StockCreate.WIP_StockInsertPurchase(sqlConnCred.ConnectionString, productId, conditionId, accountTaxCodeId, accountJournalId, quantity, statusDebitId);
|
||||
}
|
||||
|
||||
public int StockInsertOwnerIntroduced(ConnectionCredential sqlConnCred, [MarshalAs(UnmanagedType.Currency)] decimal amount, int quantity, int productId, int conditionId, int accountTaxCodeId, DateTime entryDate, int debitStatusId)
|
||||
{
|
||||
return Core.Stock.StockCreate.WIP_StockInsertOwnerIntroduced(sqlConnCred.ConnectionString, amount, quantity, productId, conditionId, accountTaxCodeId, entryDate, debitStatusId);
|
||||
}
|
||||
|
||||
public void StockDeletePurchase(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
Core.Stock.StockCreate.WIP_StockDeletePurchase(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
|
||||
public void StockDeleteOwnerIntroduced(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
Core.Stock.StockCreate.WIP_StockDeleteOwnerIntroduced(sqlConnCred.ConnectionString, stockId);
|
||||
}
|
||||
|
||||
public int StockReallocate(ConnectionCredential sqlConnCred, int stockId, int quantity, int debitStatusId, int creditStatusId, DateTime entryDate)
|
||||
{
|
||||
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
|
||||
|
||||
return Core.Stock.StockJournal.StockReallocateByStockId(sqlConnCred.ConnectionString, 4, stockId, quantity, debitStatusId, creditStatusId, entryDate);
|
||||
}
|
||||
|
||||
public void StockJournalDelete(ConnectionCredential sqlConnCred, int stockJournalId)
|
||||
{
|
||||
Core.Stock.StockJournal.StockJournalDelete(sqlConnCred.ConnectionString, stockJournalId);
|
||||
}
|
||||
|
||||
public object ReconcileStockTransactions(ConnectionCredential sqlConnCred)
|
||||
{
|
||||
var request = new Core.Stock.StockReconciliation();
|
||||
var result = new Core.Stock.StockReconciliation.ReconcileStockTransactionsResult();
|
||||
|
||||
result = request.ReconcileStockTransactions(sqlConnCred.ConnectionString, false);
|
||||
|
||||
//ReconcileStockTransactionsResult returnObject = new ReconcileStockTransactionsResult();
|
||||
|
||||
// copy values between classes
|
||||
|
||||
//PropertyInfo[] infos = typeof(ReconcileStockTransactionsResult).GetProperties();
|
||||
//foreach (PropertyInfo info in infos)
|
||||
//{
|
||||
// info.SetValue(returnObject, info.GetValue(result, null), null);
|
||||
//}
|
||||
|
||||
//foreach (PropertyInfo property in typeof(ReconcileStockTransactionsResult).GetProperties())
|
||||
//{
|
||||
// if (property.CanWrite)
|
||||
// {
|
||||
// property.SetValue(returnObject, property.GetValue(result, null), null);
|
||||
// }
|
||||
//}
|
||||
|
||||
//returnObject.ItemsCompleted = result.ItemsCompleted;
|
||||
//returnObject.ItemsRemaining = result.ItemsRemaining;
|
||||
//returnObject.LastItemDateTime = result.LastItemDateTime;
|
||||
//returnObject.ProgressMessage = result.ProgressMessage;
|
||||
//returnObject.ReconciliationComplete = returnObject.ReconciliationComplete;
|
||||
//returnObject.StockTransactionId = result.StockTransactionId;
|
||||
//returnObject.StockTransactionTypeId = result.StockTransactionTypeId;
|
||||
|
||||
//create the return array
|
||||
object[] returnArray = new object[7];
|
||||
returnArray[0] = result.ReconciliationComplete;
|
||||
returnArray[1] = result.ProgressMessage;
|
||||
returnArray[2] = result.StockTransactionId;
|
||||
returnArray[3] = result.StockTransactionTypeId;
|
||||
returnArray[4] = result.LastItemDateTime;
|
||||
returnArray[5] = result.ItemsCompleted;
|
||||
returnArray[6] = result.ItemsRemaining;
|
||||
return returnArray;
|
||||
|
||||
//return returnObject;
|
||||
|
||||
}
|
||||
|
||||
public bool StockJournalConsistencyCheck(ConnectionCredential sqlConnCred, int stockId)
|
||||
{
|
||||
return Core.Stock.StockJournal.WIP_StockJournalConsistencyCheck(sqlConnCred.ConnectionString, stockId, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.ComTypeLib.Utility
|
||||
{
|
||||
class LoadComObjextIntoStringArray
|
||||
{
|
||||
public string[] LoadComObjectIntoStringArray(object comObject)
|
||||
{
|
||||
Type thisType = comObject.GetType();
|
||||
Type strType = Type.GetType("System.Object[]");
|
||||
//Type strType = Type.GetType("System.String[*]");
|
||||
string[] stringArray = new string[1];
|
||||
// temporary allocation to keep compiler happy.
|
||||
if (thisType == strType)
|
||||
{
|
||||
object[] args = new object[1];
|
||||
|
||||
int numEntries = (int)thisType.InvokeMember("Length", BindingFlags.GetProperty, null, comObject, null);
|
||||
stringArray = new string[numEntries];
|
||||
for (int i = 0; i < numEntries; i++)
|
||||
{
|
||||
args[0] = i; // since VB arrays index from 1, mine doesn't
|
||||
stringArray[i] = (string)thisType.InvokeMember("GetValue", BindingFlags.InvokeMethod, null, comObject, args);
|
||||
}
|
||||
} // End if(thisType == dblType)
|
||||
else
|
||||
{
|
||||
throw new Exception("something went wrong loading object into c# array. Type is '" + thisType.ToString() + "'");
|
||||
}
|
||||
return stringArray;
|
||||
} // End LoadComObjectIntoDoubleArray()
|
||||
}
|
||||
}
|
||||
74
src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj
Normal file
74
src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>bnhtrade.ComTypeLib</RootNamespace>
|
||||
<AssemblyName>bnhtradeCOM</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\artifiacts\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\artifiacts\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<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" />
|
||||
</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" />
|
||||
</ItemGroup>
|
||||
<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>
|
||||
<PostBuildEvent>copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmInstall.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmInstall.bat"
|
||||
copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmRefresh.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmRefresh.bat"
|
||||
copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmUninstall.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmUninstall.bat"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -19,9 +19,9 @@ using MarketplaceWebServiceProducts.Model;
|
||||
using MarketplaceWebServiceProducts;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Security.Cryptography;
|
||||
using bnhtradeDatabaseClient.AmazonMWS;
|
||||
using Core.AmazonMWS;
|
||||
|
||||
namespace bnhtradeDatabaseClient
|
||||
namespace Core
|
||||
{
|
||||
namespace Database
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace bnhtradeDatabaseClient
|
||||
|
||||
namespace EbayQuery
|
||||
{
|
||||
public class Ebay
|
||||
public class EbayListingGetIdByItemNumber
|
||||
{
|
||||
/// <summary>
|
||||
/// Function returns records ID if a matching listing is found, 0 if not
|
||||
@@ -589,7 +589,7 @@ namespace bnhtradeDatabaseClient
|
||||
}
|
||||
|
||||
// make the update
|
||||
bool result = bnhtradeDatabaseClient.Account.AccountQuery.AccountJournalPostUpdate(sqlConnectionString,
|
||||
bool result = Core.Account.AccountQuery.AccountJournalPostUpdate(sqlConnectionString,
|
||||
accountJouranlId, currencyCode, amountNet, debitAccountId, creditAccountId);
|
||||
|
||||
scope.Complete();
|
||||
@@ -1553,7 +1553,7 @@ namespace bnhtradeDatabaseClient
|
||||
// currency conversion
|
||||
if (currencyCode != "GBP")
|
||||
{
|
||||
amount = bnhtradeDatabaseClient.Account.AccountQuery.CurrencyConvertToGbp(sqlConnectionString, currencyCode, amount, entryDate);
|
||||
amount = Core.Account.AccountQuery.CurrencyConvertToGbp(sqlConnectionString, currencyCode, amount, entryDate);
|
||||
}
|
||||
|
||||
// ensure decimal is rounded
|
||||
@@ -2064,7 +2064,7 @@ namespace bnhtradeDatabaseClient
|
||||
}
|
||||
|
||||
// get/set an skuId
|
||||
int skuId = bnhtradeDatabaseClient.Sku.SkuQuery.WIP_SkuGetSet(sqlConnectionString, productId, conditionId, accountTaxCodeId, true);
|
||||
int skuId = Core.Sku.SkuQuery.WIP_SkuGetSet(sqlConnectionString, productId, conditionId, accountTaxCodeId, true);
|
||||
|
||||
// add the entry to the stock table (minus stockJournalId)
|
||||
int stockId = 0;
|
||||
@@ -2482,7 +2482,7 @@ namespace bnhtradeDatabaseClient
|
||||
}
|
||||
|
||||
// insert journal posts into database
|
||||
bnhtradeDatabaseClient.Stock.StockJournal.StockJournalPostInsert(conn, stockId, stockJournalId, journalPosts, isNewStock);
|
||||
Core.Stock.StockJournal.StockJournalPostInsert(conn, stockId, stockJournalId, journalPosts, isNewStock);
|
||||
|
||||
// consistency check
|
||||
bool consistencyResult = true;
|
||||
@@ -3968,14 +3968,14 @@ namespace bnhtradeDatabaseClient
|
||||
|
||||
|
||||
// insert invoice header details
|
||||
int invoiceId = bnhtradeDatabaseClient.Export.ExportQuery.WIP_ExportAccountInvoiceInsert(sqlConnectionString,
|
||||
int invoiceId = Core.Export.ExportQuery.WIP_ExportAccountInvoiceInsert(sqlConnectionString,
|
||||
2, marketPlace, invoiceDate, depositDate, settlementRef, currency, "");
|
||||
insertedInvoiceIds.Add(invoiceId);
|
||||
|
||||
// insert invoice lines
|
||||
foreach (KeyValuePair<int, decimal> entry in dicLineTypeTotal)
|
||||
{
|
||||
int lineId = bnhtradeDatabaseClient.Export.ExportQuery.WIP_ExportAccountInvoiceLineInsert(sqlConnectionString,
|
||||
int lineId = Core.Export.ExportQuery.WIP_ExportAccountInvoiceLineInsert(sqlConnectionString,
|
||||
invoiceId, entry.Key, entry.Value, 0);
|
||||
if (lineId < 1)
|
||||
{
|
||||
@@ -6022,7 +6022,7 @@ namespace bnhtradeDatabaseClient
|
||||
|
||||
// CASE: Reset MAX-Price base & multiplier values (new record or switching back to auto)
|
||||
// get competative price and apply multiplier
|
||||
var request = new bnhtradeDatabaseClient.Product.ProductQuery();
|
||||
var request = new Core.Product.ProductQuery();
|
||||
var compPrice = request.ProductCompetitivePriceGet(sqlConnectionString, skuProductId, 10);
|
||||
if (compPrice.price == null || compPrice.priceDate == null)
|
||||
{
|
||||
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace bnhtradeDatabaseClient.Properties {
|
||||
namespace Core.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
@@ -8,7 +8,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>bnhtradeDatabaseClient</RootNamespace>
|
||||
<AssemblyName>bnhtradeDatabaseClient</AssemblyName>
|
||||
<AssemblyName>bnhtrade.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
@@ -19,7 +19,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<OutputPath>..\..\artifiacts\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -28,7 +28,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>..\..\artifiacts\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -37,9 +37,8 @@
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ABrain.AmazonMWS, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ABrain.AmazonMWS.1.0.1.6\lib\ABrain.AmazonMWS.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="ABrain.AmazonMWS">
|
||||
<HintPath>..\..\packages\ABrain.AmazonMWS.1.0.1.6\lib\ABrain.AmazonMWS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -61,7 +60,6 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SQL Connection.cs" />
|
||||
<Compile Include="VBA Wrapper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -5,8 +5,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using bnhtradeDatabaseClient;
|
||||
using bnhtradeDatabaseClient.Stock;
|
||||
using Core;
|
||||
using Core.Stock;
|
||||
using System.Configuration;
|
||||
using System.Transactions;
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace bnhtradeScheduledTasks
|
||||
Console.Clear();
|
||||
//try
|
||||
//{
|
||||
bnhtradeDatabaseClient.Inventory.InventoryPricing.AmazonMinMaxTemp(sqlConnectionString);
|
||||
Core.Inventory.InventoryPricing.AmazonMinMaxTemp(sqlConnectionString);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
@@ -530,7 +530,7 @@ namespace TempStuff
|
||||
DateTime entrdate = DateTime.Parse("07/09/2016 08:13:54");
|
||||
|
||||
//return bnhtradeDatabaseClient.Purchase.PurchaseQuery.WIP_PurchaseLineNetTransactionInsert(sqlConnectionString, 10164, "GBP", 138, 9.98m, entrdate);
|
||||
bnhtradeDatabaseClient.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetUpdate(sqlConnectionString, 10164, "GBP", 138, 100000);
|
||||
Core.Purchase.PurchaseQuery.WIP_PurchaseLineTransactionNetUpdate(sqlConnectionString, 10164, "GBP", 138, 100000);
|
||||
}
|
||||
public static void test_ProductUpdateAmazonEstimateFee()
|
||||
{
|
||||
@@ -538,7 +538,7 @@ namespace TempStuff
|
||||
|
||||
list.Add(("B000MGVBG4", 1.99m));
|
||||
|
||||
bnhtradeDatabaseClient.Product.ProductQuery.ProductUpdateAmazonEstimateFee(sqlConnectionString, list);
|
||||
Core.Product.ProductQuery.ProductUpdateAmazonEstimateFee(sqlConnectionString, list);
|
||||
}
|
||||
public static void test_AmazonInventoryTableUpdate()
|
||||
{
|
||||
@@ -548,14 +548,14 @@ namespace TempStuff
|
||||
{
|
||||
DateTime entrdate = DateTime.Parse("28/11/2018 08:13:54");
|
||||
|
||||
return bnhtradeDatabaseClient.Stock.StockCreate.WIP_StockInsertOwnerIntroduced(sqlConnectionString, 0.01m, 7, 15374, 51, 16, entrdate, 51);
|
||||
return Core.Stock.StockCreate.WIP_StockInsertOwnerIntroduced(sqlConnectionString, 0.01m, 7, 15374, 51, 16, entrdate, 51);
|
||||
}
|
||||
public static int CurrencyExchangeInsert()
|
||||
{
|
||||
DateTime start = new DateTime(2019, 03, 01);
|
||||
DateTime finish = new DateTime(2019, 04, 01);
|
||||
|
||||
return bnhtradeDatabaseClient.Account.AccountQuery.CurrencyExchangeRateInsert(sqlConnectionString, 1, "USD", 222m, start, finish, true );
|
||||
return Core.Account.AccountQuery.CurrencyExchangeRateInsert(sqlConnectionString, 1, "USD", 222m, start, finish, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<OutputPath>..\..\artifiacts\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -41,7 +41,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>..\..\artifiacts\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -77,12 +77,6 @@
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bnhtrade Database Client\bnhtradeDatabaseClient.csproj">
|
||||
<Project>{339d7413-3da7-46ea-a55c-255a9a6b95eb}</Project>
|
||||
<Name>bnhtradeDatabaseClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.1">
|
||||
<Visible>False</Visible>
|
||||
@@ -95,5 +89,11 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</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" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user