コード例 #1
0
        public long GetRequestNumber(RequestNumberGenerationMethod method, long increment)
        {
            long requestNumber;

            switch (method)
            {
            case RequestNumberGenerationMethod.UnixTimestamp:
                requestNumber = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                break;

            case RequestNumberGenerationMethod.LiteralTimestamp:
                string timestamp =
                    DateTime.UtcNow.ToString("yyMMddHHmmssfff", CultureInfo.InvariantCulture.DateTimeFormat);
                requestNumber = long.Parse(timestamp, NumberStyles.Integer,
                                           CultureInfo.InvariantCulture.NumberFormat);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            requestNumber += increment;

            return(requestNumber);
        }
コード例 #2
0
 public long GetRequestNumber(RequestNumberGenerationMethod method, long increment)
 {
     throw new NotImplementedException();
 }