Extending Inventory CSV Import with VB  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Extending Inventory CSV Import with VB  Topic is solved

Postby pricerc » Mon Jun 19, 2017 10:06 pm

Further to https://forums.jiwa.com.au/viewtopic.php?f=26&t=565, and with thanks to Mike for some direction and the extra supplier stuff, I have combined the P1-P10 price extensions and the Supplier/Supplier Warehouse SpareX fields into the attached VB-based plugin.

...not because I have anything against C#; I just need my code to be understandable by people who may need to be talked through 'tweaking' said code.

... complete with anonymous delegates that as a rule, I don't like ... but that's a discussion for a different forum
Attachments
Plugin Inventory Import Extension.xml
(43.46 KiB) Downloaded 95 times
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Extending Inventory CSV Import with VB

Postby Mike.Sheen » Mon Jun 19, 2017 10:34 pm

Hi Ryan,

pricerc wrote:Further to https://forums.jiwa.com.au/viewtopic.php?f=26&t=565, and with thanks to Mike for some direction and the extra supplier stuff, I have combined the P1-P10 price extensions and the Supplier/Supplier Warehouse SpareX fields into the attached VB-based plugin.

...not because I have anything against C#; I just need my code to be understandable by people who may need to be talked through 'tweaking' said code.

... complete with anonymous delegates that as a rule, I don't like ... but that's a discussion for a different forum


Cool - thanks for sharing!

PS: once you create a function to act as a delegate - it's not really anonymous - it's just a delegate function. I notice also you made your delegates shared - which is fine - but you don't have to, even a private function would work.
Also, the "If Diagnostics.Debugger.IsAttached Then Diagnostics.Debugger.Break()" lines are probably an oversight left in for debugging - but I'm not judging ;) - Happy to see others contributing - more to come, I hope!
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Extending Inventory CSV Import with VB

Postby pricerc » Tue Jun 20, 2017 7:16 am

Mike.Sheen wrote:Hi Ryan,
PS: once you create a function to act as a delegate - it's not really anonymous - it's just a delegate function. I notice also you made your delegates shared - which is fine - but you don't have to, even a private function would work.!


Mike, there's still an anonymous delegate in there (well, 10 of them, for setting the Px prices) - although I moved the logic for creating them to a named method (GetSetPriceDelegate), that method nonetheless returns an anonymous delegate :)

The 'Shared' methods come from CodeRush, which I use for refactoring. The code in those methods was embedded where they're called from before I got CodeRush to extract the methods. Since that bit of code that I extracted had no references to instance properties, CodeRush has created them as Shared, which improves performance slightly in some scenarios (although probably not noticeably in this one, since this class won't be getting instantiated in volume).


Mike.Sheen wrote:Also, the "If Diagnostics.Debugger.IsAttached Then Diagnostics.Debugger.Break()" lines are probably an oversight left in for debugging - but I'm not judging ;)

Actually, I know it's probably bad, but I mostly leave those in. Since I'm the only one who ever has a debugger attached, nobody ever notices, so I haven't stressed about it.

Of course I also hope that anyone using the code looks at it a bit first, and makes changes suitable for the environment it's going into. For example, the captions and auto-mapping strings for the spare fields should be customised for how they are used in the target environment.

Mike.Sheen wrote:Happy to see others contributing - more to come, I hope!

Happy to share, I hope it encourages others to do the same!

I'd like to share more, although most of the mods I'm making are highly customer-specific. Even with this one, I've only supplied the BusinessLogic part of the whole plugin we've deployed, since the rest of if wasn't relevant to this discussion.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 18 guests