How to save parent and child data on single click.
This is the normal default behavior for CSLA objects. You can't actually call Save() on a child, you can only call Save() on a parent, and that will save the children too.
Please refer to Chapters 17 and 18 for much more detail.
Expert VB2005 Business Object (Second Edition).
This is the book we have. But we can't found the Chapter 17 and 18 in this book.
And the maximum Chapter in this book 12 only.
Can you give some example regarding this issue.
For our senario to create an Invoice, we need to create Invoice Header and Detail in single transaction but base on the example (ProjectTracker) , it'll insert the header and detail separately but this structure is not match for our senario.
Thanks and wait for your reply.
The update command for detail row in grid worked now by using below command
Protected Sub QuotationDataSource_UpdateObject( _ ByVal sender As Object, ByVal e As Csla.Web.UpdateObjectArgs) _ Handles QuotationDataSource.UpdateObjectDim obj As Quotation = GetQuotation() Dim rid As Integer = CInt(e.Keys("QuotationID")) Dim res As QuotationDetNew = obj.Quotation.GetItem(rid)
Csla.Data.DataMapper.Map(e.Values, res)
'e.RowsAffected = SaveQuotation(obj) End Sub
But i facing a problem when i want to insert a detail row in grid (child) such as quotation line items. Can somebody tell me how to save the key in values in grid instead direct to database. My problem code is below
QuotationDataSource_InsertObject
Dim res As QuotationDetNew = obj.Resources.GetItemDet("")
Dim
res As QuotationDetNew = obj.Resources.GetItemDetCreate()Csla.Data.DataMapper.Map(e.Values, res)
QuotaionDets.vb
Public Function GetItemDet(ByVal QuotationID As String) As QuotationDetNew Return QuotationDetNew.AddQuotationDetNew() End Function
QuotationDet.vb
Public
Property UnitPrice() As Decimal GetCanReadProperty(
True) Return ms_UnitPrice End Get Set(ByVal Value As Decimal)CanWriteProperty(
True) If ms_UnitPrice <> Value Thenms_UnitPrice = Value
PropertyHasChanged()
End If End Set End Property Public Property CostingLineNo() As String GetCanReadProperty(
True) Return ms_CostingLineNo End Get Set(ByVal Value As String)CanWriteProperty(
True) If ms_CostingLineNo <> Value Thenms_CostingLineNo = Value
PropertyHasChanged()
End If End Set End PropertyFriend Shared Function AddQuotationDetNew() As QuotationDetNew
Return New QuotationDetNew("ABC") End FunctionPrivate Sub New(ByVal dr As String)
MarkAsChild()
End SubAm I miss out somethings? Hope to here your reply.
Thanks.
Copyright (c) Marimer LLC