Prefix Add string
public string GetNextPurchaseOrderPOLineItemNo(List<PurchaseOrder_TDI> purchaseOrderTDIlst)
{
long currentItem = 0;
if (purchaseOrderTDIlst.Count > 0)
{
var maxItem = purchaseOrderTDIlst.Max(p => Convert.ToInt32(p.POLineItemNo));
if (maxItem != 0)
{
currentItem = Convert.ToInt32(maxItem) + 10;
}
else
{
currentItem = 10;
}
}
else
{
currentItem = 10;
}
// Add prefix '0' for numbers less than 100
if (currentItem < 100)
{
return currentItem.ToString("D3");
}
else
{
return currentItem.ToString();
}
//return currentItem.ToString();
}
Comments
Post a Comment