@*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@ @using System.Linq; @using System; @using System.Web; @using System.Collections.Generic; @using System.Linq; @using Tessitura.Service.Client.Templates; @using Tessitura.Service.Client.Web; @using Tessitura.Service.Client.CRM; @using Tessitura.Service.Client.Txn; @using System.Globalization; @using Tessitura.Service.Client.CRM; @using System.Text.RegularExpressions; @using Tessitura.Service.Client.Custom; @using Tessitura.Service.Client.Utils; @{ var hasConstituent = Model.OrderProductView.Constituent != null; var hasAddress = Model.Address != null; var hasElectronicAddress = Model.ElectronicAddress != null; var hasBooking = Model.Booking != null; var isInSpecialConstituency = false; var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!"; var constituency = Model.GetPropertyValue("Constituency") ?? "FRC"; var hasState = hasAddress && Model.Address.State != null; var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0; var hasPaymentPlans = Model.OrderProductView.PaymentPlans != null && Model.OrderProductView.PaymentPlans.Count > 0; var hasPayments = Model.OrderProductView.Payments != null && Model.OrderProductView.Payments.Count > 0; var PaymentPlans = "Non"; } @if (hasConstituent) { var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true"; var constituencies = Model.RestClient.AtUrl(url).Get().ResponseObject; isInSpecialConstituency = constituencies != null && (constituencies as Constituencies).Count(x => x.ConstituencyType.ShortDescription == constituency) > 0; } @if (hasProducts) { var perfs = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Performance"); var packages = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Package"); var contributions = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Contribution"); var contributionTotal = contributions.Sum(x => x.Contribution.Amount); var memberships = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Membership"); var membershipTotal = memberships.Sum(x => x.Membership.Amount); var giftCertificates = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Gift Certificate"); var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount); var subTotal = string.Format("{0:n2}", Model.OrderProductView.TotalPurchaseAmount + Model.OrderProductView.TotalContributionAmount); /* PERFORMANCES */ // If the order has performances, loop through them and display them in a table if (perfs != null && perfs.Count() > 0) { } /* PACKAGES */ // If the order has packages, loop through them and display them in a table if (packages != null && packages.Count() > 0) { } /* CONTRIBUTIONS */ // If the order has contributions, loop through them and display them in a table if (contributions != null && contributions.Count() > 0) { } if (memberships != null && memberships.Count() > 0) { } if (giftCertificates != null && giftCertificates.Count() > 0) { } } @if (hasBooking) { }
@{ var state = hasState ? ", " + Model.Address.State.StateCode : ""; var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : ""; }

Merci pour votre achat!

Date de la commande: @Model.OrderProductView.OrderDateTime.ToString("yyyy-MM-dd") @ToFrenchCanadianTimeString(Model.OrderProductView.OrderDateTime);
Numéro de la commande: @Model.OrderProductView.Id
@if (hasConstituent) { Numéro de compte: @Model.OrderProductView.Constituent.Id

}

SVP conserver ce reçu pour référence.

