Create SubScriptionLine from data

Forum for .NET developers using the E-conomic API.
Exchange your ideas, tip and tricks using the API.
Best Practices

Create SubScriptionLine from data

Postby Claus Aaberg » Wed Jun 09, 2010 8:39 pm

Code: Select all
                Dim Subscriptlinedata As ISubscriptionLineData
                Dim Subscr As Economic.Api.ISubscription
                Dim SubscrNr As String
                Dim Product As Economic.Api.IProduct
                Dim ProductNr As String
                Dim ChkInt As Integer
                Dim RowCount As Integer = DtContact.Rows.Count
                Dim i As Integer
                i = 0

                For Each Dr In DtContact.Rows
                    SubscrNr = Dr.item(1)
                    Subscr = session.Subscription.FindByNumber(SubscrNr)
                    If Subscr Is Nothing Then
                    Else
                        Subscriptlinedata = session.SubscriptionLineData.Create(Subscr)
                        ProductNr = Dr.item(2)
                        Product = session.Product.FindByNumber(ProductNr)
                        Subscriptlinedata.Product = Product
                        Subscriptlinedata.ProductName = Dr.Item(3) ' navn på faktura
                        Subscriptlinedata.Quantity = CDec(Dr.Item(4))
                        If Dr.item(5) = "" Then
                        Else
                            Subscriptlinedata.SpecialPrice = CDec(Dr.Item(5))
                        End If
                        If Dr.item(6) = "" Then
                        Else
                            Subscriptlinedata.Department = Dr.Item(6)
                        End If
                        session.SubscriptionLine.CreateFromData(Subscriptlinedata)
                        Dr.Item("Transfered") = 1
                    End If
                    i = i + 1
                    ToolStripProgressBar1.Value = 100 * i / RowCount
                    StatusStrip1.Refresh()
                Next
                session.Disconnect()


When using the above code i get a Subscriptionlinedata object which seems to be fine (number =0, department = nothing, specialprice=nothing, product is found, quantity is 1D), yet when i createfromdata it returns an error {"An internal error has occurred. {id=939146622}"}

Any help as to where i am going wrong, would be greatly appreciated.
-
Claus Aaberg
 
Posts: 20
Joined: Wed Dec 09, 2009 10:31 am

Re: Create SubScriptionLine from data

Postby Claus Aaberg » Thu Jun 10, 2010 8:31 pm

I finally figured it out. Department is not a nullable, which means that to create subscritionline via the api, there must exist at least one department.
-
Claus Aaberg
 
Posts: 20
Joined: Wed Dec 09, 2009 10:31 am

Re: Create SubScriptionLine from data

Postby Christian Estrup » Thu Jun 10, 2010 11:02 pm

Hi Claus,

That's quite obviously a bug - and a rather nasty one at that. We'll get a fix for it out over this coming weekend, and let you know here when it's in place.

Those involved in implementing and approving this without the proper test case(s) will be flogged appropriately...


Best regards,
Christian Estrup
Chief Architect

Image
Online accounting
User avatar
Christian Estrup
 
Posts: 206
Joined: Tue Jun 09, 2009 6:37 pm

Re: Create SubScriptionLine from data

Postby Christian Estrup » Sun Jun 13, 2010 2:55 pm

Hi,

This bug has now been resolved.

My apologies for the inconvenience.


Best regards,
Christian Estrup
Chief Architect

Image
Online accounting
User avatar
Christian Estrup
 
Posts: 206
Joined: Tue Jun 09, 2009 6:37 pm


Return to .NET



cron