1. David Peace (Powersoft)
  2. PowerBuilder
  3. Wednesday, 17 June 2020 09:55 AM UTC

Hi Guys

I'm creating a simple wrapper for a .Net DLL in order to remove the complex return values. Using SnapDevelop I have created a simple C# Class Object that references the extrernal DLL. My C# Code is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Integral.Library.GuardianClient;


namespace PBSagePay
{
    public class PBSagePay
    {
        public Boolean ProcTrans(String TransactionType, Decimal Amount, ref String ResultText, ref Int32 ResponseCode)
        {
            TillInformation TillInfo = new TillInformation();
            TransactionInfo TransInfo = new TransactionInfo();
            TransactionHook TransHook = new TransactionHook();
            TransactionHook.TRANSACTIONHOOK_TRANSACTIONTYPE TransType = new TransactionHook.TRANSACTIONHOOK_TRANSACTIONTYPE();

            //Setup Till Info
            TillInfo.MerchantName = "Test Hotel";
            TillInfo.Address1 = "Test Addr1";

            // Setup the transaction type - Default Sale
            
            TransType = TransactionHook.TRANSACTIONHOOK_TRANSACTIONTYPE.INT_TT_SALE;
            if (TransactionType.ToUpper() == "REFUND")
            {
                TransType = TransactionHook.TRANSACTIONHOOK_TRANSACTIONTYPE.INT_TT_REFUND;
            }
            if (TransactionType.ToUpper() == "PREAUTH")
            {
                TransType = TransactionHook.TRANSACTIONHOOK_TRANSACTIONTYPE.INT_TT_PREAUTH;
            }

            // Prepare The Amount
            Int32 PenceAmount = (Int32) Decimal.Floor(Amount * 100);
            
            if (TransHook.Process(TransType, 25000, ref TillInfo, ref TransInfo))
            {
                ResponseCode = (Int32)TransInfo.ResponseCode;
                ResultText = "All OK";                
                return true;
            }
            ResultText = "Failed";
            ResponseCode = (Int32)TransInfo.ResponseCode;
            return false;

        }
    }
}

I placed my resulting DLL along with the DLLs from the 3rd party application.

When I try and Load in the DLL created I get the following Could not load file or assembly.... The system cannot find the file specified. Nothing appears in the Select & Preview list.

I do not seem to have my ducks in order, any suggestions?

Cheers

David

Accepted Answer
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Wednesday, 17 June 2020 11:21 AM UTC
  2. PowerBuilder
  3. # Permalink

Ah I've got it, the built DLL was Dot Net Core, I was not expecting that by default. I could not find an options in the Project Properties to change the build type?

Anyway my problem is solved for now :)

Cheers

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 17 June 2020 14:37 PM UTC
Thanks for sharing the solution!
  1. Helpful
  1. David Peace (Powersoft)
  2. Wednesday, 17 June 2020 15:14 PM UTC
You're Welcome.



I'm still learning how this tool "really" works and what it can do for us. When you can support more complex datatypes it will be brilliant. Accessing them in PB Script is a dream :)



Thanks

David
  1. Helpful 2
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 19 June 2020 10:59 AM UTC
  2. PowerBuilder
  3. # 1

Ah I've got it, the built DLL was Dot Net Core, I was not expecting that by default. I could not find an options in the Project Properties to change the build type?

Anyway my problem is solved for now :)

Cheers

Hi David.

You mention that the issue was that the dll was built using .net core. I wonder why this was an Issue? I believe .net core assemblies are also supported by .NET Dll Importer tool. Maybe you were missing the appropriate runtime?

Andreas.

Comment
  1. David Peace (Powersoft)
  2. Monday, 22 June 2020 10:53 AM UTC
Thanks Armeen, useful information.
  1. Helpful
  1. David C
  2. Tuesday, 24 May 2022 09:18 AM UTC
Hello David,

I'm doing the same integration that you have mentioned above. (Sage PAY)

I import the Integral.Library.GuardianClient dll reference directly into my VS project and i got the same error tat you have mentioned

"System.IO.FileNotFoundException: 'Could not load file or assembly 'Integral.Library.Common .."



(I use some of the code that you have wrote above just to do a quick test if the dll is working correctly)

Can I add the dll reference directly to the VS project ? or am I missing something ?



Thank you
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 24 May 2022 16:43 PM UTC
Hi David, I suggest you post your problem separately because this post is resolved and also you are using VS not SnapDevelop so it is not exactly same situation as David Peace.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.