Can I get a value from the updated tableset in this code? If so, how?

  var LaborDataSet = new Erp.Tablesets.LaborTableset();
  Erp.Contracts.LaborSvcContract hLbr = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.LaborSvcContract>(Db);
  string strMsg = String.Empty;
  string strJobNum = String.Empty;
  int lbrHedSeq = 0;

LaborDataSet = hLbr.GetByID(lbrHedSeq);
hLbr.StartActivity(lbrHedSeq, &quot;P&quot;, ref LaborDataSet);

hLbr.DefaultOprSeq(ref LaborDataSet, xOpr, out strMsg);
    hLbr.LaborRateCalc(ref LaborDataSet);
    hLbr.CheckWarnings(ref LaborDataSet, out strMsg);
    hLbr.SetClockInAndDisplayTimeMES(ref LaborDataSet);
    hLbr.Update(ref LaborDataSet);// <------ HOW CAN I REFERENCE THE UPDATED VALUES?

I am looking for the labordtlsequence that gets generated.

What do you mean the Updated Values? What are you looking for? Before the Update call or After?

After. After the update I believe the labor dtl sequence should be generated. I need it to end the labor transaction.

You can use LINQ to get the Modified Record before the call, then that record should appear updated by Reference after the Update call

Before the Update

var ld = LaborDataSet.LaborDtl.Where(r=>r.Added() || r.Updated()).FirstOrDefault();
hLbr.Update(ref LaborDataSet);
Console.WriteLine(ld.LaborDtlSeq);

You are the man!

Are you implying that the hLbr.Update(ref LaborDataSet); line already has a labordtlseq when we use it in the Update method?

no, but the LaborDtl record exists in the dataset and it is updated by the BO after processing.

It worked by the way. I am using the labordtlseq you helped me get to end the labordtl transaction in another block of code.

Okay, and since it is a ref, it updates the ld variable?

It should yes,

1 Like