Page 1 of 1

manipulate the bulk email list

PostPosted: Fri Jul 15, 2016 12:42 pm
by indikad
Jiwa 7 - 157

area = Sales | printing & emailing | Bath printing & emailing

I need to manipulate the bottom grid - where the list populates after the user hits the Go button.
I need to remove some lines programmatically.

is there any way I can access this grid and its methods pls ?

Hopefully it wold be something like this -- below ( another similar solution )
viewtopic.php?f=26&t=543&p=1867&hilit=append+to+candidates#p1867

Re: manipulate the bulk email list  Topic is solved

PostPosted: Sun Jul 31, 2016 1:42 pm
by Mike.Sheen
Hi Indika,

Sure, you can use the same technique:

Code: Select all
public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      var batchForm = (JiwaFinancials.Jiwa.JiwaSalesUI.BatchPrinting.MainForm)JiwaForm;      
      batchForm.GoUltraButton.Click += GoUltraButton_Click;
    }


and then in the click handler:

Code: Select all
private void GoUltraButton_Click(object sender, System.EventArgs e)
   {
      var button = (Infragistics.Win.Misc.UltraButton)sender;
      var batchForm = (JiwaFinancials.Jiwa.JiwaSalesUI.BatchPrinting.MainForm)button.FindForm();
      
      // batchForm.BatchPrint.Candidates is the list of candidate items - you can examine or remove from this list and the child actions also - each candidate represents an invoice - it has an Actions property which is a collection of Action - an action is and email or a report print.
   }


Alternatively you can hook into the Candidates.Adding or Actions.Adding event and decide to cancel the add instead of removing them after they've been added. Whichever works best for you.

Re: manipulate the bulk email list

PostPosted: Wed Aug 17, 2016 2:05 pm
by indikad
Hi Mike,

Thanks for this - however I n=belive I may need a little bit of a tip to get this working.

this is my code below and also the errors i get
Code: Select all
AddHandler oBatchForm.BatchPrint.Candidates.Adding , AddressOf candidatesAdding
         'AddHandler oBatchForm.BatchPrint.Candidates.   , AddressOf candidatesAdding
         msgbox ("found")
      End If      
    End Sub
   Private Sub candidatesAdding (ByVal item As  JiwaSales.BatchPrinting.Candidate  )
      msgbox ( Item.ToString() )
      msgbox("debtor no = " & item.DebtorAccountNo.ToString())
      
         If ( item.DebtorAccountNo.ToString().Trim() = "debtor1" ) Then
                                '---- This one works but removes all debtors. Not just THIS  debtor
            Throw New JiwaApplication.Exceptions.ClientCancelledException("removing selected debtor.")   
                                   '----   This one below gives me an error  - "Collection index must be in the range of 1 to ..... "      
            item.Actions.Remove( item.Actions.Item (0))
         End If
      '
   End Sub

Re: manipulate the bulk email list

PostPosted: Thu Aug 18, 2016 7:28 pm
by Mike.Sheen
Throwing a client cancelled exception tells the system to stop, but don't report an error - that's not what you want to do.

You get a "Collection index must be in the range of 1 to ....." exception when you
Code: Select all
item.Actions.Remove( item.Actions.Item (0))


because, you need to use a 1 based index.

So,
Code: Select all
item.Actions.Remove( item.Actions.Item (1))


will work.