0

我需要一些有关 vb.net 系统的认真帮助。我正在开发一个桌面订购系统,我的流程类似于客户--->订单------->发票----->付款,注意*这一切都是通过员工、员工成员发生的代表客户下订单。

所以我想要的是在整个流程中,就像一旦你完成添加客户详细信息,它会转到 ORDER,所以我希望它为我正在忙的客户携带相同的 CustomerID。

有人可以帮我提供启动代码吗?

4

1 回答 1

0

Assuming Customer, Order, Invoice and Payment are classes:

 Ord = New Order(Cust.CustomerID)

Basically just pass the currently Cust ID to the Order constructor when you are creating it. If you need to create 'blank' orders, overload the constructor:

Class Order
    Public Sub New()
       ...
    End Sub

    Public Sub New (Cust As Long)
      ...
    End Sub

If that is not possible for some strange reason, make it possible to load a customer via a method:

 Ord = New Order()
 Ord.LoadCust(Cust.CustomerID)

------------- Edit for procedural version -----------------------

 PUBLIC ThisCustID As String  ' (?)  THIS is a global variable if declared
                              '  outside a SUB like in a module

.... customer does stuff

 ThisCustID = ID_OF_NEW_CUST       ' what was just saved in db

far away in Order module:

 Public Sub MakeNewOrder()
     ' has access to ThisCustID, but should not change it
 End Sub

or:

Public Sub MakeNewOrder(CustID)
     ' pass the current customer and avoid a global variable.

Rinse and repeat for ThisOrderID to pass to Invoice

于 2013-10-08T19:38:21.093 回答