private bool ExtractPlate(string value) { try { for (int i = 0; i < SupportedFormats.GetLength(0); i++) { Regex r = new Regex(SupportedFormats[i, 0]); Match m = r.Match(value); if (m.Success) { this._LiteralPart = m.Groups[0].Value.Substring(0, 3); r = new Regex(SupportedFormats[i, 2]); m = r.Match(value); string RightP = m.Groups[0].Value; if (RightP.Length == 3) { RightP = "0" + RightP; } this._FullPlate = LiteralParte + '-' + RightP; Int32.TryParse(RightP, out this._NumeralPart); return(true); } } } catch { } this._PlateStatus = PlateStatus.InvalidPlate; return(false); }
/// <summary> /// Evaluates the Plate and returns an instance containing it. /// </summary> /// <param name="Plate">Plate. Suported String Format: 3 letters + hyphen (optional) + 3-4 digits</param> public Plate(string Plate) { if (ExtractPlate(Plate)) { this._PlateStatus = PlateStatus.Ok; } }
public TransactionRequestBody(string etag, int station, int lane, int ticketId, PlateStatus plateStatus, string plate, int imageCount) { Etag = etag; Station = station; Lane = lane; TicketId = ticketId; Status = plateStatus; Plate = plate; ImageCount = imageCount; }