/// <summary> /// Get list of affiliation or loyalty tier identifiers. /// </summary> /// <param name="transaction">Current transaction.</param> /// <returns>List of affiliation or loyalty tier identifiers.</returns> public static IEnumerable <AffiliationLoyaltyTier> GetAffiliationLoyalTierIds(SalesTransaction transaction) { List <AffiliationLoyaltyTier> affiliationLoyaltyTiers = new List <AffiliationLoyaltyTier>(); if (transaction != null) { IList <SalesAffiliationLoyaltyTier> salesAffiliationLoyaltyTiers = transaction.AffiliationLoyaltyTierLines; if (salesAffiliationLoyaltyTiers != null) { foreach (SalesAffiliationLoyaltyTier salesAffiliationLoyaltyTier in salesAffiliationLoyaltyTiers) { AffiliationLoyaltyTier oneAffiliationLoyaltyTier = new AffiliationLoyaltyTier() { AffiliationId = salesAffiliationLoyaltyTier.AffiliationId, LoyaltyTierId = salesAffiliationLoyaltyTier.LoyaltyTierId }; affiliationLoyaltyTiers.Add(oneAffiliationLoyaltyTier); } } } return(affiliationLoyaltyTiers); }
/// <summary> /// Adds or updates the reason code lines for affiliation line. /// </summary> /// <param name="salesAffiliationLoyaltyTier">The sales affiliation line.</param> /// <param name="affiliationLoyaltyTier">The cart affiliation line.</param> /// <param name="transactionId">The transaction id.</param> public static void AddOrUpdateReasonCodeLinesOnAffiliationLine(SalesAffiliationLoyaltyTier salesAffiliationLoyaltyTier, AffiliationLoyaltyTier affiliationLoyaltyTier, string transactionId) { ThrowIf.Null(salesAffiliationLoyaltyTier, "salesAffiliationLoyaltyTier"); ThrowIf.Null(affiliationLoyaltyTier, "affiliationLoyaltyTier"); ThrowIf.NullOrWhiteSpace(transactionId, "transactionId"); if (affiliationLoyaltyTier.ReasonCodeLines.Any()) { AddOrUpdateReasonCodeLinesHelper( reasonCodeLinesToUpdate: salesAffiliationLoyaltyTier.ReasonCodeLines, reasonCodeLines: affiliationLoyaltyTier.ReasonCodeLines, transactionId: transactionId, parentLineId: salesAffiliationLoyaltyTier.AffiliationId.ToString(CultureInfo.InvariantCulture), reasonCodeLineType: ReasonCodeLineType.Affiliation); } }