internal virtual StringBuilder GetAutoPropertyFilterString()
        {
            var res = new StringBuilder();


            if (LineNumberFilter.HasValue)
            {
                res.Append(" && " + string.Format("LineNumber == {0}", LineNumberFilter.ToString()));
            }

            if (IsAssessedFilter.HasValue)
            {
                res.Append(" && " + string.Format("IsAssessed == {0}", IsAssessedFilter));
            }


            if (DoNotAllocateFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotAllocate == {0}", DoNotAllocateFilter));
            }


            if (DoNotEXFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotEX == {0}", DoNotEXFilter));
            }


            if (AttributeOnlyAllocationFilter.HasValue)
            {
                res.Append(" && " + string.Format("AttributeOnlyAllocation == {0}", AttributeOnlyAllocationFilter));
            }


            if (string.IsNullOrEmpty(Description_of_goodsFilter) == false)
            {
                res.Append(" && " + string.Format("Description_of_goods.Contains(\"{0}\")", Description_of_goodsFilter));
            }


            if (string.IsNullOrEmpty(Commercial_DescriptionFilter) == false)
            {
                res.Append(" && " + string.Format("Commercial_Description.Contains(\"{0}\")", Commercial_DescriptionFilter));
            }


            if (Gross_weight_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Gross_weight_itm == {0}", Gross_weight_itmFilter.ToString()));
            }

            if (Net_weight_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Net_weight_itm == {0}", Net_weight_itmFilter.ToString()));
            }

            if (Item_priceFilter.HasValue)
            {
                res.Append(" && " + string.Format("Item_price == {0}", Item_priceFilter.ToString()));
            }

            if (ItemQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("ItemQuantity == {0}", ItemQuantityFilter.ToString()));
            }

            if (string.IsNullOrEmpty(Suppplementary_unit_codeFilter) == false)
            {
                res.Append(" && " + string.Format("Suppplementary_unit_code.Contains(\"{0}\")", Suppplementary_unit_codeFilter));
            }


            if (string.IsNullOrEmpty(ItemNumberFilter) == false)
            {
                res.Append(" && " + string.Format("ItemNumber.Contains(\"{0}\")", ItemNumberFilter));
            }


            if (string.IsNullOrEmpty(TariffCodeFilter) == false)
            {
                res.Append(" && " + string.Format("TariffCode.Contains(\"{0}\")", TariffCodeFilter));
            }


            if (TariffCodeLicenseRequiredFilter.HasValue)
            {
                res.Append(" && " + string.Format("TariffCodeLicenseRequired == {0}", TariffCodeLicenseRequiredFilter));
            }


            if (TariffCategoryLicenseRequiredFilter.HasValue)
            {
                res.Append(" && " + string.Format("TariffCategoryLicenseRequired == {0}", TariffCategoryLicenseRequiredFilter));
            }


            if (string.IsNullOrEmpty(TariffCodeDescriptionFilter) == false)
            {
                res.Append(" && " + string.Format("TariffCodeDescription.Contains(\"{0}\")", TariffCodeDescriptionFilter));
            }


            if (DutyLiabilityFilter.HasValue)
            {
                res.Append(" && " + string.Format("DutyLiability == {0}", DutyLiabilityFilter.ToString()));
            }

            if (Total_CIF_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Total_CIF_itm == {0}", Total_CIF_itmFilter.ToString()));
            }

            if (FreightFilter.HasValue)
            {
                res.Append(" && " + string.Format("Freight == {0}", FreightFilter.ToString()));
            }

            if (Statistical_valueFilter.HasValue)
            {
                res.Append(" && " + string.Format("Statistical_value == {0}", Statistical_valueFilter.ToString()));
            }

            if (DPQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DPQtyAllocated == {0}", DPQtyAllocatedFilter.ToString()));
            }

            if (DFQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DFQtyAllocated == {0}", DFQtyAllocatedFilter.ToString()));
            }

            if (PiQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("PiQuantity == {0}", PiQuantityFilter.ToString()));
            }

            if (ImportCompleteFilter.HasValue)
            {
                res.Append(" && " + string.Format("ImportComplete == {0}", ImportCompleteFilter));
            }
            return(res.ToString().StartsWith(" &&") || res.Length == 0 ? res:  res.Insert(0, " && "));
        }
        internal virtual StringBuilder GetAutoPropertyFilterString()
        {
            var res = new StringBuilder();

            if (AsycudaDocumentIdFilter.HasValue)
            {
                res.Append(" && " + string.Format("AsycudaDocumentId == {0}", AsycudaDocumentIdFilter.ToString()));
            }

            if (!string.IsNullOrEmpty(LineNumberFilter))
            {
                res.Append(" && " + string.Format("LineNumber == {0}", LineNumberFilter));
            }

            if (IsAssessedFilter.HasValue)
            {
                res.Append(" && " + string.Format("IsAssessed == {0}", IsAssessedFilter));
            }


            if (DoNotAllocateFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotAllocate == {0}", DoNotAllocateFilter));
            }


            if (DoNotEXFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotEX == {0}", DoNotEXFilter));
            }


            if (AttributeOnlyAllocationFilter.HasValue)
            {
                res.Append(" && " + string.Format("AttributeOnlyAllocation == {0}", AttributeOnlyAllocationFilter));
            }


            if (string.IsNullOrEmpty(Description_of_goodsFilter) == false)
            {
                res.Append(" && " + string.Format("Description_of_goods.Contains(\"{0}\")", Description_of_goodsFilter));
            }


            if (string.IsNullOrEmpty(Commercial_DescriptionFilter) == false)
            {
                res.Append(" && " + string.Format("Commercial_Description.Contains(\"{0}\")", Commercial_DescriptionFilter));
            }


            if (Gross_weight_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Gross_weight_itm == {0}", Gross_weight_itmFilter.ToString()));
            }

            if (Net_weight_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Net_weight_itm == {0}", Net_weight_itmFilter.ToString()));
            }

            if (Item_priceFilter.HasValue)
            {
                res.Append(" && " + string.Format("Item_price == {0}", Item_priceFilter.ToString()));
            }

            if (ItemQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("ItemQuantity == {0}", ItemQuantityFilter.ToString()));
            }

            if (string.IsNullOrEmpty(Suppplementary_unit_codeFilter) == false)
            {
                res.Append(" && " + string.Format("Suppplementary_unit_code.Contains(\"{0}\")", Suppplementary_unit_codeFilter));
            }


            if (string.IsNullOrEmpty(ItemNumberFilter) == false)
            {
                res.Append(" && " + string.Format("ItemNumber.Contains(\"{0}\")", ItemNumberFilter));
            }


            if (string.IsNullOrEmpty(TariffCodeFilter) == false)
            {
                res.Append(" && " + string.Format("TariffCode.Contains(\"{0}\")", TariffCodeFilter));
            }


            if (TariffCodeLicenseRequiredFilter.HasValue)
            {
                res.Append(" && " + string.Format("TariffCodeLicenseRequired == {0}", TariffCodeLicenseRequiredFilter));
            }


            if (TariffCategoryLicenseRequiredFilter.HasValue)
            {
                res.Append(" && " + string.Format("TariffCategoryLicenseRequired == {0}", TariffCategoryLicenseRequiredFilter));
            }


            if (string.IsNullOrEmpty(TariffCodeDescriptionFilter) == false)
            {
                res.Append(" && " + string.Format("TariffCodeDescription.Contains(\"{0}\")", TariffCodeDescriptionFilter));
            }


            if (DutyLiabilityFilter.HasValue)
            {
                res.Append(" && " + string.Format("DutyLiability == {0}", DutyLiabilityFilter.ToString()));
            }

            if (Total_CIF_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Total_CIF_itm == {0}", Total_CIF_itmFilter.ToString()));
            }

            if (FreightFilter.HasValue)
            {
                res.Append(" && " + string.Format("Freight == {0}", FreightFilter.ToString()));
            }

            if (Statistical_valueFilter.HasValue)
            {
                res.Append(" && " + string.Format("Statistical_value == {0}", Statistical_valueFilter.ToString()));
            }

            if (DPQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DPQtyAllocated == {0}", DPQtyAllocatedFilter.ToString()));
            }

            if (DFQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DFQtyAllocated == {0}", DFQtyAllocatedFilter.ToString()));
            }

            if (PiQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("PiQuantity == {0}", PiQuantityFilter.ToString()));
            }

            if (ImportCompleteFilter.HasValue)
            {
                res.Append(" && " + string.Format("ImportComplete == {0}", ImportCompleteFilter));
            }


            if (string.IsNullOrEmpty(CNumberFilter) == false)
            {
                res.Append(" && " + string.Format("CNumber.Contains(\"{0}\")", CNumberFilter));
            }



            if (Convert.ToDateTime(StartRegistrationDateFilter).Date != DateTime.MinValue &&
                Convert.ToDateTime(EndRegistrationDateFilter).Date != DateTime.MinValue)
            {
                res.Append(" && (");
            }

            if (Convert.ToDateTime(StartRegistrationDateFilter).Date != DateTime.MinValue)
            {
                if (StartRegistrationDateFilter.HasValue)
                {
                    res.Append(
                        (Convert.ToDateTime(EndRegistrationDateFilter).Date != DateTime.MinValue?"":" && ") +
                        string.Format("RegistrationDate >= \"{0}\"", Convert.ToDateTime(StartRegistrationDateFilter).Date.ToString("MM/dd/yyyy")));
                }
            }

            if (Convert.ToDateTime(EndRegistrationDateFilter).Date != DateTime.MinValue)
            {
                if (EndRegistrationDateFilter.HasValue)
                {
                    res.Append(" && " + string.Format("RegistrationDate <= \"{0}\"", Convert.ToDateTime(EndRegistrationDateFilter).Date.AddHours(23).ToString("MM/dd/yyyy HH:mm:ss")));
                }
            }

            if (Convert.ToDateTime(StartRegistrationDateFilter).Date != DateTime.MinValue &&
                Convert.ToDateTime(EndRegistrationDateFilter).Date != DateTime.MinValue)
            {
                res.Append(" )");
            }

            if (Convert.ToDateTime(_registrationDateFilter).Date != DateTime.MinValue)
            {
                if (RegistrationDateFilter.HasValue)
                {
                    res.Append(" && " + string.Format("RegistrationDate == \"{0}\"", Convert.ToDateTime(RegistrationDateFilter).Date.ToString("MM/dd/yyyy")));
                }
            }


            if (Number_of_packagesFilter.HasValue)
            {
                res.Append(" && " + string.Format("Number_of_packages == {0}", Number_of_packagesFilter.ToString()));
            }

            if (string.IsNullOrEmpty(Country_of_origin_codeFilter) == false)
            {
                res.Append(" && " + string.Format("Country_of_origin_code.Contains(\"{0}\")", Country_of_origin_codeFilter));
            }


            if (PiWeightFilter.HasValue)
            {
                res.Append(" && " + string.Format("PiWeight == {0}", PiWeightFilter.ToString()));
            }

            if (Currency_rateFilter.HasValue)
            {
                res.Append(" && " + string.Format("Currency_rate == {0}", Currency_rateFilter.ToString()));
            }

            if (string.IsNullOrEmpty(Currency_codeFilter) == false)
            {
                res.Append(" && " + string.Format("Currency_code.Contains(\"{0}\")", Currency_codeFilter));
            }


            if (InvalidHSCodeFilter.HasValue)
            {
                res.Append(" && " + string.Format("InvalidHSCode == {0}", InvalidHSCodeFilter));
            }


            if (string.IsNullOrEmpty(WarehouseErrorFilter) == false)
            {
                res.Append(" && " + string.Format("WarehouseError.Contains(\"{0}\")", WarehouseErrorFilter));
            }
            return(res.ToString().StartsWith(" &&") || res.Length == 0 ? res:  res.Insert(0, " && "));
        }
        internal virtual StringBuilder GetAutoPropertyFilterString()
        {
            var res = new StringBuilder();


            if (string.IsNullOrEmpty(Amount_deducted_from_licenceFilter) == false)
            {
                res.Append(" && " + string.Format("Amount_deducted_from_licence.Contains(\"{0}\")", Amount_deducted_from_licenceFilter));
            }


            if (string.IsNullOrEmpty(Licence_numberFilter) == false)
            {
                res.Append(" && " + string.Format("Licence_number.Contains(\"{0}\")", Licence_numberFilter));
            }


            if (string.IsNullOrEmpty(Free_text_1Filter) == false)
            {
                res.Append(" && " + string.Format("Free_text_1.Contains(\"{0}\")", Free_text_1Filter));
            }


            if (string.IsNullOrEmpty(Free_text_2Filter) == false)
            {
                res.Append(" && " + string.Format("Free_text_2.Contains(\"{0}\")", Free_text_2Filter));
            }


            if (LineNumberFilter.HasValue)
            {
                res.Append(" && " + string.Format("LineNumber == {0}", LineNumberFilter.ToString()));
            }

            if (IsAssessedFilter.HasValue)
            {
                res.Append(" && " + string.Format("IsAssessed == {0}", IsAssessedFilter));
            }


            if (DPQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DPQtyAllocated == {0}", DPQtyAllocatedFilter.ToString()));
            }

            if (DFQtyAllocatedFilter.HasValue)
            {
                res.Append(" && " + string.Format("DFQtyAllocated == {0}", DFQtyAllocatedFilter.ToString()));
            }



            if (Convert.ToDateTime(StartEntryTimeStampFilter).Date != DateTime.MinValue &&
                Convert.ToDateTime(EndEntryTimeStampFilter).Date != DateTime.MinValue)
            {
                res.Append(" && (");
            }

            if (Convert.ToDateTime(StartEntryTimeStampFilter).Date != DateTime.MinValue)
            {
                if (StartEntryTimeStampFilter.HasValue)
                {
                    res.Append(
                        (Convert.ToDateTime(EndEntryTimeStampFilter).Date != DateTime.MinValue?"":" && ") +
                        string.Format("EntryTimeStamp >= \"{0}\"", Convert.ToDateTime(StartEntryTimeStampFilter).Date.ToString("MM/dd/yyyy")));
                }
            }

            if (Convert.ToDateTime(EndEntryTimeStampFilter).Date != DateTime.MinValue)
            {
                if (EndEntryTimeStampFilter.HasValue)
                {
                    res.Append(" && " + string.Format("EntryTimeStamp <= \"{0}\"", Convert.ToDateTime(EndEntryTimeStampFilter).Date.AddHours(23).ToString("MM/dd/yyyy HH:mm:ss")));
                }
            }

            if (Convert.ToDateTime(StartEntryTimeStampFilter).Date != DateTime.MinValue &&
                Convert.ToDateTime(EndEntryTimeStampFilter).Date != DateTime.MinValue)
            {
                res.Append(" )");
            }

            if (Convert.ToDateTime(_entryTimeStampFilter).Date != DateTime.MinValue)
            {
                if (EntryTimeStampFilter.HasValue)
                {
                    res.Append(" && " + string.Format("EntryTimeStamp == \"{0}\"", Convert.ToDateTime(EntryTimeStampFilter).Date.ToString("MM/dd/yyyy")));
                }
            }


            if (AttributeOnlyAllocationFilter.HasValue)
            {
                res.Append(" && " + string.Format("AttributeOnlyAllocation == {0}", AttributeOnlyAllocationFilter));
            }


            if (DoNotAllocateFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotAllocate == {0}", DoNotAllocateFilter));
            }


            if (DoNotEXFilter.HasValue)
            {
                res.Append(" && " + string.Format("DoNotEX == {0}", DoNotEXFilter));
            }


            if (Item_priceFilter.HasValue)
            {
                res.Append(" && " + string.Format("Item_price == {0}", Item_priceFilter.ToString()));
            }

            if (string.IsNullOrEmpty(ItemNumberFilter) == false)
            {
                res.Append(" && " + string.Format("ItemNumber.Contains(\"{0}\")", ItemNumberFilter));
            }


            if (string.IsNullOrEmpty(TariffCodeFilter) == false)
            {
                res.Append(" && " + string.Format("TariffCode.Contains(\"{0}\")", TariffCodeFilter));
            }


            if (DutyLiabilityFilter.HasValue)
            {
                res.Append(" && " + string.Format("DutyLiability == {0}", DutyLiabilityFilter.ToString()));
            }

            if (Total_CIF_itmFilter.HasValue)
            {
                res.Append(" && " + string.Format("Total_CIF_itm == {0}", Total_CIF_itmFilter.ToString()));
            }

            if (FreightFilter.HasValue)
            {
                res.Append(" && " + string.Format("Freight == {0}", FreightFilter.ToString()));
            }

            if (Statistical_valueFilter.HasValue)
            {
                res.Append(" && " + string.Format("Statistical_value == {0}", Statistical_valueFilter.ToString()));
            }

            if (PiQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("PiQuantity == {0}", PiQuantityFilter.ToString()));
            }

            if (string.IsNullOrEmpty(Description_of_goodsFilter) == false)
            {
                res.Append(" && " + string.Format("Description_of_goods.Contains(\"{0}\")", Description_of_goodsFilter));
            }


            if (string.IsNullOrEmpty(Commercial_DescriptionFilter) == false)
            {
                res.Append(" && " + string.Format("Commercial_Description.Contains(\"{0}\")", Commercial_DescriptionFilter));
            }


            if (string.IsNullOrEmpty(Suppplementary_unit_codeFilter) == false)
            {
                res.Append(" && " + string.Format("Suppplementary_unit_code.Contains(\"{0}\")", Suppplementary_unit_codeFilter));
            }


            if (ItemQuantityFilter.HasValue)
            {
                res.Append(" && " + string.Format("ItemQuantity == {0}", ItemQuantityFilter.ToString()));
            }

            if (string.IsNullOrEmpty(NumberFilter) == false)
            {
                res.Append(" && " + string.Format("Number.Contains(\"{0}\")", NumberFilter));
            }


            if (string.IsNullOrEmpty(DocumentTypeFilter) == false)
            {
                res.Append(" && " + string.Format("DocumentType.Contains(\"{0}\")", DocumentTypeFilter));
            }
            return(res.ToString().StartsWith(" &&") || res.Length == 0 ? res:  res.Insert(0, " && "));
        }