Пример #1
0
        public TillDataRowValidation(string newBarcode, string stringQuantity)
        {
            var nbV = new OldBarcodeValidation(newBarcode);

            //barcode is valid
            if (nbV.isOldBarcodeValid)
            {
                //getting corrisponding item
                using (var iRepo = new ItemRepository(new InventoryContext()))
                {
                    item = iRepo.ItemByBarcode(newBarcode).First();
                }
                var qV = new QuantityValidation(stringQuantity, item);

                //quantity is valid
                if (qV.isQuantityValid)
                {
                    isTillDataRowValid = true;
                    quantity           = (int)qV.IntQuantity;
                }
                else
                {
                    isTillDataRowValid = false;
                    quantity           = -1;
                    ErrorMessage      += qV.ErrorMessage;
                }
            }
            else
            {
                isTillDataRowValid = false;
                item          = null;
                quantity      = -1;
                ErrorMessage += nbV.ErrorMessage;
            }
        }
Пример #2
0
        public IncreaseQuantityValidation(string oldBarcode, string quantity)
        {
            var obV = new OldBarcodeValidation(oldBarcode);
            var nqV = new NewQuantityValidation(quantity);

            //validation was passed
            if (obV.isOldBarcodeValid && nqV.isNewQuantityValid)
            {
                isRequestValid = true;
                intQuantity    = StringToIntegerValidation.IntegerFromString(quantity);
            }
            else
            {
                isRequestValid = false;
                intQuantity    = -1;
                ErrorMessage  += obV.ErrorMessage;
                ErrorMessage  += nqV.ErrorMessage;
            }
        }