Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Business Process
Message
 
To
12/04/2007 09:49:58
Rick Forbes
Brotherhood of Maintenance of Way Employ
Royal Oak, Michigan, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01214938
Message ID:
01215372
Views:
23
Rick,

>In the Mere Mortals 2.3 developers guide there is and example of a business process that uses typed datasets. Is this the prefered method of data access in business processes or will entity objects work as well. If so could you please provide an example of one. I am having a little trouble getting it to work.

Thanks for the heads up...entity objects are definitely preferred. Typed DataSets are old technology. I have updated the Dev Guide for 2.4 (you can download it from our home page), but here is the main code:

NOTE: If you are using MM .NET 2.4, you should replace the mmBindingList<> reference below to List<>

For example, in C#:
public mmSaveDataResult ProcessOrder(int orderID)
{
	OrdersEntity OrderEntity = this.oOrder.GetOrderByOrderID(orderID);
	mmBindingList<OrderDetailEntity> OrderDetailList = this.oOrderDetail.GetOrderDetail(orderID);

	foreach (OrderDetailEntity OrderDetail in OrderDetailList)
	{
		this.oProduct.ReduceInventory(OrderDetail.ProductID, OrderDetail.Quantity);
	}

	// Return a result that indicates if there were any broken rules or warnings
	if (this.BusinessRuleObj.HasBrokenRules)
	{
		return mmSaveDataResult.RulesBroken;
	}
	if (this.BusinessRuleObj.HasWarnings)
	{
		return mmSaveDataResult.RuleWarnings;
	}
	return mmSaveDataResult.RulesPassed;
}
And in VB .NET:
Public Function ProcessOrder(ByVal orderID As Integer) As mmSaveDataResult

    Dim Order As OrdersEntity = Me.oOrder.GetOrderByOrderID(orderID)
    Dim OrderDetailList As mmBindingList(Of OrderDetailEntity) = Me.oOrderDetail.GetOrderDetail(orderID)

    For Each OrderDetail As OrderDetailEntity In OrderDetailList
        Me.oProduct.ReduceInventory(OrderDetail.ProductID, OrderDetail.Quantity)
    Next

    ' Return a result that indicates if there were any broken rules or warnings
    If Me.BusinessRuleObj.HasBrokenRules Then
        Return mmSaveDataResult.RulesBroken
    End If
    If Me.BusinessRuleObj.HasWarnings Then
        Return mmSaveDataResult.RuleWarnings
    End If

    Return mmSaveDataResult.RulesPassed

End Function
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform