<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>UltimateTemplateEngine Web Demonstration</title>
    <link rel="Stylesheet" href="Css/Styles.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="templatecontent">
            <div class="header">
                <a href="http://www.componentpro.com">
                    <img src="Css/Logo.gif" /></a>
            </div>
            This web application will illustrate how to use UltimateTemplateEngine in a Web Application.<br />
<br /><b>How to use:</b><ul>
<li><b>Template Content</b>: The template content that will be use to generate.</li>
</ul>
    <div style="padding-bottom:5px">
        <table border="0" cellspacing="0" cellpadding="3">
            <tr>
                <td style="white-space:nowrap;vertical-align:top"><b>Template Content:</b></td>
                <td width=100%>
                <asp:Label ID="lblSource" runat="server" Font-Names="Courier New">
                Dear $User.FullName$,<br>
<br>
At the time you placed your order, reference number $OrderId$, we agreed that you would provide payment in advance. Although we have completed the order, we are withholding delivery because we have not yet received your payment. Once we receive payment, we will ship your order. {%set orders=User.GetOrders() /}<br>
<br>
For your convenience, below is the details of your order:<br>
#&nbsp;&nbsp;&nbsp;Part&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Price(per&nbsp;unit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sub&nbsp;Total<br>
{%set Total=0.0 /}{%foreach orderproduct,i in orders%}{%set Total = Total + orderproduct.Price * orderproduct.Quantity/}<br>
{%rendertemplate orderproducttemplate item=orderproduct/}{$foreach%}<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total: $PadLeft(Format(Total,"$$#.##"),11,"&nbsp;")$
<br>
If you have any concern, please call us at 913-555-0115.<br>
<br>
Thank you for your prompt attention to this matter.<br>
<br>
Sincerely,<br>
<br>
$CompanyName$<br>
<br>
{%template orderproducttemplate%}$PadLeft(i,4,"&nbsp;")$$PadLeft(item.PartId, 7,"&nbsp;")$&nbsp;&nbsp;&nbsp;&nbsp;$PadRight(item.ProductName, 15,"&nbsp;")$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$PadRight(item.Quantity, 5,"&nbsp;")$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$PadLeft(Format(item.Price,"$$#.##"), 7,"&nbsp;")$&nbsp;&nbsp;&nbsp;$PadLeft(Format(item.Price*item.Quantity,"$$#.##"), 12,"&nbsp;")${$template%}
</asp:Label></td>
            </tr>
            <tr><td></td></tr>
            <tr>
                <td style="white-space:nowrap;vertical-align:top;">Output:</td><td><asp:Label ID="lblResult" runat="server" CssClass="bodytext" Font-Names="Courier New"></asp:Label></td>
            </tr>
            <tr><td colspan="2"><asp:Button CssClass="okbutton" ID="btnGenerate" runat="server" Text="Generate" OnClick="btnGenerate_Click"/></td></tr>
        </table>
        </div>                
    </div>
    </form>
</body>
</html>