if((select count(*) from dbo.pal_TemplateType where templateType = 'Purchases') = 0)
begin
INSERT INTO [dbo].[pal_TemplateType]
           ([templateType]
           ,[isActive]
           ,[sequence])
     VALUES
           ('Purchases'
           ,1
           ,8);
end;

if((select count(*) from dbo.pal_Template where templateName = 'WholesalerOrder To Wholesaler E-mail Template') = 0)
begin
INSERT INTO [dbo].[pal_Template]
           ([templateTypeId]
           ,[templateName]
           ,[templateContent])
     VALUES
           (8
           ,'WholesalerOrder To Wholesaler E-mail Template'
           ,'<!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Email Template</title>
        <style type="text/css">
            body {
            font-family:Trebuchet MS, Arial, Helvetica, sans-serif;
            font-size: 12px;
            }
        </style>
    </head>
    <body link="#BA4C14" alink="#BA4C14" class="RadEditorContentStyle">
        <div>
        <table style="border-collapse: collapse;" width="100%">
            <tbody>
                <tr>
                    <td align="right" valign="top">
                    <img alt="" src="/upload/image/{Logo Name}" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                    <br />
                    Hi there<br />
                    <br />
                    Please find attached a new Purchase Order.<br/><br/>
                    <strong>Order Number: </strong>{OrderNumber}<br/>
                    <strong>Order Date: </strong>{OrderDate}<br/>
                    <strong>Wholesaler: </strong>{WholesalerName}<br/><br/>
                    Order on behalf of:<br/>{RetailerName}<br/><br/>
                    Please respond to this email should you have any enquiries.
                     <br/> <br/>
                   
                    Kind regards,<br />
                    {CompanyName}<br />
                    <p>&nbsp;</p>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </body>
</html>');
end