This commit is contained in:
@@ -3,7 +3,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
namespace AyaNova.PickList
|
namespace AyaNova.PickList
|
||||||
{
|
{
|
||||||
internal class LoanUnitPickList : AyaPickList
|
internal class LoanUnitPickList : AyaPickList, IAyaPickListVariant
|
||||||
{
|
{
|
||||||
public LoanUnitPickList()
|
public LoanUnitPickList()
|
||||||
{
|
{
|
||||||
@@ -71,9 +71,23 @@ namespace AyaNova.PickList
|
|||||||
|
|
||||||
public string GetVariantCriteria(string variant)
|
public string GetVariantCriteria(string variant)
|
||||||
{
|
{
|
||||||
// :variant="availableonly" Only items that are not on a workorderitemloan
|
// :variant="availableonly:[preselectedid]" Only items that are not on a workorderitemloan
|
||||||
if (string.IsNullOrWhiteSpace(variant) || variant != "availableonly") return string.Empty;
|
if (string.IsNullOrWhiteSpace(variant)) return string.Empty;
|
||||||
return "aloanunit.workorderitemloanid is null";
|
|
||||||
|
if (!variant.Contains(":"))
|
||||||
|
throw new System.ArgumentOutOfRangeException($"LoanUnitPickList variant specified \"{variant}\" not valid, missing preselect id");
|
||||||
|
|
||||||
|
var v = variant.Split(":");
|
||||||
|
long loanUnitId = 0;
|
||||||
|
if (!string.IsNullOrWhiteSpace(v[1]))
|
||||||
|
{
|
||||||
|
long.TryParse(v[1], out loanUnitId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loanUnitId != 0)
|
||||||
|
return $"workorderitemloanid is null or id={loanUnitId}";
|
||||||
|
else
|
||||||
|
return "workorderitemloanid is null";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user