Need assistance with C# Code - easy one


(George Hicks) #1

Added a button in Quote Line form, ready for code now, but have not done much in C# so need examples on copying fields.
I took the C# For Customisations course at Insights, but it focused on displaying msgBoxes (Useless) instead of actual updating of things. It focused on customizations more than actual useful code, imho. Tim is a great instructor and helped me offline as well, but I am missing a lot of basic logical stuff.

Here is my custom event handler for the button click, but how does the work of copying the fields get done?


private void epiButtonCopyPart2Desc_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **

	******How to Copy QuoteDtl.PartNum to QuoteDtl.LineDesc ******????
           Would I copy the ttQuoteDtl.PartNum to ttQuoteDtl.LineDesc since it will be done in runtime?
          Would I use the GUID for each field?
        Do I use the set command?
      

}

Any examples appreciated.
George Hicks


(Chris Conn) #2

Click on the control that takes your PartNum. Look at the EpiBinding - this is the EpiDataView.Field

From there you can use:

var edv = oTrans.Factory("The Name of the EDV");
var pn = edv.dataView[edv.Row]["PartNum"].ToString();
edv.dataView[edv.Row]["Name of the LineDesc field"] = pn;

(George Hicks) #3

I am restoring our converted DB now, and will try that afterwards.
I did look at the EpiBinding and of course that is QuoteHed.PartNum etc.
Should that not be the same thing?
Thanks for the sample, I will let you know how it goes!