Hi,
We're creating sales orders in code but have ran into some problems with the salesorderfacade.
We can get everything to work if we instantiate the salesorderform form and use the facade defined in the form. Ideally we dont want to go through the form but instantiate and go through the facade directly. The problem seems to lie with the default values placed into the customersalesorderviewrow??? Detailed below are two examples. The first goes through the form, the second is a new instance of the facade and fails.
Example 1 (This one works)
-------------------------------
Interprise.Presentation.Customer.SalesOrder. SalesOrderForm obj_SOForm = new Interprise.Presentation.Customer.SalesOrder.SalesOrderForm();
Interprise.Facade.Customer. SalesOrderFacade obj_SOFacade = (Interprise.Facade.Customer.SalesOrderFacade)obj_SOForm.CurrentControl.CurrentFacade;
Interprise.Framework.Customer.DatasetGateway. SalesOrderDatasetGateway obj_SOGateway = (Interprise.Framework.Customer.DatasetGateway.SalesOrderDatasetGateway)obj_SOForm.CurrentControl.CurrentDataset;
obj_SOFacade.AddSalesOrder(Interprise.Framework.Base.Shared. Enum.TransactionType.SalesOrder, obj_CustomerData.TablesΎ].RowsΎ], "", "", ShowErrMessage, ref str_Message, "", "", "", "")
This works correctly. If you look at the code in the AddSalesOrder method you see the line:-
---------------------------
Dim salesOrder As SalesOrderDatasetGateway.CustomerSalesOrderViewRow = .CustomerSalesOrderView.NewCustomerSalesOrderViewRow
This new row contains default values and no nulls and represents the new sales order. If we then instantiate the salesorderfacade and gateway directly as shown below, the new row contains nulls and then fails.
----------------
Interprise.Framework.Customer.DatasetGateway. SalesOrderDatasetGateway obj_SOGateway2 = new Interprise.Framework.Customer.DatasetGateway.SalesOrderDatasetGateway();
Interprise.Facade.Customer. SalesOrderFacade obj_SOFacade2 = new Interprise.Facade.Customer.SalesOrderFacade(obj_SOGateway2);
obj_SOFacade2.AddSalesOrder(Interprise.Framework.Base.Shared. Enum.TransactionType.SalesOrder, obj_CustomerData.TablesΎ].RowsΎ], "", "", ShowErrMessage, ref str_Message, "", "", "", "")
-------------------
The exact same data is passed into the AddSalesOrder method except in the second example the facade is instantiated directly. What is causing the new customersalesorderviewrow to contain nulls and where do the default values come from ??????????
This has us pretty confused so any help would be appreciated.
Thanks, W. |