Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, February 19, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: Return object with properties
Ray Walther
Posts: 8
 
Return object with propertiesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Oct 09 5:03 PM
I have a .Net Extension wrapper DLL that calls a native .Net DLL. What I would like to do is have the DLL return an object (or class) with multiple properties. When I return the object/class it returns empty but if I return a property it sends it back to the DLL without issue. Is there a way that I can return the object instead of returning each individual property?

This works:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using Sage.SalesLogix.NetExtensions;
using TimeLinx;



namespace TimeLinxLAN
{
public class Class1 : Sage.SalesLogix.NetExtensions.BaseRunnable
{
public override object Run(object[] args)
{
OleDbConnection _conn = new OleDbConnection(SlxApplication.ConnectionString);
_conn.Open();
TimeLinx_Settings tlxSettings = TimeLinx_Settings.GetTimeLinx_Settings(_conn);

return tlxSettings.StartDay.ToString();

}
}
}

This returns an empty resultset

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using Sage.SalesLogix.NetExtensions;
using TimeLinx;



namespace TimeLinxLAN
{
public class Class1 : Sage.SalesLogix.NetExtensions.BaseRunnable
{
public override object Run(object[] args)
{
OleDbConnection _conn = new OleDbConnection(SlxApplication.ConnectionString);
_conn.Open();
TimeLinx_Settings tlxSettings = TimeLinx_Settings.GetTimeLinx_Settings(_conn);

return tlxSettings;

}
}
}

Thanks in advance.....
Ray Walther
[Reply][Quote]
Ray Walther
Posts: 8
 
Re: Return object with propertiesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Oct 09 1:06 PM
Ok looks like I was finally able to get the system to do what I was looking for. Ended up being more coding than I was hoping for but this works. If anybody has a better way of doing it I would love the feedback as I have alot of work ahead of me implementing this in our product.

C# code that creates a wrapper around existing DLL:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sage.SalesLogix.NetExtensions;
using TimeLinx;



namespace TimeLinxLAN
{


[ComVisible(true)]
[Guid("F97D36EF-D10A-48bf-A58C-690201D315D4")]
public class Class1 : Sage.SalesLogix.NetExtensions.BaseRunnable
{
public String ManagerApprovalChngAllowed;
public String ProjManagerApprovalChngAllowed;
public String FinManagerApprovalChgAllowed;
public String StartDay;
public Double DefaultIncrement;
public Double DefaultMinimum;
public String DefaultTravel;
public String UniqueServiceSummaryRecords;

public override object Run(object[] args)
{
OleDbConnection _conn = new OleDbConnection(SlxApplication.ConnectionString);
_conn.Open();

//Call Original DLL
TimeLinx_Settings tlxSettings = TimeLinx_Settings.GetTimeLinx_Settings(_conn);

//Populate new Class Properties
this.ManagerApprovalChngAllowed = tlxSettings.ManagerApprovalChngAllowed;
this.ProjManagerApprovalChngAllowed = tlxSettings.ProjManagerApprovalChngAllowed;
this.FinManagerApprovalChgAllowed = tlxSettings.FinManagerApprovalChgAllowed;
this.StartDay = tlxSettings.StartDay;
this.DefaultIncrement = tlxSettings.DefaultIncrement;
this.DefaultMinimum = tlxSettings.DefaultMinimum;
this.DefaultTravel = tlxSettings.DefautlTravel;
this.UniqueServiceSummaryRecords = tlxSettings.UniqueServiceSummaryRecords;
//Return to SLX
return this;

}
}
}

This is the SLX code

Sub Button1Click(Sender)
Dim ext, x, Setting
' application.Debug.Fail
ext = Application.Managed.Create("TimeLinxLAN", "TimeLinxLAN.Class1")
Set x = Application.Managed.Run(ext, empty)
Msgbox x.StartDay
MsbBox x.MinimumIncrement
End Sub

And everything works as it should. Next effort will be seeing if I can save the object as a GlobalInfo variable and reuse it in other parts of the application.

Ray
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/19/2025 4:36:06 PM