Page 1 of 8
New to X# and need some direction
Posted: Mon Jun 25, 2018 1:10 pm
by Anonymous
Hi Guys,
This is my second day with X# and learned a fair bit but still lost. I would need some help.
Basically I need to access an MS-SQL Database and extract data and upload it using the access provided through the .NET SDK.
This is the SDK:
http://developer.myob.com/api/accountri ... otnet_sdk/
that I need to use to upload the data
I am an old VO programmer that stuck with VO and just about to move to X# with this small project. I have already downloaded XIDE and also Vs but I think I will go with XIDE for the time being as long as I can utilise the above SDK.
I do not have Vulcan so do I need anything additional to install or XIDE installation is sufficient on its own for Native X#?
Any help and pointers will be greatly appriciated
Thanks again
Tom
New to X# and need some direction
Posted: Mon Jun 25, 2018 1:19 pm
by wriedmann
Hi Tom,
you don't need any special runtime or similar - you can work with X# right out of the box.
Maybe you should search some C# samples and move them over to X#.
Please don't forget: as VO programmers we were almost alone, but with X# we are a part of the really large .NET world.
Wolfgang
New to X# and need some direction
Posted: Mon Jun 25, 2018 1:49 pm
by lumberjack
Here is a quick and dirty translate from the above website. Remember it is C# which use ";" as end of statement, so we need to remove that. All "new" keywords basically mean creation of object, X# like VO uses {}, so we need to change () to {} except where it is a method call where () is used the same. C# also use "=" for assignments, X#/VO use ":="
Code: Select all
using MYOB.AccountRight.SDK
using MYOB.AccountRight.SDK.Services
using MYOB.AccountRight.SDK.Contracts
var configuration := ApiConfiguration{"http://localhost:8080/accountright"}
var cfService := CompanyFileService{configuration}
var companyFiles := cfService.GetRange()
//Next step in the flow is to select a company file that supports v2 contracts
// for the AccountRight API - anything from 2013.3 and up will do here.
var companyFile := companyFiles.FirstOrDefault({x => Version{x.ProductVersion} >= Version{"2013.3"}})
//The company file credentials are an AccountRight requirement with the SDK providing the
//CompanyFileCredentials class to encapsulate these. For our example the company file
//login details in use are username: Administrator with no password on the admin account.
var credentials := CompanyFileCredentials{"Administrator",""}
//Now you are ready to start accessing resources directly from the API
var accountService := AccountService{configuration}
var accounts := accountService.GetRange(companyFile,null,credentials)
I do not have Vulcan so do I need anything additional to install or XIDE installation is sufficient on its own for Native X#?
No you need nothing extra, XIDE as it is can even be an editor for c# and Harbour. You just need to tell it the Application is of that type.
Only thing you have to do is in your MYOB interface application Add a reference to the MYOB Assembly. You will have to do this also in VS.
Hope this helps.
New to X# and need some direction
Posted: Mon Jun 25, 2018 2:24 pm
by tom@dieselworks.com.au
Thanks VM Johan, Can you tell me when I install the XIDE, it also asks me if I like to install the Community Edition of the VS. Installing the VS which options do I need to select ? TIA Tom
New to X# and need some direction
Posted: Mon Jun 25, 2018 2:36 pm
by lumberjack
tom@dieselworks.com.au wrote:
Thanks VM Johan, Can you tell me when I install the XIDE, it also asks me if I like to install the Community Edition of the VS. Installing the VS which options do I need to select ?
If you already have VS, then you don't need to install it again. Just make sure you install XIDE. It wont' hurt to install the VS Community if you don't have VS installed yet.
Regards,
New to X# and need some direction
Posted: Mon Jun 25, 2018 2:38 pm
by tom@dieselworks.com.au
Ok, getting close
One more question: "Add a reference to the MYOB Assembly" - how do I do this?
New to X# and need some direction
Posted: Mon Jun 25, 2018 2:57 pm
by FFF
Hi Tom,
in Xide, in the Projectpane, there's an entry References unter each app in the tree. Rightclick, "Add reference", point in the dialog to the assembly you need.
Karl
New to X# and need some direction
Posted: Mon Jun 25, 2018 3:28 pm
by tom@dieselworks.com.au
Ah well, still a prob: I have installed the package in VS -> Install-package MYOB.AccountRight.API.SDK - and I can see it, it installed into the default app in VS - but I can't see it from XIDE
New to X# and need some direction
Posted: Mon Jun 25, 2018 3:37 pm
by wriedmann
Hi Tom,
Visual Studio uses NuGet to retrieve the packages, XIDE cannot do that.
In these cases I use an VS project to download the references, copy the assemblies away and add them to the XIDE project.
Wolfgang
New to X# and need some direction
Posted: Mon Jun 25, 2018 4:10 pm
by FFF
Wolfgang,
i have no clue about Nuget, but it seems there's a commandline version available, maybe one could use this for a Xide-extension? Just a thought
Karl