示例#1
0
 public NmvsProductCode(string productCode, string serialNo, string batchId, NmvsDate expireDate)
 {
     Validate(productCode, serialNo, batchId);
     ProductCode = productCode;
     SerialNo    = serialNo;
     BatchId     = batchId;
     ExpireDate  = expireDate;
 }
示例#2
0
        public override void Parse(string codeString)
        {
            codeString = codeString.Replace(GroupSeparator, string.Empty);
            var match = Regex.Match(codeString, @"^01(\d{14})17(\d{6})21(.{1,20})10(.+)$");

            if (!match.Success)
            {
                throw new ArgumentException("Invalid code string format. Look at examples to get valid code");
            }

            ProductCode = match.Groups[1].Value;
            ExpireDate  = new NmvsDate(match.Groups[2].Value);
            SerialNo    = match.Groups[3].Value;
            BatchId     = match.Groups[4].Value;
        }