Information de votre compte:
@if (isInSpecialConstituency) { @constituencyMessage
} @if (hasConstituent) { @Model.OrderProductView.Constituent.DisplayName
} @if (hasAddress) { @Model.Address.Street1
@Model.Address.City@state @: @Model.Address.PostalCode
} @electronicAddress
@if (hasProducts) { var giftCertificatesDeliveryMethod = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Gift Certificate"); /* Delivery method - suppress for Gift certs */ if (giftCertificatesDeliveryMethod != null && giftCertificatesDeliveryMethod.Count() > 0) { @* show nothing in delivery info area *@ } else { @if (Model.OrderProductView.DeliveryMethod.Id == -1) { @* DM: Hold at Box Office *@ Maintien à la billetterie

} else if (Model.OrderProductView.DeliveryMethod.Id == 2) { @* DM: Print at Home *@ Vous avez choisi les billets à imprimer à la maison
Vous recevrez un courriel lorsque vos billets seront prêts.
} else if (Model.OrderProductView.DeliveryMethod.Id == 3) { @* DM: Tickets in Hand *@ Vos billets ont été imprimés à la billetterie du CNA
} else if (Model.OrderProductView.DeliveryMethod.Id == 5) { @* DM: Digital Tickets *@ Vous avez choisi les billets numériques
Merci de faire un geste pour la planète!
} else if (Model.OrderProductView.DeliveryMethod.Id == 1 && hasAddress) { @* DM: Standard Mail *@ Informations d’expédition de la commande
@Model.Address.Street1
@Model.Address.City@state  @Model.Address.PostalCode
} } }
Représentations
@{ var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue); } @foreach (var product in perfs) { var performance = product.Performance.LineItem.Performance; var performanceType = performance.Type.Id; var performanceDateTime = performance.PerformanceDateTime.ToString(); var parsedDate = DateTime.Parse(performanceDateTime, CultureInfo.InvariantCulture).ToString("yyyy-MM-dd "); var isTimedEntryPerf = performanceType != null && performanceType.ToString() == "7"; var priceZoneDescription = ""; var priceTypeDesc = GetPriceTypesDescription(product.Performance.LineItem.SubLineItems); foreach (var subLineItem in product.Performance.LineItem.SubLineItems){ priceZoneDescription = subLineItem.Zone.Description; } }
Description Section Rangée Siège Prix Total
@performance.Description
@performance.Facility.Description
@if(@isTimedEntryPerf){ Date: @parsedDate
Heure d'entrée: @priceZoneDescription } else{ @parsedDate @ToFrenchCanadianTimeString(performance.PerformanceDateTime); }
@Raw(priceTypeDesc) @foreach (var subLineItem in product.Performance.LineItem.SubLineItems) { var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @seatSection
}
@foreach (var subLineItem in product.Performance.LineItem.SubLineItems) { var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Row) ? "TBD" : subLineItem.Seat.Row; var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @if(@seatSection != "GA - AG"){ @seatRow
} }
@foreach (var subLineItem in product.Performance.LineItem.SubLineItems) { var seatNumber = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Number; var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @if(@seatSection != "GA - AG"){ @seatNumber
} }
@foreach (var subLineItem in product.Performance.LineItem.SubLineItems) { var amount = string.Format("{0:n2}", subLineItem.DueAmount); @amount $
}
@string.Format("{0:n2}", product.Performance.LineItem.TotalDue) $
Coût total des billets: @string.Format("{0:n2}", performanceTotal) $
Forfaits
@{ var packageTotal = packages.Sum(x => x.Package.LineItems.Sum(y => y.TotalDue)); } @foreach (var product in packages) { foreach (var lineItem in product.Package.LineItems) { if (lineItem.Performance == null) { } else { var performance = lineItem.Performance; var performanceType = performance.Type.Id; var performanceDateTime = performance.PerformanceDateTime.ToString(); var parsedDate = DateTime.Parse(performanceDateTime, CultureInfo.InvariantCulture).ToString("yyyy-MM-dd "); var isTimedEntryPerf = performanceType != null && performanceType.ToString() == "7"; var priceZoneDescription = ""; foreach (var subLineItem in lineItem.SubLineItems){ priceZoneDescription = subLineItem.Zone.Description; } } } }
Description Section Rangée Siège Prix Total
@lineItem.Package.Description
@performance.Description
@performance.Facility.Description
@if(@isTimedEntryPerf){ Date: @parsedDate
Heure d'entrée: @priceZoneDescription } else{ @performance.PerformanceDateTime }
@foreach (var subLineItem in lineItem.SubLineItems) { var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @seatSection
}
@foreach (var subLineItem in lineItem.SubLineItems) { var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row; var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @if(@seatSection != "GA - AG"){ @seatRow
} }
@foreach (var subLineItem in lineItem.SubLineItems) { var seatNumber = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Number; var seatSection = string.IsNullOrEmpty(subLineItem.Seat.Section.ShortDescription) ? "TBD" : subLineItem.Seat.Section.ShortDescription; @if(@seatSection != "GA - AG"){ @seatNumber
} }
@foreach (var subLineItem in lineItem.SubLineItems) { var amount = string.Format("{0:n2}", subLineItem.DueAmount); @amount $
}
@string.Format("{0:n2}", lineItem.TotalDue) $
Coût total du forfait: @string.Format("{0:n2}", packageTotal) $
Total des billet(s) d'abonnement: @string.Format("{0:n2}", packageTotal) $
Total des billet(s) supplémentaires: @string.Format("{0:n2}", Model.OrderProductView.TotalPurchaseAmount - packageTotal) $
Contributions
@foreach (var contribution in contributions) { }
Description Total
@contribution.Contribution.Fund.Description @string.Format("{0:n2}", contribution.Contribution.Amount) $
Coût total des contributions: @string.Format("{0:n2}", contributionTotal) $
Adhésions
@foreach (var membership in memberships) { }
Description Total
@membership.Membership.MembershipLevel.Description @string.Format("{0:n2}", membership.Membership.Amount) $
Coût total des adhésions: @string.Format("{0:n2}", membershipTotal) $
Cartes cadeaux numériques
@foreach (var giftCertificate in giftCertificates) { var amount = -giftCertificate.GiftCertificate.Amount; }
Description Total
Code de carte cadeau numérique: @giftCertificate.GiftCertificate.GiftCertificateNumber @string.Format("{0:n2}", amount) $
Coût total des cartes cadeaux numérique: @string.Format("{0:n2}", giftCertificateTotal) $
@if (hasPayments) { decimal paymentMethodCount = Model.OrderProductView.Payments.Count; decimal paymentMethodIndex = 0; string sum = ""; string paymentMethod = ""; string last4 = ""; }
Sous-total de la commande: @subTotal $
Frais de traitement: @string.Format("{0:n2}", Model.OrderProductView.TotalFeeAmount) $
Total: @string.Format("{0:n2}", Model.OrderProductView.TotalDueAmount) $
Total payé: @string.Format("{0:n2}", Model.OrderProductView.TotalPaidAmount) $
Solde dû: @string.Format("{0:n2}", Model.OrderProductView.TotalDueAmount - Model.OrderProductView.TotalPaidAmount) $
Mode(s) de paiement: @foreach (var paymentsByMethod in (Model.OrderProductView.Payments as OrderProductViewPayments).GroupBy(item => item.PaymentMethod.AliasDescription)) { paymentMethodIndex = paymentMethodIndex + 1; @foreach (var item in paymentsByMethod) { } }
@{ sum = string.Format("{0:n2}", item.Amount); paymentMethod = item.PaymentMethod.AliasDescription; if(item.LastFourCreditCardNumber != null){ last4 = item.LastFourCreditCardNumber; } if (@paymentMethod == "Gift Certificate"){ Cartes cadeaux numérique } else { @paymentMethod } if (@last4 != "") { (@last4) ; } @sum $ }
Plan de paiement? @if (hasPaymentPlans) { PaymentPlans = "Oui"; } @PaymentPlans
@if (Model.Booking.Assignments != null && Model.Booking.Assignments.Count > 0) { }
Enregistrement

@Model.Booking.Description

Confirmation: @Model.Booking.ConfirmationText

Ressources
@foreach (var assignment in @Model.Booking.Assignments) { var description = @assignment.Resource != null ? @assignment.Resource.Description : "TBD"; if (assignment.ConfirmationText != null) { } }
Type Description Comte Commencer Se termine
@assignment.ResourceType.Description @description @assignment.Schedule.Count @assignment.Schedule.StartDateTime @assignment.Schedule.EndDateTime
@assignment.ConfirmationText
@functions { public class FriendlyPriceTypes { public List Items; } public class FriendlyPriceType { public int id; public int price_type_id; public string description_fr; } public FriendlyPriceTypes GetFriendlyPriceTypeDescriptions() { var url = "Custom/LTR_MM_CUSTOM_PRICE_TYPE_DESCRIPTIONS"; var priceTypeDescriptions = Model.RestClient.AtUrl(url).WithContentType(ContentType.Json).Get().ResponseObject; return priceTypeDescriptions; } public string GetFriendlyPriceTypeName(string originalName, int priceTypeId, FriendlyPriceTypes priceTypeDescriptions) { var priceType = priceTypeDescriptions.Items.Find(x => x.price_type_id == priceTypeId); if(priceType == null) { return originalName; } return priceType.description_fr; } public string GetPriceTypesDescription(IEnumerable SubLineItems) { var sep = "
"; var seatsArray = new Dictionary>(); var priceTypeDescriptions = GetFriendlyPriceTypeDescriptions(); foreach (var SublineItem in SubLineItems) { if (SublineItem.PriceType.Id != null) { var priceTypeId = SublineItem.PriceType.Id; var subLineItemId = SublineItem.Id; var priceDescription = GetFriendlyPriceTypeName(SublineItem.PriceType.Description, priceTypeId, priceTypeDescriptions); if (!seatsArray.ContainsKey(subLineItemId)) { seatsArray[subLineItemId] = new List(); } seatsArray[subLineItemId].Add(string.Format("{0}", priceDescription)); } } var priceDescriptions = new List(); foreach (var seatInfo in seatsArray.Values) { priceDescriptions.Add(String.Format("{0}", seatInfo[0])); } return string.Join(sep, priceDescriptions); } public string ToFrenchCanadianTimeString(DateTime source) { if (source == null) throw new ArgumentNullException("source"); if (source.Minute > 0) return String.Format("{0: H} h {0:mm}", source); else return String.Format("{0: H} h", source); } }