.NET FRAMEWORK AND OE

Posted by Giancarlo Alberto Somma on 27-Apr-2018 15:54

Hi to all,

Could you pls suggest me which is better way for to use .NET with OE 11.7?
Follow the code that I need to run in OE. 
Many thanks.
A.

Sample code enhanced with error and exception handling:

// Step #1: Create Connection object
oneSage.SDK.RD.Access.Connection lConnection =
new oneSage.SDK.RD.Access.Connection("SageStart",
@"@user=;@password=;" +
"@path=!Srv!Standard:myServerName/" +
"C:/Sage Data/Folders/Meine Firma/SageStart/Meine Firma.SgWwr",
"SageStart");
oneSage.SDK.RD.Validating.InfoList lInfoList = new oneSage.SDK.RD.Validating.InfoList();

if (lConnection.DoValidate((oneSage.SDK.RD.Validating.Interface.IInfoList)lInfoList) == true) {
try {
// Step #2: Create Adapter object
oneSage.SDK.RD.Access.Adapter lAdapter = new oneSage.SDK.RD.Access.Adapter(lConnection);

// Step #3: Create data set, tables, rows for data operations
// Create new and empty Sage Start data set
oneSage.SDK.RD.Data.SageStart lDataSet = new oneSage.SDK.RD.Data.SageStart();
oneSage.SDK.RD.Data.SageStart.AccountDataTable lTbl = lDataSet.Account;
oneSage.SDK.RD.Data.SageStart.AccountRow lRow = lTbl.NewAccountRow();

lRow.AccCode = "9999";
lRow.DescDe = lRow.DescFr = lRow.DescEn = lRow.DescIt = "My new account";
lTbl.AddAccountRow(lRow);

// Step #4: Execute SDK operation (Insert) and write all rows the database
lAdapter.Execute(oneSage.SDK.RD.Access.Operation.Insert, lDataSet, lTblName, lInfoList);
} catch (SystemException lExp) {
// Catch any exception thrown by the .NET data set (e.g. Primary Key, AllowDBNull, ReadOnly)
// Show error by re-using SDK's InfoList
lInfoList.Add(new oneSage.SDK.RD.Validating.Info(oneSage.SDK.RD.Validating.InfoTypes.Error,
DateTime.Now,
lExp.Message,
"MyApplication",
"Manipulating data set"));
}

// Show error messages if any
System.Text.StringBuilder lMessageBuilder = new StringBuilder();
foreach (oneSage.SDK.RD.Validating.Info lInfo in lInfoList) {
if ((int)lInfo.InfoType < (int)oneSage.SDK.RD.Validating.InfoTypes.CriticalError) {
lMessageBuilder.Append(lInfo.InfoType + " (" + lInfo.DateTime + "): " + lInfo.Method + "/"
lInfo.Message + "\r\n");
}
}

if (!string.IsNullOrEmpty(lMessageBuilder.ToString()))
MessageBox.Show(lMessageBuilder.ToString(), "Info List", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}

All Replies

Posted by Mike Fechner on 29-Apr-2018 09:53

What exactly are you trying to do?

The code looks like you're using an API provided by Sage. You're trying to connect to the AppServer directly? Please search for "Open client" here:

community.progress.com/.../2911.openedge-11-7-product-documentation

Or ODBC to the Database? Check above link for the SQL Development.

Posted by marian.edu on 29-Apr-2018 10:06

Looks like he's trying to create data (one account record) in Sage and probably want to do it from the 4GL, so it's more about adding the SDK to assemblies and 'translate' the c# code to 4GL...



Marian Edu

Acorn IT 
+40 740 036 212

Posted by Mike Fechner on 29-Apr-2018 10:19

That's a possibility too. But as there are OpenEdge applications from Sage too, it might he helpful to hear from the OP what he's trying to do.

Posted by Giancarlo Alberto Somma on 29-Apr-2018 14:41

I have followed a suggestion in progress talk. I create assembly. Xml with sage dll.

I tried to translate code but I have big problem to do that.

if you want you can check discussion, with sample and documentation, o 98n progress talk. My ID is gasomma.

Many thanks.

Posted by Mike Fechner on 29-Apr-2018 14:52

Which OpenEdge release are you using?

You are aware to this translation guide: documentation.progress.com/.../dvngm.pdf

Is there a specific line where you get stuck?

Posted by Giancarlo Alberto Somma on 29-Apr-2018 14:58

I tried 11.7 and 10.2b because sage dll needs. Net framework 3.5.

Posted by Giancarlo Alberto Somma on 29-Apr-2018 15:04

if (lConnection.DoValidate((oneSage.SDK.RD.Validating.Interface.IInfoList)lInfoList) == true) {

try {

I cannot translate for example

Posted by Mike Fechner on 29-Apr-2018 15:12

It’s tough without access to the API documentation, but …

 

IF lConnection:DoValidate (CAST (lInfoList, oneSage.SDK.RD.Validating.Interface.IInfoList)) = TRUE THEN DO:

END.

 
 
Von: Giancarlo Alberto Somma <bounce-obonelinux@community.progress.com>
Gesendet: Sonntag, 29. April 2018 22:05
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] .NET FRAMEWORK AND OE
 
Update from Progress Community
 

if (lConnection.DoValidate((oneSage.SDK.RD.Validating.Interface.IInfoList)lInfoList) == true) {

try {

I cannot translate for example

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Das Bild wurde vom Absender entfernt.
 

Posted by Giancarlo Alberto Somma on 30-Apr-2018 07:05

Hi Mike, good the string is correct. Thanks.

But the next 2 lines:

  oneSage.SDK.RD.Data.SageStart.AccountDataTable lTbl = lDataSet.Account;

  oneSage.SDK.RD.Data.SageStart.AccountRow lRow = lTbl.NewAccountRow();

translated with:

 DEFINE VARIABLE lTbl AS oneSage.SDK.RD.Data.SageStart.AccountDataTable NO-UNDO.

 DEFINE VARIABLE lRow AS oneSage.SDK.RD.Data.SageStart.AccountRow NO-UNDO.  

Progress OE gives an error (in Italian)

Tipo di dati specificato non valido: oneSage.SDK.RD.Data.SageStart.AccountDataTable. Specificare un tipo di dati come 'character' o il nome di una classe. (5638)

**  Impossibile interpretare linea 69. (196)

Posted by Mike Fechner on 30-Apr-2018 07:10

This sounds like an issue with the actual class names. I’m afraid I won’t be able to help you there with out access to a documentation.
 
Von: Giancarlo Alberto Somma <bounce-obonelinux@community.progress.com>
Gesendet: Montag, 30. April 2018 14:06
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] .NET FRAMEWORK AND OE
 
/cfs-file/__key/communityserver-discussions-components-files/26/3755.image001.png
Update from Progress Community
/cfs-file/__key/communityserver-discussions-components-files/26/7658.image002.png
 

Hi Mike, good the string is correct. Thanks.

But the next 2 lines:

  oneSage.SDK.RD.Data.SageStart.AccountDataTable lTbl = lDataSet.Account;

  oneSage.SDK.RD.Data.SageStart.AccountRow lRow = lTbl.NewAccountRow();

translated with:

 DEFINE VARIABLE lTbl AS oneSage.SDK.RD.Data.SageStart.AccountDataTable NO-UNDO.

 DEFINE VARIABLE lRow AS oneSage.SDK.RD.Data.SageStart.AccountRow NO-UNDO.  

Progress OE gives an error (in Italian)

Tipo di dati specificato non valido: oneSage.SDK.RD.Data.SageStart.AccountDataTable. Specificare un tipo di dati come 'character' o il nome di una classe. (5638)

**  Impossibile interpretare linea 69. (196)

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Das Bild wurde vom Absender entfernt.
 

Posted by Giancarlo Alberto Somma on 30-Apr-2018 07:22

Thank you. I sent a documentation.

Posted by Mike Fechner on 01-May-2018 03:32

According to the documentation the class names seem coorrect. So you may be missing an Assembly reference. That's something I don't find in your documentation. So you might need to contact Sage and see which assemblies need to be added to the project.

Posted by Giancarlo Alberto Somma on 01-May-2018 09:10

There is another way "web service". Example in C# below:

Is it possible to translate in OE code?

Thx.

Console.WriteLine("Get Data...");

string lUrl = @"sdata.sageschweiz.ch:5493/.../Kontakte";

HttpWebResponse lResponse = null;

HttpWebRequest lRequest = null;

lRequest = (HttpWebRequest)WebRequest.Create(lUrl);

lRequest.Method = "Get";

// get response

try {

lResponse = lRequest.GetResponse() as HttpWebResponse;

using (StreamReader sr = new StreamReader(lResponse.GetResponseStream())) {

try {

string lXml = sr.ReadToEnd();

XmlDocument lXmlDoc = new XmlDocument();

lXmlDoc.LoadXml(lXml);

Console.Write(lXml);

} catch (Exception lEx) {

Console.Write(lEx.Message);

}

}

} catch (WebException lWebEx) {

// Get error

Console.WriteLine("Exception Message :" + lWebEx.Message);

if (lWebEx.Status == WebExceptionStatus.ProtocolError) {

var lResponse2 = ((HttpWebResponse)lWebEx.Response);

Console.WriteLine("Status Code : {0}", lResponse2.StatusCode);

Console.WriteLine("Status Description : {0}", lResponse2.StatusDescription);

using (var stream = lResponse2.GetResponseStream()) {

using (var reader = new StreamReader(stream)) {

var text = reader.ReadToEnd();

Console.WriteLine(text);

}

}

}

} finally {

// Close connection

lResponse.Close();

}

Posted by Mike Fechner on 01-May-2018 12:50

That's probably possible as well! Peter Judge can probably translate that for you into using the ABL http client.

However, I personally would prefer to use the .NET Assemblies as that provides you strong typed access to the API and most likely much more precise error handling. It's probably just a simple thing like an assembly reference that you are missing.

If you want, we can offer you professional support in that matter through a remote meeting. It should not take more than two hours to know if we get that to work or now.

Posted by Giancarlo Alberto Somma on 01-May-2018 14:20

Thanks for your suggestion.

For your professional offer send me a quotation and I discuss with my company.

A.

Posted by Giancarlo Alberto Somma on 03-May-2018 09:15

Hi Mike,

I still received any news from you? Could you pls help me?

Thx a lot

Posted by Giancarlo Alberto Somma on 08-May-2018 11:14

Hi Mike,


sorry for delay.
You can a quotation to me (I have a personal company).

Giancarlo Alberto Somma
via Lavizzari 3
6900 Lugano

I need to translate and understand OE .NET code.


Many thanks.

G.A.Somma


---- Messaggio originale ----
Da : bounce-mikefechner@community.progress.com
Data : 29/04/2018 - 22:14 (E)
A : TU.OE.General@community.progress.com
Oggetto : RE: [Technical Users - OE General] .NET FRAMEWORK AND OE

Update from Progress Community
Mike Fechner

It’s tough without access to the API documentation, but …

 

IF lConnection:DoValidate (CAST (lInfoList, oneSage.SDK.RD.Validating.Interface.IInfoList)) = TRUE THEN DO:

END.

 
 
Von: Giancarlo Alberto Somma <bounce-obonelinux@community.progress.com>
Gesendet: Sonntag, 29. April 2018 22:05
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] .NET FRAMEWORK AND OE
 
Update from Progress Community
 

if (lConnection.DoValidate((oneSage.SDK.RD.Validating.Interface.IInfoList)lInfoList) == true) {

try {

I cannot translate for example

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

 

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.



This thread is closed