コード例 #1
0
    /// <summary>
    /// Loads the potential matches.
    /// </summary>
    private void LoadPotentialMatches()
    {
        if (Mode.Value == "Load")
        {
            Mode.Value = "View";

            SetActiveFilters();
            if (UpdateIndex.Value == "True")
            {
                DuplicateProvider.RefreshIndexes(false);
                UpdateIndex.Value = "False";
            }
            DuplicateProvider.FindMatches();
            MatchResults matchResults = DuplicateProvider.GetMatchResults();
            if (matchResults != null)
            {
                DataTable dataTable    = GetPotentialMatchesLayout();
                DataTable accountTable = GetPotentialAccountMatchesLayout();

                string leadType    = GetLocalResourceObject("lblLeads.Caption").ToString();
                string contactType = GetLocalResourceObject("lblContacts.Caption").ToString();

                matchResults.HydrateResults();
                foreach (MatchResultItem resultItem in matchResults.Items)
                {
                    if (typeof(ILead).Equals(resultItem.EntityType))
                    {
                        AddLeadEntityToDataSource(dataTable, resultItem, leadType);
                    }
                    else if (typeof(IContact).Equals(resultItem.EntityType))
                    {
                        AddContactEntityToDataSource(dataTable, resultItem, contactType);
                    }
                    else if (typeof(IAccount).Equals(resultItem.EntityType))
                    {
                        AddAccountEntityToDataSource(accountTable, resultItem);
                    }
                }
                grdMatches.DataSource        = dataTable;
                grdAccountMatches.DataSource = accountTable;
            }
            grdMatches.DataBind();
            grdAccountMatches.DataBind();
        }
        else
        {
            grdMatches.DataBind();
            grdAccountMatches.DataBind();
        }
    }
コード例 #2
0
    /// <summary>
    /// Loads the potential matches.
    /// </summary>
    private void LoadPotentialMatches()
    {
        if (Mode.Value == "Load")
        {
            Mode.Value = "View";
            SetActiveFilters();
            if (UpdateIndex.Value == "True")
            {
                DuplicateProvider.RefreshIndexes(false);
                UpdateIndex.Value = "False";
            }
            DuplicateProvider.FindMatches();
            MatchResults matchResults = DuplicateProvider.GetMatchResults();
            if (matchResults != null)
            {
                DataTable dataTable        = GetPotentialMatchesLayout();
                DataTable accountDataTable = GetAccountLayout();

                ILead    lead;
                IContact contact;
                IAccount account;
                string   leadType    = GetLocalResourceObject("lblLeads.Caption").ToString();
                string   contactType = GetLocalResourceObject("lblContacts.Caption").ToString();

                matchResults.HydrateResults();
                foreach (MatchResultItem resultItem in matchResults.Items)
                {
                    if (resultItem.EntityType == typeof(ILead))
                    {
                        try
                        {
                            lead = resultItem.Data as ILead;
                            dataTable.Rows.Add(lead.Id.ToString(), "Lead", resultItem.Score, leadType, lead.Company, lead.FirstName,
                                               lead.LastName, lead.Title, lead.Email, lead.Address.LeadCtyStZip, lead.WorkPhone);
                        }
                        catch
                        {
                        }
                    }
                    else if (resultItem.EntityType == typeof(IContact))
                    {
                        try
                        {
                            contact = resultItem.Data as IContact;
                            dataTable.Rows.Add(contact.Id.ToString(), "Contact", resultItem.Score, contactType, contact.Account.AccountName,
                                               contact.FirstName, contact.LastName, contact.Title, contact.Email, contact.Address.CityStateZip,
                                               contact.WorkPhone);
                        }
                        catch
                        {
                        }
                    }
                    else if (resultItem.EntityType == typeof(IAccount))
                    {
                        try
                        {
                            account = resultItem.Data as IAccount;
                            accountDataTable.Rows.Add(account.Id.ToString(), resultItem.Score, account.AccountName,
                                                      account.MainPhone, account.WebAddress, account.Industry, account.Address.CityStateZip,
                                                      account.Type);
                        }
                        catch
                        {
                        }
                    }
                }
                grdMatches.DataSource        = dataTable;
                grdAccountMatches.DataSource = accountDataTable;
            }
            grdMatches.DataBind();
            grdAccountMatches.DataBind();
        }
        else
        {
            grdMatches.DataBind();
            grdAccountMatches.DataBind();
        }
    }