本文介绍了如何在多层环境中实现“取消"按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是多层编程的新手,我正在寻找一些简单"问题的答案.希望您能帮帮我.

我在互联网上找到的所有有关多层编程的示例都使更改立即对数据库永久生效.对于Web应用程序而言这是可以理解的,但对于桌面应用程序而言则是可以理解的.例如在以下情况下:

用户在系统中编辑现有订单.订单屏幕打开,用户更改某些产品.这些产品的更改由业务部门处理,业务部门会自动添加新作业(用户可以根据需要进行更改).现在,用户单击订单的取消按钮.因此,不需要将订单,更改的产品和新的作业存储到数据库中.但是商业界已经把这些改变永久化了!

代码示例:

I''m new to multitier programming and I''m searching answers for some ''simple'' questions. I hope you can help me out.

All the examples about multitier programming I found on the internet make changes permanent to the database immediately. This is understandable for a web-application but not for a desktop-application. For example in the following situation:

A user edits an existing order in the system. An order screen opens and the user changes some products. Changes of these products are handled by the business layar, which automatically adds new jobs (which the user can change if needed). Now the user clicks on the cancel button of the order. So the order, the changed products and the new jobs don''t need to be stored to the database. But the business layar already made these changes permanent!

Code example:

Order = OrderAdapter.GetOrderByID(OrderID)
Order.Date = Date.Now
OrderAdapter.SaveOrder(Order)

Product = ProductAdapter.GetProductByID(ProductID)
Product.Name = "Software"
ProductAdapter.SaveProduct(Product) ''A new Job is automatically added by the business layar.

''How to handle a click on the Cancel-button on the order form?



您如何处理这种情况?在老式编程"中,仅当按下订单上的确定"按钮时,我才会将订单保存到数据库中.但是在多层环境中,业务部门已经在按订单的确定"按钮之前将产品和作业更改为数据库.

任何帮助将不胜感激!!!!



How do you handle such a situation? In ''old fashioned programming'', I would save the order to the database only when the OK-button on the order form was pressed. But in a multitier environnement the business layar changed the products and jobs already to the database, before the OK-button of the order was pressed.

Any help would be greatly appreciated!!!

推荐答案


这篇关于如何在多层环境中实现“取消"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 14:21