Good morning,
I am working on a bit of code to update a UD field in the OrderRel table called Character01.
This bit of code works for updating the UD char field:
MyOrder = xRow.OrderRel_OrderNum;
MyLine = xRow.OrderRel_OrderLine;
MyRel = xRow.OrderRel_OrderRelNum;
MyDate = xRow.Calculated_MinDate;
Erp.Tables.OrderRel OrderRel;
using (var txscope1 = IceDataContext.CreateDefaultTransactionScope())
{
foreach (var rel in (from rRow in Db.OrderRel where rRow.OrderNum == MyOrder && rRow.OrderLine == MyLine && rRow.OrderRelNum == MyRel select rRow))
{
if (rel != null)
{
string DateNew = String.Format("{0:M/d/yyyy}", MyDate);
string DateOld = String.Format("{0:M/d/yyyy}", rel.ReqDate);
rel.Character01 = BpmFunc.Now() + "--- System updated release " + MyRel + " in order " + MyOrder + " on line " + MyLine + "." + " Old Date: " + DateOld + " New Date: " + DateNew;
rel.ReqDate = MyDate;
rel.NeedByDate = MyDate;
Db.Validate(rel);
UpdateCount = UpdateCount + 1;
}
txscope1.Complete();
}
}
However, when I try to update the UD field here, the code doesn’t work:
using (Erp.Contracts.SalesOrderSvcContract soSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
{
SalesOrderTableset SOTS = soSvc.GetByID(MyOrder);
var desiredReleases = SOTS.OrderRel.Where(r => r.OrderLine == MyLine && r.OrderRelNum == MyRel);
MyDate = xRow.OrderRel_ReqDate;
foreach(var rel in desiredReleases)
{
string DateNew = String.Format("{0:M/d/yyyy}", MyDate);
string DateOld = String.Format("{0:M/d/yyyy}", rel.ReqDate);
rel.Character01 = BpmFunc.Now() + "--- System manually updated release " + MyRel + " in order " + MyOrder + " on line " + MyLine + " Old Date: " + DateOld + " New Date: " + DateNew + " Old Qty: " + rel.OurReqQty + " New Qty: " + xRow.OrderRel_OurReqQty;
rel.ReqDate = MyDate;
rel.NeedByDate = MyDate;
rel.OurReqQty = xRow.OrderRel_OurReqQty;
rel.RowMod = "U";
ManualUp=ManualUp+1;
}
soSvc.Update(ref SOTS);
}
The problem is:
'OrderRelRow' does not contain a definition for 'Character01' and no accessible extension method 'Character01' accepting a first argument of type 'OrderRelRow' could be found (are you missing a using directive or an assembly reference?)
I tried to fix this by going back and adding Char01 to the ttResults, and also making it an updatable field. Neither approach seemed to help.
Where am I going wrong here?
Thanks for you time!
Nate