Esempio n. 1
0
 /// <summary>
 ///  Add a new item.
 /// </summary>
 /// <param name="item">Item to be inserted in the validation chain</param>
 public void AddItem(ValidationChain <T> item)
 {
     if (_currentItem == null)
     {
         _currentItem = item;
         First        = _currentItem;
     }
     else
     {
         _currentItem.SetNext(item);
         _currentItem = item;
     }
 }
Esempio n. 2
0
        private void LoadValidationRules(ISqlExecutor executor)
        {
            var conceptValidation = new BookingConceptRule();
            var correctRule       = new BookingDateCorrectRule();
            var fare      = new BookingFareRule(executor);
            var driver    = new BookingDriverRule(executor);
            var client    = new BookingClientRule(executor);
            var groupRule = new BookingGroupCorrectRule(executor);
            var office    = new BookingOfficeRule(executor);
            var bookingItemsValidation = new BookingItemsValidationRules();

            _validationChain.SetNext(fare);
            fare.SetNext(conceptValidation);
            conceptValidation.SetNext(driver);
            driver.SetNext(client);
            client.SetNext(correctRule);
            correctRule.SetNext(groupRule);
            groupRule.SetNext(office);
            office.SetNext(bookingItemsValidation);
        }