コード例 #1
0
        /// <summary>
        /// Checks for at least one filter in the GetItem request.
        /// See GetItem Post https://developers.neto.com.au/documentation/engineers/api-documentation/products/getitem
        /// </summary>
        /// <returns>bool</returns>
        internal override bool isValid()
        {
            if (!string.IsNullOrWhiteSpace(ParentSKU))
            {
                return(true);
            }

            if (DateAddedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateAddedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedTo != DateTime.MinValue)
            {
                return(true);
            }

            int requiredFilterCount = SKU.NullSafeLength() +
                                      AccountingCode.NullSafeLength() +
                                      InventoryID.NullSafeLength() +
                                      Brand.NullSafeLength() +
                                      Model.NullSafeLength() +
                                      Name.NullSafeLength() +
                                      PrimarySupplier.NullSafeLength() +
                                      Approved.NullSafeLength() +
                                      ApprovedForPOS.NullSafeLength() +
                                      ApprovedForMobileStore.NullSafeLength() +
                                      SalesChannels.NullSafeLength() +
                                      Visible.NullSafeLength() +
                                      IsActive.NullSafeLength() +
                                      CategoryID.NullSafeLength();


            if (requiredFilterCount != 0)
            {
                return(true);
            }

            throw new NetoRequestException("At least one filter is required in the GetItem request");
        }