Ejemplo n.º 1
0
        public void Scan()
        {
            if (ItemsCount < 1)
            {
                throw new ArgumentException($"Cannot scan Item(EAN: {BookEan.Code}) that do not have any positions");
            }
            if (IsAllScanned)
            {
                throw new ArgumentException($"All positions of Item(EAN: {BookEan.Code}) are scanned");
            }
            if (ScannedCount >= ItemsCount)
            {
                throw new ArgumentException($"Cannot scan more positions for Item(EAN: {BookEan.Code}) because all positions are already scanned");
            }

            ScannedCount++;

            if (ScannedCount > 0)
            {
                IsScanned = true;
            }

            if (ScannedCount.Equals(ItemsCount))
            {
                IsAllScanned = true;
            }
        }
Ejemplo n.º 2
0
        public void Unscan()
        {
            if (ItemsCount < 1)
            {
                throw new ArgumentException($"Cannot unscan Item(EAN: {BookEan.Code}) that do not have any positions");
            }
            if (!IsScanned)
            {
                throw new ArgumentException($"Cannot unscan Item(EAN: {BookEan.Code}) that do not have any scanned positions");
            }

            ScannedCount--;

            if (ScannedCount.Equals(0))
            {
                IsScanned = false;
            }
            if (ScannedCount < ItemsCount)
            {
                IsAllScanned = false;
            }
        }