Microsoft User Interface Process Application Block 研究(3)

这篇文章研究的是如何在一个用户登录后获得用户的任务。

在 Web 界面中,用户如果通过验证就会转到 welocme.aspx 页面中,在这个页面中首先创建一个 CartTask 对象:

Dim task As New CartTask(Page.User.Identity.Name)

这个对象的 New ( userlogon As String )方法中调用了静态方法 StoreControllerBase.GetUserTaskId 来获得任务的标示,这个任务标示是一个 Guid 类。在 GetUserTaskID 方法的如下代码中返回:

Dim cartBO As New CartTaskBusinessObject()

taskId = cartBO.GetTask(userName)

在 CartTaskBusinessObject.GetTask 方法中定义了三个类:

Dim McustomerDS As New CustomerDS

Dim McustomerDALC As New CustomerDALC

Dim McartTaskDALC As New CartTaskDALC

其中 CustomerDS 是保存用户信息的类,它是从 DataSet 类继承过来的。 CustomerDALC 是从 BaseDALC (这个类还没有研究??)继承过来的。这两个类是针对用户信息操作的。 CartTaskDALC 是从 BaseDALC 继承过来的,是针对当前用户的任务进行操作的。 CartTaskBusinessObject.GetTask 方法最终返回的是用户所对应的任务 Guid (这个 Guid 是保存在数据库 CartTasks 表中的)。

然后在 welcome.aspx 的 Page_Load 中判断当前用户是否有 Task Guid ,如果有的话就在 startButton 中显示“ Continue the existing buy process ”,否则就显示“ Start to a new buy process ”。

以后需要分析一下 CustomerDS 类以及 BaseDALC 类, CustomerDS 为什么从 DataSet 类继承, BaseDALC 类是做什么用的。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus