<dataController name="Products" conflictDetection="overwriteChanges" xmlns="urn:schemas-codeontime-com:data-aquarium">
  <views>
    <view id="grid1" type="Grid" commandId="command1" label="Products">
      <headerText>This is a list of products. </headerText>
      <dataFields>
        <dataField fieldName="ProductName" columns="40" />
        <dataField fieldName="SupplierID" aliasFieldName="SupplierCompanyName" />
        <dataField fieldName="CategoryID" aliasFieldName="CategoryCategoryName" />
        <dataField fieldName="QuantityPerUnit" columns="20" />
        <dataField fieldName="UnitPrice" dataFormatString="c" columns="15" />
        <dataField fieldName="UnitsInStock" columns="15" />
        <dataField fieldName="UnitsOnOrder" columns="15" />
        <dataField fieldName="ReorderLevel" columns="15" />
        <dataField fieldName="Discontinued" />
      </dataFields>
    </view>
    <view id="editForm1" type="Form" commandId="command1" label="Review Products">
      <headerText>Please review products information below. Click Edit to change this record, click Delete to delete the record, or click Cancel/Close to return back.</headerText>
      <categories>
        <category headerText="Products">
          <description>These are the fields of the products record that can be edited.</description>
          <dataFields>
            <dataField fieldName="ProductName" columns="40" />
            <dataField fieldName="SupplierID" aliasFieldName="SupplierCompanyName" />
            <dataField fieldName="CategoryID" aliasFieldName="CategoryCategoryName" />
            <dataField fieldName="QuantityPerUnit" columns="20" />
            <dataField fieldName="UnitPrice" dataFormatString="c" columns="15" />
            <dataField fieldName="UnitsInStock" columns="15" />
            <dataField fieldName="UnitsOnOrder" columns="15" />
            <dataField fieldName="ReorderLevel" columns="15" />
            <dataField fieldName="Discontinued" />
          </dataFields>
        </category>
      </categories>
    </view>
    <view id="createForm1" type="Form" commandId="command1" label="New Products">
      <headerText>Please fill this form and click OK button to create a new products record. Click Cancel to return to the previous screen.</headerText>
      <categories>
        <category headerText="New Products">
          <description>Complete the form. Make sure to enter all required fields.</description>
          <dataFields>
            <dataField fieldName="ProductName" columns="40" />
            <dataField fieldName="SupplierID" aliasFieldName="SupplierCompanyName" />
            <dataField fieldName="CategoryID" aliasFieldName="CategoryCategoryName" />
            <dataField fieldName="QuantityPerUnit" columns="20" />
            <dataField fieldName="UnitPrice" dataFormatString="c" columns="15" />
            <dataField fieldName="UnitsInStock" columns="15" />
            <dataField fieldName="UnitsOnOrder" columns="15" />
            <dataField fieldName="ReorderLevel" columns="15" />
            <dataField fieldName="Discontinued" />
          </dataFields>
        </category>
      </categories>
    </view>
  </views>
  <commands>
    <command id="command1" type="Text">
      <text><![CDATA[
select
	"Products"."ProductID" "ProductID"
	,"Products"."ProductName" "ProductName"
	,"Products"."SupplierID" "SupplierID"
	,"Supplier"."CompanyName" "SupplierCompanyName"
	,"Products"."CategoryID" "CategoryID"
	,"Category"."CategoryName" "CategoryCategoryName"
	,"Products"."QuantityPerUnit" "QuantityPerUnit"
	,"Products"."UnitPrice" "UnitPrice"
	,"Products"."UnitsInStock" "UnitsInStock"
	,"Products"."UnitsOnOrder" "UnitsOnOrder"
	,"Products"."ReorderLevel" "ReorderLevel"
	,"Products"."Discontinued" "Discontinued"
from "dbo"."Products" "Products"
	left join "dbo"."Suppliers" "Supplier" on "Products"."SupplierID" = "Supplier"."SupplierID"
	left join "dbo"."Categories" "Category" on "Products"."CategoryID" = "Category"."CategoryID"
]]></text>
    </command>
    <command id="ProductIDIdentityCommand" type="Text" event="Inserted">
      <text>select @@identity</text>
      <output>
        <fieldOutput fieldName="ProductID" />
      </output>
    </command>
  </commands>
  <fields>
    <field name="ProductID" type="Int32" allowNulls="false" isPrimaryKey="true" label="Product#" readOnly="true" />
    <field name="ProductName" type="String" allowNulls="false" label="Product Name" />
    <field name="SupplierID" type="Int32" label="Supplier#">
      <items style="Lookup" dataController="Suppliers" />
    </field>
    <field name="SupplierCompanyName" type="String" readOnly="true" label="Supplier Company Name" />
    <field name="CategoryID" type="Int32" label="Category#">
      <items style="Lookup" dataController="Categories" />
    </field>
    <field name="CategoryCategoryName" type="String" readOnly="true" label="Category Name" />
    <field name="QuantityPerUnit" type="String" label="Quantity Per Unit" />
    <field name="UnitPrice" type="Decimal" default="((0))" label="Unit Price" />
    <field name="UnitsInStock" type="Int16" default="((0))" label="Units In Stock" />
    <field name="UnitsOnOrder" type="Int16" default="((0))" label="Units On Order" />
    <field name="ReorderLevel" type="Int16" default="((0))" label="Reorder Level" />
    <field name="Discontinued" type="Boolean" allowNulls="false" default="((0))" label="Discontinued" />
  </fields>
  <actions>
    <actionGroup scope="Grid">
      <action commandName="Select" commandArgument="editForm1" />
      <action commandName="Edit" />
      <action commandName="Delete" confirmation="Delete?" />
      <action whenLastCommandName="Edit" commandName="Update" headerText="Save" />
      <action whenLastCommandName="Edit" commandName="Cancel" />
    </actionGroup>
    <actionGroup scope="Form">
      <action commandName="Edit" />
      <action commandName="Delete" confirmation="Delete?" />
      <action commandName="Cancel" headerText="Close" />
      <action whenLastCommandName="Edit" commandName="Update" headerText="OK" />
      <action whenLastCommandName="Edit" commandName="Delete" confirmation="Delete?" />
      <action whenLastCommandName="Edit" commandName="Cancel" />
      <action whenLastCommandName="New" commandName="Insert" headerText="OK" />
      <action whenLastCommandName="New" commandName="Cancel" />
    </actionGroup>
    <actionGroup scope="ActionBar" headerText="New">
      <action commandName="New" commandArgument="createForm1" headerText="New Products" description="Create a new Products record." />
    </actionGroup>
    <actionGroup scope="ActionBar" headerText="Actions">
      <action commandName="Custom" commandArgument="ExportCsv" headerText="Export to Spreadsheet" description="Analyze items with spreadsheet&lt;br/&gt; application." cssClass="ExportCsv" />
      <action commandName="Custom" commandArgument="ExportRss" headerText="View RSS Feed" description="Syndicate items with an RSS reader." cssClass="ExportRss" />
      <action />
      <action commandName="Custom" commandArgument="MyCommand" headerText="My Command" description="Execute my custom command" />
    </actionGroup>
    <actionGroup scope="ActionBar" headerText="Record">
      <action whenLastCommandName="Edit" commandName="Update" headerText="Save" description="Save changes to the database." />
      <action whenLastCommandName="Edit" commandName="Cancel" description="Cancel all record changes." />
    </actionGroup>
  </actions>
</dataController>