visit
Hi {CUSTOMERNAME},
<br />
Your order #{ORDERID} is confirmed and will be shipped out of our warehouse on {SHIPMENTDATE}
<br />
<b>Total Details</b><br />
Number of items: {NBOFITEMS}<br />
Total amount: {TOTALAMOUNT}
<br /><br />
Items:
{LISTOFITEMS}
A Placeholder Attribute requires the placeholder value (string) used in the text and optional the format (string)
using CodeHelper.Core.PlaceHolder;
public class OrderInfo
{
[Placeholder("{ORDERID}")]
public Int64 ID { get; set; }
public Int64 CustomerID { get; set; }
[Placeholder("{CUSTOMERNAME}")]
public string CustomerName { get; set; } ="";
[Placeholder("{SHIPMENTDATE}", "MMM dd, yyyy")]
public DateTime DateShipmentDate { get; set; }
public DateTime DateOrder{ get; set; }
[Placeholder("{NBOFITEMS}", "#,##0")]
public int NbShippedItems { get { return ShippedItemDescriptions.Count; } }
[Placeholder("{TOTALAMOUNT}", "#,###,##0.00")]
public double TotalAmount { get; set; }
[Placeholder("{LISTOFITEMS}")]
public List<string> ShippedItemDescriptions { get; set; } = new();
public OrderInfo() { }
}
using CodeHelper.Core.PlaceHolder;
//-- get the order info
OrderInfo _order = new() { ID = 99876, DateShipmentDate = DateTime.Today.AddDays(1)
, TotalAmount = 1234.50
, CustomerID=333
, CustomerName ="CodeHelper"
, DateOrder= DateTime.Today };
_order.ShippedItemDescriptions.Add("Product Description #1");
_order.ShippedItemDescriptions.Add("Product Description # 2");
_order.ShippedItemDescriptions.Add("Product Description # 3");
//-- Get The Confirmation Email Text
string emailBody = Resources.Translations.EmailConfirmOrder
//-- Replace the placeholder inside the text with the values of
//-- the _order object
emailBody = emailBody.Replace(_order, false, FormatTypes.HTML);
Hi CodeHelper,<br />
Your order #99876 is confirmed and will be shipped out of our warehouse on Sept 09, 2022
<br />
<b>Total Details</b><br />
Number of items: 3<br />
Total amount: 1,234.50
<br /><br />
Items:
<ul>
<li>Product Description #1</li>
<li>Product Description # 2</li>
<li>Product Description # 3</li>
</ul>