コード例 #1
0
        public static PartnerFindTDSSearchResultTable FindPartners(string AFirstName, string AFamilyNameOrOrganisation, string ACity, string APartnerClass, short AMaxRecords, out int ATotalRecords)
        {
            TPartnerFind PartnerFind = new TPartnerFind();

            PartnerFindTDSSearchCriteriaTable CriteriaData = new PartnerFindTDSSearchCriteriaTable();
            PartnerFindTDSSearchCriteriaRow   CriteriaRow  = CriteriaData.NewRowTyped();

            CriteriaData.Rows.Add(CriteriaRow);
            CriteriaRow.PartnerName = AFamilyNameOrOrganisation;

            // CriteriaRow.PersonalName = AFirstName;
            CriteriaRow.City = ACity;

            // TODO: only works for one partner class at the moment
            if (APartnerClass.Length > 0)
            {
                CriteriaRow.PartnerClass = APartnerClass;
            }
            else
            {
                CriteriaRow.PartnerClass = "*";
            }

            PartnerFind.PerformSearch(CriteriaData, true);

            Int32 TotalRecords;
            short TotalPages;

            DataTable typedResult = PartnerFind.GetDataPagedResult(0, AMaxRecords, out TotalRecords, out TotalPages);

            // tell the web client how many records have been found
            ATotalRecords = TotalRecords;

            return((PartnerFindTDSSearchResultTable)typedResult);
        }
コード例 #2
0
        public static PartnerFindTDS FindPartners(string AFirstName, string AFamilyNameOrOrganisation, string ACity, string APartnerClass)
        {
            TPartnerFind PartnerFind = new TPartnerFind();

            PartnerFindTDSSearchCriteriaTable CriteriaData = new PartnerFindTDSSearchCriteriaTable();
            PartnerFindTDSSearchCriteriaRow   CriteriaRow  = CriteriaData.NewRowTyped();

            CriteriaData.Rows.Add(CriteriaRow);
            CriteriaRow.PartnerName = AFamilyNameOrOrganisation;

            // CriteriaRow.PersonalName = AFirstName;
            CriteriaRow.City = ACity;

            // TODO: only works for one partner class at the moment
            if (APartnerClass.Length > 0)
            {
                CriteriaRow.PartnerClass = APartnerClass;
            }
            else
            {
                CriteriaRow.PartnerClass = "*";
            }

            PartnerFind.PerformSearch(CriteriaData, true);

            Int32       TotalRecords;
            short       TotalPages;
            const short MaxRecords = 50;

            PartnerFindTDS result = new PartnerFindTDS();

            DataTable typedResult = PartnerFind.GetDataPagedResult(0, MaxRecords, out TotalRecords, out TotalPages);

            if (typedResult != null)
            {
                result.SearchResult.Merge(typedResult);

                if (TotalRecords > MaxRecords)
                {
                    // TODO load all data into the datatable. the webconnector does not have paging yet?
                }
            }

            return(result);
        }
コード例 #3
0
        public static PartnerFindTDS FindPartners(Int64 APartnerKey, Boolean AExactMatch)
        {
            TPartnerFind PartnerFind = new TPartnerFind();

            PartnerFindTDSSearchCriteriaTable CriteriaData = new PartnerFindTDSSearchCriteriaTable();
            PartnerFindTDSSearchCriteriaRow   CriteriaRow  = CriteriaData.NewRowTyped();

            CriteriaData.Rows.Add(CriteriaRow);
            CriteriaRow.PartnerKey           = APartnerKey;
            CriteriaRow.PartnerClass         = "*";
            CriteriaRow.ExactPartnerKeyMatch = AExactMatch;

            // call this in the same thread, without progress tracker.
            bool UseDifferentThread = false;

            PartnerFind.PerformSearch(CriteriaData, true, UseDifferentThread);

            // NOTE from AlanP - Dec 2015:
            // If CriteriaRow.ExactPartnerKeyMatch is false and the value of APartnerKey is, say, 0012345600 the search will return all partners between
            //  001234500 and 001234599.  This means that if we request 50 records we may not actually get the partnerkey record we asked for.
            Int32       TotalRecords;
            short       TotalPages;
            const short MaxRecords = 50;

            PartnerFindTDS result = new PartnerFindTDS();

            DataTable typedResult = PartnerFind.GetDataPagedResult(0, MaxRecords, out TotalRecords, out TotalPages);

            if (typedResult != null)
            {
                result.SearchResult.Merge(typedResult);

                if (TotalRecords > MaxRecords)
                {
                    // TODO load all data into the datatable. the webconnector does not have paging yet?
                    // See above NOTE if ExactPartnerMatch is false!
                }
            }

            return(result);
        }
