Page 1 of 1

Service Job getting debtor informaiton on Job start

PostPosted: Tue May 20, 2014 4:21 pm
by indikad
I need to get the debtor information on a new job start ( New Job | select debtor ).
However I cannot find a event with a parameter that gets the required information

part of code I am trying is below
Code: Select all

If TypeOf JiwaForm Is JiwaServiceManagerUI.Jobs Then         
            Dim JobForm As JiwaServiceManagerUI.Jobs = DirectCast(JiwaForm, JiwaApplication.IJiwaForm)   

         AddHandler JobForm.Job.CreateStart  , AddressOf JobCreateStart
         
         _attDebtor.Read(JobForm.Job.Debtor.DebtorID)
End If

Re: Service Job getting debtor informaiton on Job start

PostPosted: Tue May 20, 2014 4:38 pm
by Mike.Sheen
Hi Indika,

I believe you want to add a handler for the debtor entity read event of the job - see below

Code: Select all
Public Class FormPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaFormPlugin

   Private serviceJobForm As JiwaServiceManagerUI.Jobs
      
    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
    End Sub

    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      If TypeOf JiwaForm Is JiwaServiceManagerUI.Jobs Then
         serviceJobForm = DirectCast(JiwaForm, JiwaServiceManagerUI.Jobs)
         AddHandler serviceJobForm.Job.Debtor.Read, AddressOf Debtor_Read
      End If
    End Sub
      
   Public Sub Debtor_Read()
      If serviceJobForm.Job.IsReading = False Then
         Msgbox("debtor is : " & serviceJobForm.Job.Debtor.AccountNo, MsgBoxStyle.OkOnly, "Debtor")
      End If
   End Sub
End Class


Mike

Re: Using the Jiwa Assemblies from a .NET application

PostPosted: Tue May 20, 2014 5:09 pm
by indikad
Think I progressed a little bit. below is my new code. However now I want to access that old Cancel parameter that existed in 6.5.13 so I can stop a user from continuing for example - a save.

Code: Select all

Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      If TypeOf JiwaForm Is JiwaServiceManagerUI.Jobs Then         
            Dim JobForm As JiwaServiceManagerUI.Jobs = DirectCast(JiwaForm, JiwaApplication.IJiwaForm)   
   
         AddHandler JobForm.Job.CreateStart  , AddressOf JobCreateStart
         AddHandler JobForm.Job.CreateEnd  , AddressOf JobCreateEnd
         AddHandler JobForm.Job.SaveEnd ,  AddressOf saveEndJob '--- this works      
        End If
    End Sub
   Private Sub saveEndJob
         MessageBox.Show("blah")
   End Sub
   Private Sub JobCreateEnd( sender As Object ,  e As System.EventArgs )
      Dim jb As JiwaServiceManager.Job  = sender
      MessageBox.Show ("crete end name = " &  " " & jb.Debtor.Name  )
      MessageBox.Show ("crete end is on hold = " &  " " & jb.Debtor.OnHold   )
   End Sub
   Private Sub JobCreateStart    ( sender As Object ,  e As System.EventArgs )
      MessageBox.Show ("crete start "  )      
   End Sub

Re: Using the Jiwa Assemblies from a .NET application  Topic is solved

PostPosted: Wed May 21, 2014 3:48 pm
by Mike.Sheen
Hi Indika,

I think you replied to the wrong post :o I've moved your post to the current thread, which i think is the one you intended to post in.

Throw a new JiwaApplication.Exceptions.ClientCancelledException to cause the application to fail silently.

Mike

Re: Service Job getting debtor informaiton on Job start

PostPosted: Tue Jun 03, 2014 5:31 pm
by indikad
Thanks Mike.