public override bool Equals(object obj) { var entity = obj as ItemInfoEntity; if (entity == null) { return(false); } return(Code.Equals(entity.Code) && Time.Equals(entity.Time) && Value.Equals(entity.Value) && Amount.Equals(entity.Amount) && Money.Equals(entity.Money) && CodeType.Equals(entity.CodeType) && Type.Equals(entity.Type)); }
public int ParseQrCode() { String numString = null; if (CodeType.Equals(QRCODE_CODETYPE) || CodeType.Equals(QRCODE_CODETYPE2)) { if (CodeContents.Contains(QRCODE_START_URL)) { int qrIdStartIdx = CodeContents.IndexOf(QRCODE_START_URL); if (qrIdStartIdx > 0) { qrIdStartIdx += 5; numString = CodeContents.Substring(qrIdStartIdx); } } } else if (CodeType.Equals(CODE128_CODETYPE)) { var LowerCode = CodeContents.ToLower(); if (LowerCode.StartsWith(QRCODE_START_URL.ToLower())) { numString = LowerCode.Substring(5); } } else { //Barcode -- should just contain numbers. numString = this.CodeContents; } if (numString != null) { // This code can throw exception. return(Int32.Parse(numString)); } else { throw new Exception("Could not parse scanned qr code: " + this.CodeContents); } }