Hi,
I am in Multi-tenant Cloud environment, and I am trying to resolve this issue.
In FormScript I am going thru my Ledger Lines list, and I want to filter this list according to data which I get from SUN API Chart of Accounts. When I found, that some Account has Allocation in Progress in CoA, I want that line deleted from Ledger Lines list. But I also need option for user. User can choose if he wants to delete just this one Account, or all other problematic Accounts without more questions, or to stay on this Account, and run check again.
I am trying to do thru Application.ShowMessage, but message is displayed after whole FormScript section is done, so I am stucked in this loop. Is there any possibilities to show this Message to user immediately?
void FilterLedgerLinesCOA(ref List<Content> ledgerLines, List<COA.Content> coa, string bu)
{
bool msgTest = true;
for (int i = 0; i < ledgerLines.Count; i++)
{
COA.Content c = null;
string accountCode = ledgerLines[i].accountCode;
c = coa.Find(x => x.accountCode == accountCode);
if (c.allocationInProgress.code == 1)
{
bool exitLoop = false;
if (msgTest)
{
do
{
wsMsgBoxResult result = Application.ShowMessage(string.Format("Allocation in progress on Account {0}\n(Yes) for Retry\n(No) for skip this Account\n(Cancel) for skip All Accounts", accountCode),
"Mark for Payment", wsMessageStyle.wsYesNoCancel, wsMessageDisplay.wsMsgBox);
switch (result)
{
case wsMsgBoxResult.wsYes:
LogWrite("SYMP", string.Format("Testing {0} Account again", accountCode), "", "", "", "", "", "", "", "", "", "0");
exitLoop = false;
List<COA.Content> oneAcc = GetCOA(bu, null, accountCode);
if (oneAcc[0].allocationInProgress.code != 1)
{
exitLoop = true;
}
break;
case wsMsgBoxResult.wsNo:
LogWrite("SYMP", string.Format("Account {0} removed", accountCode), "", "", "", "", "", "", "", "", "", "0");
ledgerLines.RemoveAt(i);
i--;
exitLoop = true;
break;
case wsMsgBoxResult.wsCancel:
LogWrite("SYMP", string.Format("Account {0} removed. And also all other Account with AwP will be removed", accountCode), "", "", "", "", "", "", "", "", "", "0");
ledgerLines.RemoveAt(i);
i--;
msgTest = false;
exitLoop = true;
break;
}
} while (!exitLoop);
}
else
{
ledgerLines.RemoveAt(i);
i--;
}
}
}
}