mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 14:37:16 +00:00
Add project files.
This commit is contained in:
38
bnhtrade Database Client.sln
Normal file
38
bnhtrade Database Client.sln
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27428.2037
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtradeDatabaseClient", "bnhtrade Database Client\bnhtradeDatabaseClient.csproj", "{339D7413-3DA7-46EA-A55C-255A9A6B95EB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtradeScheduledTasks", "bnhtrade Scheduled Tasks\bnhtradeScheduledTasks.csproj", "{5D6E1D66-3901-4340-95C6-EE65051AB623}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF330C30-8231-4D54-B60C-FF0644713502}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
bnhtradeRegasmInstall.bat = bnhtradeRegasmInstall.bat
|
||||
bnhtradeRegasmRefresh.bat = bnhtradeRegasmRefresh.bat
|
||||
bnhtradeRegasmUninstall.bat = bnhtradeRegasmUninstall.bat
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9CE53A62-9E0C-460F-9C09-B7DDB3B7F0EA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
24
bnhtrade Database Client/App.config
Normal file
24
bnhtrade Database Client/App.config
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="e2A_Client.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="e2A_Client.Properties.Settings.ConnectionString" connectionString="Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<e2A_Client.Properties.Settings>
|
||||
<setting name="DocArchivePath" serializeAs="String">
|
||||
<value>%USERPROFILE%\Desktop\e2A_Client\Archive\</value>
|
||||
</setting>
|
||||
<setting name="DocProcessingPath" serializeAs="String">
|
||||
<value>%USERPROFILE%\Desktop\e2A_Client\Processing\</value>
|
||||
</setting>
|
||||
</e2A_Client.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
9669
bnhtrade Database Client/Program.cs
Normal file
9669
bnhtrade Database Client/Program.cs
Normal file
File diff suppressed because it is too large
Load Diff
36
bnhtrade Database Client/Properties/AssemblyInfo.cs
Normal file
36
bnhtrade Database Client/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 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")]
|
||||
55
bnhtrade Database Client/Properties/Settings.Designer.cs
generated
Normal file
55
bnhtrade Database Client/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 bnhtradeDatabaseClient.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=e2A" +
|
||||
" Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=true")]
|
||||
public string ConnectionString {
|
||||
get {
|
||||
return ((string)(this["ConnectionString"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("%USERPROFILE%\\Desktop\\e2A_Client\\Archive\\")]
|
||||
public string DocArchivePath {
|
||||
get {
|
||||
return ((string)(this["DocArchivePath"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("%USERPROFILE%\\Desktop\\e2A_Client\\Processing\\")]
|
||||
public string DocProcessingPath {
|
||||
get {
|
||||
return ((string)(this["DocProcessingPath"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
bnhtrade Database Client/Properties/Settings.settings
Normal file
20
bnhtrade Database Client/Properties/Settings.settings
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="e2A_Client.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="ConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=true</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=True;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=true</Value>
|
||||
</Setting>
|
||||
<Setting Name="DocArchivePath" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">%USERPROFILE%\Desktop\e2A_Client\Archive\</Value>
|
||||
</Setting>
|
||||
<Setting Name="DocProcessingPath" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">%USERPROFILE%\Desktop\e2A_Client\Processing\</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
40
bnhtrade Database Client/SQL Connection.cs
Normal file
40
bnhtrade Database Client/SQL Connection.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data.SqlClient;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DatabaseConnection
|
||||
{
|
||||
//[ComVisible(true)]
|
||||
//[Guid("8bebe939-7a73-4ba3-877b-50cd2a7e4586")]
|
||||
//[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
|
||||
public interface bnhtradeDbInterface
|
||||
{
|
||||
SqlConnection Connection(string DataSource, string InitialCatalog, string UserId, string Password, bool PersistSecurityInfo = true, bool MultipleActiveResultSets = true);
|
||||
}
|
||||
|
||||
//[ComVisible(true)]
|
||||
//[Guid("b0e29c9e-d353-4d3a-83dd-5278b520af54")]
|
||||
//[ClassInterface(ClassInterfaceType.None)]
|
||||
////[ProgId("MyNameSpace.Criteria")]
|
||||
public class bnhtradeDb : bnhtradeDbInterface
|
||||
{
|
||||
public SqlConnection Connection(string DataSource, string InitialCatalog, string UserId, string Password, bool PersistSecurityInfo = true, bool MultipleActiveResultSets = true)
|
||||
{
|
||||
if (InitialCatalog == "" || DataSource == "" || UserId == "" || Password == "")
|
||||
{
|
||||
throw new Exception("Insuficent info supplied for sql connection string");
|
||||
}
|
||||
string connString =
|
||||
"Data Source=" + DataSource + ";Initial Catalog=" + InitialCatalog + ";Persist Security Info=" + PersistSecurityInfo.ToString() + ";" +
|
||||
"User ID=" + UserId + ";Password=" + Password + ";MultipleActiveResultSets=" + MultipleActiveResultSets.ToString() + "";
|
||||
|
||||
SqlConnection sqlConn = new SqlConnection(connString);
|
||||
|
||||
return sqlConn;
|
||||
}
|
||||
}
|
||||
}
|
||||
539
bnhtrade Database Client/VBA Wrapper.cs
Normal file
539
bnhtrade Database Client/VBA Wrapper.cs
Normal file
@@ -0,0 +1,539 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
82
bnhtrade Database Client/bnhtradeDatabaseClient.csproj
Normal file
82
bnhtrade Database Client/bnhtradeDatabaseClient.csproj
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{339D7413-3DA7-46EA-A55C-255A9A6B95EB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>bnhtradeDatabaseClient</RootNamespace>
|
||||
<AssemblyName>bnhtradeDatabaseClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<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">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SQL Connection.cs" />
|
||||
<Compile Include="VBA Wrapper.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>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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>
|
||||
-->
|
||||
</Project>
|
||||
4
bnhtrade Database Client/packages.config
Normal file
4
bnhtrade Database Client/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ABrain.AmazonMWS" version="1.0.1.6" targetFramework="net452" />
|
||||
</packages>
|
||||
12
bnhtrade Scheduled Tasks/App.config
Normal file
12
bnhtrade Scheduled Tasks/App.config
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="bnhtradeDbConnString"
|
||||
connectionString="Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=TRUE;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=TRUE" />
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
552
bnhtrade Scheduled Tasks/Program.cs
Normal file
552
bnhtrade Scheduled Tasks/Program.cs
Normal file
@@ -0,0 +1,552 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using bnhtradeDatabaseClient;
|
||||
using bnhtradeDatabaseClient.Stock;
|
||||
using System.Configuration;
|
||||
using System.Transactions;
|
||||
|
||||
namespace bnhtradeScheduledTasks
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static string sqlConnectionString = ConfigurationManager.ConnectionStrings["bnhtradeDbConnString"].ConnectionString;
|
||||
//public static string BNHtradeDbConnectionString()
|
||||
//{
|
||||
// return ConfigurationManager.ConnectionStrings["bnhtradeDbConnString"].ConnectionString;
|
||||
//}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//string sqlConnectionString = BNHtradeDbConnectionString();
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
// get db connection string
|
||||
//string sqlConnectionString = BNHtradeDbConnectionString();
|
||||
|
||||
string consoleHeader = "Welcome to THE application!\n";
|
||||
|
||||
do
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine(consoleHeader);
|
||||
Console.WriteLine("Main Menu");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<1> Amazon reports");
|
||||
Console.WriteLine("<2> Stock functions");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("<9> Dev functions");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("<0> Exit");
|
||||
Console.WriteLine("");
|
||||
Console.Write("Enter an option >");
|
||||
string input = Console.ReadLine();
|
||||
|
||||
|
||||
if (input == "0")
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (input == "1")
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine(consoleHeader);
|
||||
Console.WriteLine("Main Menu > Amazon Reports");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<1> Update all Amazon inventory and settlement data");
|
||||
Console.WriteLine("<2> Update FBA Inventory Data");
|
||||
Console.WriteLine("<3> Update FBA Inventory Age Data");
|
||||
Console.WriteLine("<4> Update Amazon Settlement Data");
|
||||
Console.WriteLine("<5> Update Fba Inventory Receipt Data");
|
||||
Console.WriteLine("<6> Update Fba Sale Shipment Data");
|
||||
Console.WriteLine("<7> Update Fba Return Data");
|
||||
Console.WriteLine("<8> Update Fba Adustment Data");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<0> Back");
|
||||
Console.WriteLine("");
|
||||
Console.Write("Enter an option >");
|
||||
input = Console.ReadLine();
|
||||
|
||||
if (input == "0")
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (input == "1")
|
||||
{
|
||||
Console.Clear();
|
||||
DownloadAll();
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaInventoryData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "3")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaInventoryAgeData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "4")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
var task2 = new StockReconciliation();
|
||||
task.UpdateAmazonSettlementData(sqlConnectionString);
|
||||
task2.WIP_ProcessAmazonSettlementData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "5")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaInventoryReceiptData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "6")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaSaleShipmentData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "7")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaReturnData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "8")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new AmazonReport();
|
||||
task.UpdateFbaAdustmentData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
else if (input == "2")
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine(consoleHeader);
|
||||
Console.WriteLine("Main Menu > Stock Funcions");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Stock Reconciliation");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<1> Update Fba Stock Import Data");
|
||||
Console.WriteLine("<2> Process Fba Stock Import Data");
|
||||
Console.WriteLine("<3> Reconcile stock transactions");
|
||||
Console.WriteLine("<4> Run all above");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<5> (temp) Update Amazon/Sku Min Max values");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<0> Back");
|
||||
Console.WriteLine("");
|
||||
Console.Write("Enter an option >");
|
||||
input = Console.ReadLine();
|
||||
|
||||
if (input == "0")
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (input == "1")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
try
|
||||
{
|
||||
task.UpdateFbaStockImportData(sqlConnectionString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
try
|
||||
{
|
||||
task.ProcessFbaStockImportData(sqlConnectionString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "3")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
var result = new StockReconciliation.ReconcileStockTransactionsResult();
|
||||
try
|
||||
{
|
||||
result = task.ReconcileStockTransactions(sqlConnectionString, false);
|
||||
Console.WriteLine(result.ItemsCompleted + " of " + (result.ItemsCompleted + result.ItemsRemaining) + " items completed.");
|
||||
Console.WriteLine("Current transaction ID=" + result.StockTransactionId);
|
||||
Console.WriteLine(result.ProgressMessage);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "4")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
try
|
||||
{
|
||||
task.UpdateFbaStockImportData(sqlConnectionString);
|
||||
task.ProcessFbaStockImportData(sqlConnectionString);
|
||||
task.ReconcileStockTransactions(sqlConnectionString, false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "5")
|
||||
{
|
||||
Console.Clear();
|
||||
//try
|
||||
//{
|
||||
bnhtradeDatabaseClient.Inventory.InventoryPricing.AmazonMinMaxTemp(sqlConnectionString);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
//Console.WriteLine(ex.Message.ToString());
|
||||
//}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} while (true);
|
||||
}
|
||||
else if (input == "9")
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine(consoleHeader);
|
||||
Console.WriteLine("Main Menu > Dev Funcions");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<1> Test Import of Amazon Settlement Data into Account Transaction Table");
|
||||
Console.WriteLine("<2> Test Stock Journal Reallocate");
|
||||
Console.WriteLine("<3> test Product Update Amazon Estimate Fee");
|
||||
Console.WriteLine("<4> Process Amazon Reimbursement Report (into transactiontable)");
|
||||
Console.WriteLine("<5> Test Stock Table Delete");
|
||||
Console.WriteLine("<6> Test Owner intro insert");
|
||||
Console.WriteLine("<7> Currency exchange rate insert");
|
||||
Console.WriteLine("<8> Update Amazon Inventory Table");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("<0> Back");
|
||||
Console.WriteLine("");
|
||||
Console.Write("Enter an option >");
|
||||
input = Console.ReadLine();
|
||||
|
||||
if (input == "0")
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (input == "1")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
task.WIP_ProcessAmazonSettlementData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
int result = new int();
|
||||
try
|
||||
{
|
||||
result = TempStuff.TempTasks.testStockReallocate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
Console.WriteLine(result);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "3")
|
||||
{
|
||||
Console.Clear();
|
||||
TempStuff.TempTasks.test_ProductUpdateAmazonEstimateFee();
|
||||
Console.WriteLine("Done");
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "4")
|
||||
{
|
||||
Console.Clear();
|
||||
var task = new StockReconciliation();
|
||||
task.WIP_ProcessFbaReimbursementData(sqlConnectionString);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "5")
|
||||
{
|
||||
Console.Clear();
|
||||
int result = new int();
|
||||
try
|
||||
{
|
||||
TempStuff.TempTasks.testStockJournalDelete();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
Console.WriteLine(result);
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "6")
|
||||
{
|
||||
Console.Clear();
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
result = TempStuff.TempTasks.input6();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
Console.WriteLine(result.ToString());
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "7")
|
||||
{
|
||||
Console.Clear();
|
||||
//bool result = false;
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
result = TempStuff.TempTasks.CurrencyExchangeInsert();
|
||||
Console.WriteLine("Result: " + result.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
else if (input == "8")
|
||||
{
|
||||
Console.Clear();
|
||||
try
|
||||
{
|
||||
TempStuff.TempTasks.test_AmazonInventoryTableUpdate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
//Console.WriteLine(result.ToString());
|
||||
Console.WriteLine("Complete, press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} while (true);
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.Length > 1)
|
||||
{
|
||||
Console.WriteLine("Currently only one command line argument is accepted. Exiting application...");
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[0] == "RunAll")
|
||||
{
|
||||
Console.WriteLine("Starting all reports download...");
|
||||
Thread.Sleep(3000);
|
||||
Console.Clear();
|
||||
DownloadAll();
|
||||
Console.WriteLine("Finished!! Exiting application...");
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
else if (args[0] == "StockReconcileUnsafe")
|
||||
{
|
||||
Console.WriteLine("Starting (unsafe) stock reconciliation...");
|
||||
Console.Clear();
|
||||
StockReconciliation task = new StockReconciliation();
|
||||
StockReconciliation.ReconcileStockTransactionsResult result = new StockReconciliation.ReconcileStockTransactionsResult();
|
||||
result = task.ReconcileStockTransactions(sqlConnectionString, false);
|
||||
Console.WriteLine("Progress: " + result.ProgressMessage);
|
||||
Console.WriteLine("Reconciled date: " + result.LastItemDateTime.ToString());
|
||||
Console.WriteLine("Transactions completed: " + result.ItemsCompleted);
|
||||
Console.WriteLine("Transactions remaining: " + result.ItemsRemaining);
|
||||
if (!result.ReconciliationComplete)
|
||||
{
|
||||
Console.WriteLine("Halted at Stock Transaction ID: " + result.StockTransactionId);
|
||||
}
|
||||
Console.WriteLine("Exiting application...");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Command line parameter not recognised. Exiting application...");
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
}
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
private static void DownloadAll()
|
||||
{
|
||||
MiscFunction.EventLogInsert("Nightly scheduled tasks started.");
|
||||
|
||||
var account = new AmazonReport();
|
||||
var stock = new StockReconciliation();
|
||||
|
||||
bool accountUpdate = false;
|
||||
bool stockUpdate = false;
|
||||
|
||||
bool accountProcess = false;
|
||||
bool stockProcess = false;
|
||||
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (accountUpdate == false) { accountUpdate = true; account.UpdateAmazonSettlementData(sqlConnectionString); }
|
||||
if (stockUpdate == false) { stockUpdate = true; stock.UpdateFbaStockImportData(sqlConnectionString); }
|
||||
|
||||
if (accountProcess == false) { accountProcess = true; stock.WIP_ProcessAmazonSettlementData(sqlConnectionString); }
|
||||
// if (stockProcess == false) { stockProcess = true; stock.ProcessFbaStockImportData(); }
|
||||
// ^^^^^^ best to process manually, case, fba inventory recepts, if a correction is made days later (ie -1) the already incorrect value
|
||||
// will have been entered in the stocktransaction table and maked as processed in the inventoryreceipt table
|
||||
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
"Exception caught running all report get method, see for further details",
|
||||
1,
|
||||
ex.ToString()
|
||||
);
|
||||
}
|
||||
}
|
||||
MiscFunction.EventLogInsert("Nightly scheduled tasks finished.");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace TempStuff
|
||||
{
|
||||
public class TempTasks
|
||||
{
|
||||
static string sqlConnectionString = ConfigurationManager.ConnectionStrings["bnhtradeDbConnString"].ConnectionString;
|
||||
|
||||
public static void testStockTableDelete()
|
||||
{
|
||||
//bnhtradeDatabaseClient.Stock.StockQuery.WIP_StockTableDelete(sqlConnectionString, 15776);
|
||||
}
|
||||
|
||||
public static bool testStockConsistCheck()
|
||||
{
|
||||
//return bnhtradeDatabaseClient.Stock.StockQuery.WIP_StockJournalConsistencyCheck(sqlConnectionString, 22677);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void testStockDelete()
|
||||
{
|
||||
//bnhtradeDatabaseClient.Stock.StockQuery.WIP_StockDelete(sqlConnectionString, 15798);
|
||||
}
|
||||
|
||||
public static void testStockJournalDelete()
|
||||
{
|
||||
//bnhtradeDatabaseClient.Stock.StockQuery.StockJournalDelete(sqlConnectionString, 33763);
|
||||
}
|
||||
|
||||
|
||||
public static int testStockReallocate()
|
||||
{
|
||||
int creditStatusId = 4;
|
||||
int debitStatusId = 21;
|
||||
DateTime entryDate = new DateTime(2099, 06, 15);
|
||||
|
||||
//return bnhtradeDatabaseClient.Stock.StockQuery.StockReallocateByStockId(sqlConnectionString, 4, 15776, 1, debitStatusId, creditStatusId, entryDate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
public static void testPurchaseLineInsert()
|
||||
{
|
||||
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);
|
||||
}
|
||||
public static void test_ProductUpdateAmazonEstimateFee()
|
||||
{
|
||||
var list = new List<(string asin, decimal price)>();
|
||||
|
||||
list.Add(("B000MGVBG4", 1.99m));
|
||||
|
||||
bnhtradeDatabaseClient.Product.ProductQuery.ProductUpdateAmazonEstimateFee(sqlConnectionString, list);
|
||||
}
|
||||
public static void test_AmazonInventoryTableUpdate()
|
||||
{
|
||||
//bnhtradeDatabaseClient.Inventory.InventoryPricing.AmazonInventoryTableUpdate(sqlConnectionString);
|
||||
}
|
||||
public static int input6()
|
||||
{
|
||||
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);
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
36
bnhtrade Scheduled Tasks/Properties/AssemblyInfo.cs
Normal file
36
bnhtrade Scheduled Tasks/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 Scheduled Tasks")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("bnhtrade Scheduled Tasks")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("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")]
|
||||
37
bnhtrade Scheduled Tasks/Properties/Settings.Designer.cs
generated
Normal file
37
bnhtrade Scheduled Tasks/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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_Scheduled_Tasks.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=TRUE;User ID=e2A" +
|
||||
" Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=TRUE")]
|
||||
public string bnhtradeDbConnString {
|
||||
get {
|
||||
return ((string)(this["bnhtradeDbConnString"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
bnhtrade Scheduled Tasks/Properties/Settings.settings
Normal file
13
bnhtrade Scheduled Tasks/Properties/Settings.settings
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bnhtrade_Scheduled_Tasks.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="bnhtradeDbConnString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=TRUE;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=TRUE</ConnectionString>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SQL-Server;Initial Catalog=e2A;Persist Security Info=TRUE;User ID=e2A Client;Password=eSYH4EYoK6Guc5KIclhgFDlGc4;MultipleActiveResultSets=TRUE</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
99
bnhtrade Scheduled Tasks/bnhtradeScheduledTasks.csproj
Normal file
99
bnhtrade Scheduled Tasks/bnhtradeScheduledTasks.csproj
Normal file
@@ -0,0 +1,99 @@
|
||||
<?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>{5D6E1D66-3901-4340-95C6-EE65051AB623}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>bnhtrade_Scheduled_Tasks</RootNamespace>
|
||||
<AssemblyName>bnhtradeScheduledTasks</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</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">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<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>
|
||||
<ProductName>Microsoft .NET Framework 4.7.1 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
23
bnhtradeRegasmInstall.bat
Normal file
23
bnhtradeRegasmInstall.bat
Normal file
@@ -0,0 +1,23 @@
|
||||
@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
|
||||
7
bnhtradeRegasmRefresh.bat
Normal file
7
bnhtradeRegasmRefresh.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
@set mypath=%~dp0
|
||||
|
||||
call "%mypath%bnhtradeRegasmUninstall.bat" nopause
|
||||
call "%mypath%bnhtradeRegasmInstall.bat" nopause
|
||||
@echo Completed regasm refresh
|
||||
@echo.
|
||||
@pause
|
||||
21
bnhtradeRegasmUninstall.bat
Normal file
21
bnhtradeRegasmUninstall.bat
Normal file
@@ -0,0 +1,21 @@
|
||||
@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
|
||||
Reference in New Issue
Block a user