我会尽量不长时间地提出这个问题。我正在为酒店发送电子邮件确认函。
问题是,只有ArrivalDateTime
和DepartureDateTime
给出了电子邮件中的输出。 orderRooms
和orderTotalAmmount
未在电子邮件中提供任何输出。代码编译正常,但我没有在int
怎么可能?
ArrivalDateTime:打印ArrivalDateTime
DepartureDateTime:打印DepartureDateTime
房间总数:不打印orderRooms
总价:不打印orderTotalAmmount
<!-- ArrivalDateTime -->
@{
var orderArrivalDateTime = Model.Order.ArrivalDateTime.ToString("dddd d. MMMM yyyy", new System.Globalization.CultureInfo("da-DK"));
var order2ArrivalDateTime = Model.Order2.ArrivalDateTime.ToString("dddd d. MMMM yyyy", new System.Globalization.CultureInfo("da-DK"));
bool hasChangedArrivalDateTime = orderArrivalDateTime != order2ArrivalDateTime;
}
<!-- DepartureDateTime -->
@{
var orderDepartureDateTime = Model.Order.DepartureDateTime.ToString("dddd d. MMMM yyyy", new System.Globalization.CultureInfo("da-DK"));
var order2DepartureDateTime = Model.Order2.DepartureDateTime.ToString("dddd d. MMMM yyyy", new System.Globalization.CultureInfo("da-DK"));
bool hasChangedDepartureDateTime = orderDepartureDateTime != order2DepartureDateTime;
}
<!-- Total number of rooms -->
@{
var orderRooms = Model.Order.OrderLines.Count;
var order2Rooms = Model.Order2.OrderLines.Count;
bool hasChangedorderRooms = orderRooms != order2Rooms;
}
<!-- Total price -->
@{
var orderTotalAmmount = Model.Order.TotalAmount;
var order2TotalAmmount = Model.Order2.TotalAmount;
bool hasChangedorderTotalAmmount = orderTotalAmmount != order2TotalAmmount;
}
HTML
<!-- ArrivalDateTime -->
<table align="center" class="wrapper header float-center">
<tr>
<td class="wrapper-inner">
@renderOrderPropertyBlock(hasChangedArrivalDateTime, "Arrival", orderArrivalDateTime, order2ArrivalDateTime)
</td>
</tr>
</table>
<!-- DepartureDateTime -->
<table align="center" class="wrapper header float-center">
<tr>
<td class="wrapper-inner">
@renderOrderPropertyBlock(hasChangedDepartureDateTime, "Departure", orderDepartureDateTime, order2DepartureDateTime)
</td>
</tr>
</table>
<!-- Total number of rooms -->
<table align="center" class="wrapper header float-center">
<tr>
<td class="wrapper-inner">
@renderOrderPropertyBlock(hasChangedorderRooms, "Number of nights", orderRooms, order2Rooms)
</td>
</tr>
</table>
<!-- Total price -->
<table align="center" class="wrapper header float-center">
<tr>
<td class="wrapper-inner">
@renderOrderPropertyBlock(hasChangedorderTotalAmmount, "Total price", orderTotalAmmount, order2TotalAmmount)
</td>
</tr>
</table>
还有更多代码,但这应该是要显示的相关代码。
答案 0 :(得分:2)
您在整数末尾缺少.ToString()
。
更新您的代码以使用
@renderOrderPropertyBlock(hasChangedorderRooms, "Number of nights", orderRooms.ToString(), order2Rooms.ToString())
@renderOrderPropertyBlock(hasChangedorderTotalAmmount, "Total price", orderTotalAmmount.ToString(), order2TotalAmmount.ToString())