I’ve used RowMod of A, U, and even D but never heard of P. This code is a modified copy of the auto generated base code of the UDTable method. It works but what is rowMod P? I’ve used A / D / and U even but never seen a P
I know, usually don’t go with auto-code is recommended but what i was trying wasn’t working.
using (var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD32SvcContract>())
{
var ttResultQuery = ttResults
.Where(row => !string.IsNullOrEmpty(row.RowMod) && row.RowMod != "P");
foreach (var ttResult in ttResultQuery)
{
var ds = new Ice.Tablesets.UpdExtUD32Tableset();
bool errorOccurred;
// Query to object mapping
{
var UD32 = new Ice.Tablesets.UD32Row
{
Company = Session.CompanyID,
Key1 = ttResult.InvcHead_InvoiceNum.ToString(),
Key2 = "ARStatus",
Key3 = "",
Key4 = "",
Key5 = "",
ShortChar01 = ttResult.UD32_ShortChar01,
};
ds.UD32.Add(UD32);
}
BOUpdErrorTableset boUpdateErrors = svc.UpdateExt(ref ds, true, true, out errorOccurred);
if (this.BpmDataFormIsPublished()) return;
ttResult.RowMod = "P";
// Object to query mapping
{
var UD32 = ds.UD32.FirstOrDefault(
tableRow => tableRow.Company == Session.CompanyID
&& tableRow.Key1 == ttResult.InvcHead_InvoiceNum.ToString()
&& tableRow.Key2 == "ARStatus"
&& tableRow.Key3 == ""
&& tableRow.Key4 == ""
&& tableRow.Key5 == "");
if (UD32 == null)
{
UD32 = ds.UD32.LastOrDefault();
}
if (UD32 != null)
{
ttResult.UD32_Company = UD32.Company;
ttResult.UD32_Key1 = UD32.Key1;
ttResult.UD32_Key2 = UD32.Key2;
ttResult.UD32_Key3 = UD32.Key3;
ttResult.UD32_Key4 = UD32.Key4;
ttResult.UD32_Key5 = UD32.Key5;
ttResult.UD32_ShortChar01 = UD32.ShortChar01;
}
}
if (errorOccurred && boUpdateErrors?.BOUpdError != null)
{
ttErrors
.AddRange(
boUpdateErrors.BOUpdError
.Select(
e => new ErrorsUbaqRow
{
TableName = e.TableName,
ErrorRowIdent = ttResult.RowIdent,
ErrorText = e.ErrorText,
ErrorType = e.ErrorType
}));
}
}
}
var ttResultsForDelete = ttResults
.Where(row => row.RowMod != "P")
.ToArray();
foreach (var ttResult in ttResultsForDelete)
{
ttResults.Remove(ttResult);
}
foreach (var ttResult in ttResults)
{
ttResult.RowMod = "";
}