c# - Refactoring an eConnect method that uses a single stored procedure -


i'm writing program modify invoices in gp10 using econnect. of invoices require distributions reset because totals not add correctly due various other (not important question) processes; accomplished through program. additionally, of invoices moved different batch (think buckets if you're not familiar gp), using program.

both of these tasks accomplished processing same type of file through econnect. method processes file:

public bool persistallchangesindynamics()     {         //instantiate proper econnect object updating invoice.         econnecttype econnect = new econnecttype();         soptransactiontype transtype = new soptransactiontype();         transtype.tasophdrivcinsert = this.converttosophdrivcinsertxml();         //adjust fields reset distributions.         transtype.tasophdrivcinsert.updateexisting = 1;         transtype.tasophdrivcinsert.createdist = 1;          soptransactiontype[] updateinvtypearray = { transtype };         econnect.soptransactiontype = updateinvtypearray;          //serialize , process document.         xmldocument econnectdoc = econnecthelper.serializeeconnectdoc(econnect);         return econnecthelper.processeconnectdoc(econnectdoc);     } 

my question revolves around bit of code:

    transtype.tasophdrivcinsert.updateexisting = 1; //updates batch changes     transtype.tasophdrivcinsert.createdist = 1; //re-creates distributions 

the tasophdrivcinsert object provided econnect persist changes invoices. far i'm aware, there isn't object re-creates distributions. whenever process document, econnect calls named stored procedure on dynamics db save changes correctly. updateexisting , createdist optional parameters sp.

sometimes, need update batch (or other parts of invoice), or re-create distributions, other times, i'll need both. re-creating distributions doesn't cause undesirable changes, want distributions correct every invoice. haven't tested time savings between doing 1 thing @ time; since object calling sp on server side, don't see take different amounts of time.

do of see reason re-factor 2-3 different methods keep each desired function separate?

if doing updating field or 2 , know not in way of gp, update field(s) through sql. have many methods call econnect , secondarily directly update object after econnect done because there aren't econnect parameters fields must change.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -