mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-25 09:07:15 +00:00
Update/restructure of COM type library
This commit is contained in:
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>
|
||||
Reference in New Issue
Block a user