Esempio n. 1
0
        private string GenRN()
        {
            try
            {
                PurchaseReturn lastReturn = return_repo.GetLast();
                //PurchaseReturn lastReturn = context.PurchaseReturns.LastOrDefault();
                string value  = lastReturn.ReturnNumber;
                string number = Regex.Match(value, "[0-9]+$").Value;

                return(value.Substring(0, value.Length - number.Length) +
                       (long.Parse(number) + 1).ToString().PadLeft(number.Length, '0'));
            }
            catch (NullReferenceException e)
            {
                return("PRN0000001");
            }
        }