我正在尝试从 XAF 中的订单创建发票。我按照devexpress 网站上的添加显示弹出窗口的操作
使用视图控制器和操作我有一个订单类和 order_Details 类作为带有发票类的订单集合和 Invoice_Data 类作为发票的集合
Private Sub Create_Invoice_Action_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles Create_Invoice_Action.CustomizePopupWindowParams
Dim objectSpace As IObjectSpace = Application.CreateObjectSpace()
e.View = Application.CreateListView(Application.FindListViewId(GetType(elmts.OrderDetail)), _
New CollectionSource(objectSpace, GetType(elmts.OrderDetail)), True)
End Sub
Private Sub ShowNotesAction_Execute(ByVal sender As Object, _
ByVal e As PopupWindowShowActionExecuteEventArgs) Handles Create_Invoice_Action.Execute
Dim _invoiceDetails As elmts.InvoiceData = CType(View.CurrentObject, elmts.InvoiceData)
View.ObjectSpace.SetModified(_invoiceDetails)
For Each _nv_Det As elmts.OrderDetail In e.PopupWindow.View.SelectedObjects
If (Not String.IsNullOrEmpty(_invoiceDetails.ProductName)) Then
_invoiceDetails.ProductName += Environment.NewLine
End If
_invoiceDetails.ProductName += _nv_Det.Division
Next _nv_Det
Dim item As ViewItem = (CType(View, DetailView)).FindItem("ProductName")
CType(item, PropertyEditor).ReadValue()
'Save changes to the database if the current Detail View is displayed in the View mode
If TypeOf View Is DetailView AndAlso (CType(View, DetailView)).ViewEditMode = _
ViewEditMode.View Then
View.ObjectSpace.CommitChanges()
End If
End Sub
Private Sub PopupNotesController_Activated(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Activated
Create_Invoice_Action.Active.SetItemValue("ObjectType", DirectCast(View, DetailView).ObjectTypeInfo.Type Is GetType(elmts.Order))
End Sub
我喜欢从带有 OrderDetailsCollection 视图的 Order detailView 中添加一个操作
- 创建新发票并将更改提交到数据库
- 获取 Oder.OrderDetail 集合当前视图项并将它们传递给新创建的 Invoice.InvoiceData 集合
- 将订单设置为已开票
感谢您提供的任何帮助。