Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomerPurchaseEntity"/> class.
        /// </summary>
        /// <param name="purchaseType">The purchase type.</param>
        /// <param name="id">Purchase ID.</param>
        /// <param name="customerId">The ID  of the customer who made the purchase.</param>
        /// <param name="subscriptionId">The subscription ID which the purchase applied to.</param>
        /// <param name="seatsBought">The number of seats bought in the purchase.</param>
        /// <param name="seatPrice">The seat price charged for the purchase.</param>
        /// <param name="transactionDate">The transaction date of the purchase.</param>
        public CustomerPurchaseEntity(CommerceOperationType purchaseType, string id, string customerId, string subscriptionId, int seatsBought, decimal seatPrice, DateTime transactionDate)
        {
            id.AssertNotEmpty(nameof(id));
            customerId.AssertNotEmpty(nameof(customerId));
            subscriptionId.AssertNotEmpty(nameof(subscriptionId));
            seatsBought.AssertPositive(nameof(seatsBought));
            seatPrice.AssertPositive(nameof(seatPrice));

            this.PurchaseType    = purchaseType;
            this.Id              = id;
            this.CustomerId      = customerId;
            this.SubscriptionId  = subscriptionId;
            this.SeatsBought     = seatsBought;
            this.SeatPrice       = seatPrice;
            this.TransactionDate = transactionDate;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves the localized operation type string.
        /// </summary>
        /// <param name="operationType">The Commerce operation type.</param>
        /// <returns>Localized Operation Type string.</returns>
        private static string GetOperationType(CommerceOperationType operationType)
        {
            switch (operationType)
            {
            case CommerceOperationType.AdditionalSeatsPurchase:
                return(Resources.CommerceOperationTypeAddSeats);

            case CommerceOperationType.NewPurchase:
                return(Resources.CommerceOperationTypeAddSubscription);

            case CommerceOperationType.Renewal:
                return(Resources.CommerceOperationTypeRenewSubscription);

            default:
                return(string.Empty);
            }
        }