/// <summary> /// Initializes a new instance of the <see cref="ContactAccess"/> class. /// </summary> /// <param name="serverName"> The name of the CRM server to use. </param> /// <param name="configurationData"> The configuration data structure with extended configuration data. </param> public ContactAccess(string serverName, ContactClientConfigurationData configurationData) { this.ServerName = serverName; this.Configuration = configurationData; if (this.Configuration.PageSize == 0) { this.Configuration.PageSize = 100; } }
public DialogResult ShowDialog(ContactClientConfigurationData theData) { this.PageSize.Text = theData.PageSize.ToString(CultureInfo.CurrentCulture); this.ReadAllAttributes.Checked = theData.GetAllAttributes; this.IgnoreCertificateErrors.Checked = theData.IgnoreCertificateErrors; if (theData.FilterList != null) { this.Filter.Items.AddRange((from x in theData.FilterList select x.Key + " : " + x.Value).ToArray()); } // read filter-properties from ContactQuery and AccountQuery var fieldsList = new List <string>(); fieldsList.AddRange((from x in Tools.GetPropertyList(typeof(ContactSR.ContactQuery)) orderby x select Utils.ExtractPropertyName(x, "Contact")).Distinct()); fieldsList.AddRange((from x in Tools.GetPropertyList(typeof(AccountSR.AccountQuery)) orderby x select Utils.ExtractPropertyName(x, "Account")).Distinct()); fieldsList.AddRange((from x in Tools.GetPropertyList(typeof(ActivitySR.Activity)) orderby x select Utils.ExtractPropertyName(x, "Activity")).Distinct()); this.Field.Items.AddRange(fieldsList.ToArray()); var result = this.ShowDialog(); if (result == DialogResult.OK) { theData.PageSize = int.Parse(this.PageSize.Text, CultureInfo.InvariantCulture); theData.GetAllAttributes = this.ReadAllAttributes.Checked; theData.IgnoreCertificateErrors = this.IgnoreCertificateErrors.Checked; theData.FilterList = new List <KeyValuePair>(); foreach (var item in this.Filter.Items) { theData.FilterList.Add(Utils.SplitToKeyValuePair(item.ToString())); } if (this.filterForTestAccount.Checked) { theData.FilterList.Add(new KeyValuePair(@"Account.AccountName", @"= 'Z. SDX AG (Test)'")); } if (this.filterForMapAccounts.Checked) { theData.FilterList.Add(new KeyValuePair(@"Account.CustomBoolean14", @"= 'Y'")); } } return(result); }
/// <summary> /// Gets the extended configuration or default values (in case of <paramref name="clientFolderName"/> not being a /// serialized set of extended configuration properties) /// </summary> /// <param name="clientFolderName"> The client folder name specification of the extended configuration as xml. </param> /// <returns> the extended configuration object </returns> private ContactClientConfigurationData GetConfigurationData(string clientFolderName) { ContactClientConfigurationData contactClientConfigurationData; if (clientFolderName.StartsWith("<", StringComparison.Ordinal)) { contactClientConfigurationData = Tools.LoadFromString <ContactClientConfigurationData>(clientFolderName); } else { contactClientConfigurationData = new ContactClientConfigurationData(clientFolderName) { GetAllAttributes = this.GetConfigValueBoolean("GetAllAttributes"), PageSize = this.GetConfigValueInt("PageSize", 100) }; } return(contactClientConfigurationData); }