Exemplo n.º 1
0
 /// <summary>
 /// Vaildates the criteria.
 /// </summary>
 /// <param name="criteria">The criteria.</param>
 /// <exception cref="System.ArgumentNullException">
 /// critiera;Search critiera is required
 /// or
 /// UserId;client search cannot be conducted without specifying the user
 /// </exception>
 /// <remarks>This method is tested in the client/SearchFixture unit test</remarks>
 internal virtual void VaildateCriteria(Data.Search.SearchCriteria criteria)
 {
     if (criteria == null)
     {
         throw new ArgumentNullException("critiera", "Search critiera is required");
     }
     if (criteria.UserId == Guid.Empty)
     {
         throw new ArgumentNullException("UserId",
                                         "client search cannot be conducted without specifying the user");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Vaildates the criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <exception cref="NullReferenceException">Invoice search criteria could not be cast to the proper type</exception>
        /// <remarks>
        /// This method is tested in the client/SearchFixture unit test
        /// </remarks>
        internal override void VaildateCriteria(Data.Search.SearchCriteria criteria)
        {
            base.VaildateCriteria(criteria);

            var invCriteria = (criteria as Data.Search.InvoiceCriteria);

            if (invCriteria == null)
            {
                throw new NullReferenceException("Invoice search criteria could not be cast to the proper type");
            }

            if (invCriteria.VoidedDateRange != null &&
                (invCriteria.VoidedDateRange.From != default(DateTime) ||
                 invCriteria.VoidedDateRange.To != default(DateTime)))
            {
                invCriteria.Voided = true;
            }
        }