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

Popular posts from this blog

₹2.5 Lakh ki Alkaline Machine: Investment Ya Hype?" Japan Technology Wale Alkaline Water Systems: Science Ya Sirf Marketing? "Alkaline Water Machines — Health Ke Naam Par Business?

How to Write "M Squared" (M²) in C#