Portal Engine
Version 2.x > Portal Engine > TimeOut in Custom event handlers View modes: 
User avatar
Member
Member
kogany - 11/27/2006 6:54:07 PM
   
TimeOut in Custom event handlers
Hi
I have problem with "Custom event handlers"
In CMS project i add my Project (write in Visual basic.Net)
in CustomDataHandler class in function
OnAfterInsert i add code for call my Vb Function - this is function :

Public Sub OnInsertDocumentItem(ByVal dataObj As Object, ByVal conn As Object)
If CType(dataObj, CMS.DataEngine.DataClass).ClassName = "Moblin.Phone" Then
Dim iD As Integer = CType(dataObj, CMS.DataEngine.DataClass).DataRow.ItemArray(0)

Dim cmsDC As New CMS.DataEngine.DataClass("Moblin.Phone")
Dim dr As DataRow = cmsDC.SelectData(iD)
WriteTrace("Name=" & dr.Item(1))
End If


End Sub

i receive iD of Document but after this in "SelectData(iD)" line i receive TimeOut from database error


please help me
Alex

User avatar
Guest
admin - 11/28/2006 8:57:33 AM
   
Re: TimeOut in Custom event handlers
Hi Alex,

the reason why the code time-outs is that you're executing a new query inside a new connection, while the INSERT transaction hasn't been commited yet which leads to a dead-lock. Actually, you do not need to call any extra query and the code can be simplified like this:

If CType(dataObj, CMS.DataEngine.DataClass).ClassName = "Moblin.Phone" Then
Dim cmsDC As CMS.DataEngine.DataClass = CType(dataObj, CMS.DataEngine.DataClass)
WriteTrace("Name=" & cmsDC.DataRow.Item(1))
End If

Best Regards,

User avatar
Member
Member
kogany - 11/28/2006 10:17:41 AM
   
Re: TimeOut in Custom event handlers
Hi
thank you for you answer
but i don't undestand if i want in my code get Parent Of Item
without get document how i can do it ?

thanks alex

User avatar
Guest
admin - 11/28/2006 8:44:51 PM
   
Re: TimeOut in Custom event handlers
Hello,

if you want to work with nodes, it's recommended that you use the TreeNode handler instead of Data handler.

The TreeNode handler provides you the treeNodeObj object of type CMS.TreeEngine.TreeNode. The code will look like this:

Dim originalNd = CType(treeNodeObj, CMS.TreeEngine.TreeNode)
Dim parentNd = originalNd.TreeProvider.SelectSingleNode(originalNd.NodeParentID)

Best Regards,

User avatar
Member
Member
kogany - 11/28/2006 11:14:11 PM
   
Re: TimeOut in Custom event handlers
and if i want working with DataHandeler
I need this becouse i want get data of saved item (OnInsert) add to this data parentID of
item in tree and send this to other database

thanks
alex

User avatar
Guest
admin - 12/7/2006 9:05:47 AM
   
Re: TimeOut in Custom event handlers
Unfortunately, this information is not available in the Data Handler. The Data Handler is only used for simple items, such as user, role, site, but not for documents.

Regards,