/// <summary> /// Determines the 'Primary' and/or 'Within Organisation' setting(s) for a Partner. /// </summary> /// <param name="APartnerKey">PartnerKey of the Partner.</param> /// <param name="AOverallContSettingKind">Specify the kind of Overall Contact Setting(s) that you want returned. /// Combine multiple ones with the binary OR operator ( | ).</param> /// <param name="APartnerAttributeDT">Contains the Partners' p_partner_attribute records. The ones that are /// 'Contact Details' have 'true' in the Column /// <see cref="Calculations.PARTNERATTRIBUTE_PARTNERCONTACTDETAIL_COLUMN"/>!</param> /// <returns>An instance of <see cref="Calculations.TPartnersOverallContactSettings"/> that holds the /// <see cref="Calculations.TPartnersOverallContactSettings"/> for the Partner. However, it returns null /// in case the Partner hasn't got any p_partner_attribute records, or when the Partner has no p_partner_attribute /// records that constitute Contact Detail records, or when the Partner has got only one p_partner_attribute record /// but this records' Current flag is false. It also returns null if no record was found that met what was asked for /// with <paramref name="AOverallContSettingKind"/>!</returns> public static Calculations.TPartnersOverallContactSettings GetPartnersOverallCS(Int64 APartnerKey, Calculations.TOverallContSettingKind AOverallContSettingKind, out PPartnerAttributeTable APartnerAttributeDT) { Calculations.TPartnersOverallContactSettings PrimaryContactAttributes = null; TDBTransaction ReadTransaction = null; PPartnerAttributeTable PartnerAttributeDT = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref ReadTransaction, delegate { // Load all PPartnerAttribute records of the Partner and put them into a DataTable PartnerAttributeDT = PPartnerAttributeAccess.LoadViaPPartner(APartnerKey, ReadTransaction); if (PartnerAttributeDT.Rows.Count > 0) { Calculations.DeterminePartnerContactDetailAttributes(PartnerAttributeDT); PrimaryContactAttributes = Calculations.DeterminePrimaryOrWithinOrgSettingsForPartner( PartnerAttributeDT, AOverallContSettingKind); if (((AOverallContSettingKind & Calculations.TOverallContSettingKind.ocskPrimaryContactMethod) == Calculations.TOverallContSettingKind.ocskPrimaryContactMethod) || ((AOverallContSettingKind & Calculations.TOverallContSettingKind.ocskSecondaryEmailAddress) == Calculations.TOverallContSettingKind.ocskSecondaryEmailAddress)) { if (PrimaryContactAttributes == null) { PrimaryContactAttributes = new Calculations.TPartnersOverallContactSettings(); } Calculations.DeterminePartnerSystemCategorySettings( PartnerAttributeDT, ref PrimaryContactAttributes, AOverallContSettingKind); } } }); APartnerAttributeDT = PartnerAttributeDT; return PrimaryContactAttributes; }
/// <summary> /// Determines the 'Primary' and/or 'Within Organisation' setting(s) for a Partner. /// </summary> /// <param name="APartnerKey">PartnerKey of the Partner.</param> /// <param name="AOverallContSettingKind">Specify the kind of Overall Contact Setting(s) that you want returned. /// Combine multiple ones with the binary OR operator ( | ).</param> /// <returns>An instance of <see cref="Calculations.TPartnersOverallContactSettings"/> that holds the /// <see cref="Calculations.TPartnersOverallContactSettings"/> for the Partner. However, it returns null /// in case the Partner hasn't got any p_partner_attribute records, or when the Partner has no p_partner_attribute /// records that constitute Contact Detail records, or when the Partner has got only one p_partner_attribute record /// but this records' Current flag is false. It also returns null if no record was found that met what was asked for /// with <paramref name="AOverallContSettingKind"/>!</returns> public static Calculations.TPartnersOverallContactSettings GetPartnersOverallCS(Int64 APartnerKey, Calculations.TOverallContSettingKind AOverallContSettingKind) { PPartnerAttributeTable PartnerAttributeDT; return GetPartnersOverallCS(APartnerKey, AOverallContSettingKind, out PartnerAttributeDT); }