UBAQ to update Primary Warehouse and Bin

This is what the trace reveals and is why I was setting the description manually:

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartOnHandWhseImpl</businessObject>
  <methodName>GetPartOnHandWhse</methodName>
  <appServerUri>net.tcp://isiepicor/PILOT/</appServerUri>
  <returnType>Erp.Tablesets.PartOnHandWhseTableset</returnType>
  <localTime>3/16/2018 10:06:37:6610776 AM</localTime>
  <executionTime total="376" roundTrip="72" channel="302" bpm="0" other="2" />
  <retries>0</retries>
  <parameters>
    <parameter name="cPartNum" type="System.String"><![CDATA[12-12-008]]></parameter>
    <parameter name="cPlant" type="System.String"><![CDATA[MfgSys]]></parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>Update</methodName>
  <appServerUri>net.tcp://isiepicor/PILOT/</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>3/16/2018 10:06:40:9944599 AM</localTime>
  <executionTime total="399" roundTrip="106" channel="273" bpm="0" other="20" />
  <retries>0</retries>
  <parameters>
    <parameter name="ds" type="Erp.BO.PartDataSet">
      <PartDataSet xmlns="http://www.epicor.com/Ice/300/BO/Part/Part" />
    </parameter>
  </parameters>
  <paramDataSetChanges>
    <paramDataSet name="ds" useDataSetNbr="0">
      <changedValue tableName="PartWhse" rowState="Modified" rowNum="1" colName="PrimBinNum"><![CDATA[AA]]></changedValue>
      <changedValue tableName="PartWhse" rowState="Modified" rowNum="1" colName="PrimBinNumDescription"><![CDATA[AA - Art Department]]></changedValue>
    </paramDataSet>
  </paramDataSetChanges>
</tracePacket>

Correct me if I’m wrong, but I had assumed the the “foreach(var r in ttResults.Where(r=>r.Updated())” was looping through only the updated rows in the dataset.
So, if I updated only the highlighted rows in the BAQ, then that foreach statement would only process those two giving an index of 0 to MAIN-WIP and and index of 1 to REMWH1-TRK. Is that wrong?

image

This is what I have been doing since the last time I posted code. I had gotten rid of the index of zero hardcode, and added a counter:

int i = 0;

foreach(var r in ttResults.Where(r=>r.Updated()))
{
    using(var partWhseBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PartOnHandWhseSvcContract>(Db))
  {
	    partWhseBO.GetPartOnHandWhse(r.PlantWhse_PartNum, "MfgSys");
    }

  using(var partBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PartSvcContract>(Db))
  {
		    string binDesc = (
			    from wb in Db.WhseBin.With(LockHint.NoLock)
			    where wb.Company==Session.CompanyID && wb.BinNum==r.PlantWhse_PrimBin
			    select wb.Description).ToString();	

            PartTableset pds = new PartTableset();
		    pds = partBO.GetByID(r.PlantWhse_PartNum);

		    pds.PartWhse[i].WarehouseCode = r.PlantWhse_WarehouseCode;
            pds.PartWhse[i].PrimBinNum = r.PlantWhse_PrimBin;
            pds.PartWhse[i].PrimBinNumDescription = binDesc;
		    pds.PartWhse[i].RowMod = "U";
            partBO.Update(ref pds);

		    i++;
  }
}