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


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


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


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


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


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


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


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


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


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

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


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


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

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


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


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


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

            if (TotalGrossWeightFilter.HasValue)
            {
                res.Append(" && " + string.Format("TotalGrossWeight == {0}", TotalGrossWeightFilter.ToString()));
            }
            return(res.ToString().StartsWith(" &&") || res.Length == 0 ? res:  res.Insert(0, " && "));
        }
Exemplo n.º 2
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, " && "));
        }