Duwamish' Framewokes and data how to run !!!~~~

来源:互联网 发布:g是什么意思网络用语 编辑:程序博客网 时间:2024/05/04 15:53

Duwamish 7.0 结构分为四个逻辑层:

1。Web 层           为客户端提供对应用程序的访问。Web 窗体只是用 HTML 提供用户操作,而代码隐藏文件实现各种控件的事件处理。

2。业务外观层 Web 层提供处理帐户、类别浏览和购书的界面。BusinessFacade 项目实现的。业务外观层用作隔离层,它将用户界面与各种业务功能的实现隔离开来。除了低级系统和支持功能之外,对数据库服务器的所有调用都是通过此程序集进行的。

3。业务规则层 解决方案文件中的 BusinessRules 项目实现的。它包含各种业务规则和逻辑的实现。业务规则完成如客户帐户和书籍订单的验证这样的任务。

4。数据访问层 数据访问层为业务规则层提供数据服务。解决方案文件中的 DataAccess 项目实现的。

除了上述四个逻辑层外,Duwamish 7.0 还包含封装在 Duwamish.sln 解决方案文件中的 Common 项目内的共享函数。

Account Details”(帐户明细)页显示用户的帐户信息,还允许用户修改帐户信息。但是,在可以修改信息前,用户必须首先通过登录过程登录和创建帐户。任何已经创建帐户的用户都可以返回到“Logon”(登录)页,键入凭据,然后前进到“Account Details”页修改帐户信息。有关登录过程的更多信息.

创建新帐户:

 在 Web 层启动帐户管理过程当加载页时,通过 Web 层的 Duwamish7.Web.Account.SubmitButton_Click 方法和 Duwamish7.Web.AccountModule.ProcessChanges 方法更新用户的帐户信息。然后,Web 方法调用业务外观的 Duwamish7.BusinessFacade.CustomerSystem.UpdateCustomer 方法,该方法创建密码的经过 salt 和散列运算的新表示形式,然后使用业务规则层的 Duwamish7.BusinessRules.Customer.Update 方法。下一步,调用数据访问层的 Duwamish7.DataAccess.Customers.UpdateCustomer 方法,而此方法又调用数据库层中的 UpdateCustomer 存储过程。

用户创建新帐户则 Web 层的 Duwamish7.Web.Secure.Logon.SubmitButton_Click 方法向 Duwamish 7.0 应用程序的数据库提供用户帐户信息。Duwamish7.Web.Secure.Logon.SubmitButton_Click 方法调用 Duwamish7.Web.AccountModule.ProcessChanges 方法,而后者调用业务外观层的 Duwamish7.BusinessFacade.CustomerSystem.CreateCustomer 方法。

帐户管理是使用业务规则层的少数几个地方之一。

新帐户的数据创建和现有帐户的数据修改是相同的。因此,Duwamish 7.0 使用一个名为 AccountModule 的用户控件来处理这两个过程。

Duwamish7.Web.Account.SubmitButton_Click 方法:
[C#]
/// <summary>
///     Validates then saves off the customer account information.
///     <param name="sender">The source of the event.</param>
///     <param name="e">An EventArgs that contains the event data.</param>
/// </summary>
public void SubmitButton_Click(Object sender, EventArgs e)
{
    //
    // Process the changes to the form
    //
    ModuleAccount.ProcessChanges();
}

[C#]
/// <summary>///     Validates then saves off the customer account information.///     <remarks>If this is a new customer, then create the item, or edit for an existing customer.</remarks>///     <remarks>This is called from the page where this user control exists.</remarks>///     <retvalue>Returns true on success, false otherwise.</retvalue>/// </summary>public bool ProcessChanges(){    //    // Update the Database    //    if ( SaveCustomer() )    {        EditLabel.Visible = false;        CreateLabel.Visible = false;        UpdatedLabel.Visible = true;                return true;    }    else    {        //        // Show any errors         //        DisplayErrors();                UpdatedLabel.Visible = false;                return false;    }}Duwamish7.Web.Account.SubmitButton_Click 方法:
原创粉丝点击