示例#1
0
        internal virtual StringBuilder GetAutoPropertyFilterString()
        {
            var res = new StringBuilder();


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


            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 (IsManuallyAssessedFilter.HasValue)
            {
                res.Append(" && " + string.Format("IsManuallyAssessed == {0}", IsManuallyAssessedFilter));
            }


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



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

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

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

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

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


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

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

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

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


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


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


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

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


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


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


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


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

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


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


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


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

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



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

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

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

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

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



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

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

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

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

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


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


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


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


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


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

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

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


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



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

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

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

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

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


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

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

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


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


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


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


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

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

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

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



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

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

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

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

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

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


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

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

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

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


            if (InvalidFilter.HasValue)
            {
                res.Append(" && " + string.Format("Invalid == {0}", InvalidFilter));
            }
            if (pLineNumberFilter.HasValue)
            {
                res.Append(" && " + string.Format("pLineNumber == {0}", pLineNumberFilter.ToString()));
            }



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

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

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

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

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


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

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

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

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

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



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


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

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

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

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

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

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

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


            return(res.ToString().StartsWith(" &&") || res.Length == 0 ? res : res.Insert(0, " && "));
        }