For example I want to be able to change the sales price.
Here's what I coded:
Code: Select all
Dim server As New SoftPro.Select.Client.SelectServer("http://Localhost/SelectServer", credential)
' Create the order tracking client
Dim ot As SoftPro.OrderTracking.Client.OrderTracking = server.GetService(Of SoftPro.OrderTracking.Client.OrderTracking)()
' Create the specification for the existing order.
Dim spec As New OrderQuerySpec()
spec.BaseOrderNumber = TitleNumber
' Open the order
Dim order As IOrder = ot.GetOrder(spec, True)
Response.Write(order.SalesContract.SalesPrice)
'until here it works
Dim os As SoftPro.OrderTracking.Client.ISalesContract = server.GetService(Of SoftPro.OrderTracking.Client.ISalesContract)()
Dim salesContract As ISalesContract = ot.GetOrder(spec, True)
salesContract.SalesPrice = 10000
Unable to cast object of type 'SoftPro.OrderTracking.Client.OrderProxy' to type 'SoftPro.OrderTracking.Client.ISalesContract'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'SoftPro.OrderTracking.Client.OrderProxy' to type 'SoftPro.OrderTracking.Client.ISalesContract'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'SoftPro.OrderTracking.Client.OrderProxy' to type 'SoftPro.OrderTracking.Client.ISalesContract'.]
TransactionsList.OrderInformation.dtlVwOrderInfo_ItemUpdating(Object sender, DetailsViewUpdateEventArgs e) in K:\Inet\MTANewWebDev\Generic\TransactionsList\OrderInformation.aspx.vb:304
System.Web.UI.WebControls.DetailsView.OnItemUpdating(DetailsViewUpdateEventArgs e) +133
System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +716
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +440
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Thanks