コード例 #4
0
        public static PartnerFindTDSSearchResultTable FindPartners(
            string APartnerKey,
            string AFirstName,
            string AFamilyNameOrOrganisation,
            string AStreetName,
            string ACity,
            string APostCode,
            string AEmailAddress,
            string APartnerClass,
            bool AActiveOnly,
            string ASortBy,
            Int16 AMaxRecords,
            out Int32 ATotalRecords,
            out TVerificationResultCollection AVerificationResult)
        {
            TPartnerFind PartnerFind = new TPartnerFind();

            AVerificationResult = new TVerificationResultCollection();
            ATotalRecords       = -1;

            PartnerFindTDSSearchCriteriaTable CriteriaData = new PartnerFindTDSSearchCriteriaTable();
            PartnerFindTDSSearchCriteriaRow   CriteriaRow  = CriteriaData.NewRowTyped();

            CriteriaData.Rows.Add(CriteriaRow);
            CriteriaRow.PartnerName = "%" + AFamilyNameOrOrganisation + "%";

            if (APartnerKey.Length > 0)
            {
                Int64 PartnerKey = -1;

                if (!Int64.TryParse(APartnerKey, out PartnerKey))
                {
                    AVerificationResult.Add(new TVerificationResult("error", "Invalid Contact Key", "error_invalid_contact_key", TResultSeverity.Resv_Critical));

                    return(new PartnerFindTDSSearchResultTable());
                }

                CriteriaRow.PartnerKey           = PartnerKey;
                CriteriaRow.ExactPartnerKeyMatch = false;
            }

            // CriteriaRow.PersonalName = AFirstName;
            CriteriaRow.City     = ACity;
            CriteriaRow.Address2 = AStreetName;
            CriteriaRow.Email    = AEmailAddress;

            // TODO: only works for one partner class at the moment
            if (APartnerClass.Length > 0)
            {
                CriteriaRow.PartnerClass = APartnerClass;
            }
            else
            {
                CriteriaRow.PartnerClass = "*";
            }

            if (APostCode.Length > 0)
            {
                CriteriaRow.PostCode = APostCode;
            }

            if (AActiveOnly)
            {
                CriteriaRow.PartnerStatus = MPartnerConstants.PARTNERSTATUS_ACTIVE;
            }
            else
            {
                CriteriaRow.PartnerStatus = "*";
            }

            CriteriaRow.SortBy = ASortBy;

            // call this in the same thread, without progress tracker.
            bool UseDifferentThread = false;

            PartnerFind.PerformSearch(CriteriaData, true, UseDifferentThread);

            Int32 TotalRecords;
            Int16 TotalPages;

            if (AMaxRecords <= 0)
            {
                AMaxRecords = 32767;
            }

            DataTable typedResult = PartnerFind.GetDataPagedResult(0, AMaxRecords, out TotalRecords, out TotalPages);

            // tell the web client how many records have been found
            ATotalRecords = TotalRecords;

            return((PartnerFindTDSSearchResultTable)typedResult);
        }
コード例 #5
0
 /// <summary>
 /// Procedure to execute a Find query. Although the full
 /// query results are retrieved from the DB and stored internally in an object,
 /// data will be returned in 'pages' of data, each page holding a defined number
 /// of records.
 ///
 /// </summary>
 /// <param name="ACriteriaData">HashTable containing non-empty Partner Find parameters</param>
 /// <param name="ADetailedResults">Returns more (when true) or less (when false) columns
 /// </param>
 public void PerformSearch(DataTable ACriteriaData, bool ADetailedResults)
 {
     FPartnerFind.PerformSearch(ACriteriaData, ADetailedResults);
 }