<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Admin.Master" CodeBehind="ProductList.aspx.vb" Inherits="Superbowl.ProductList"
   Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
    .auto-style1 {
        height: 26px;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">

    <table width="100%" cellpadding="2">
      <tr>
         <td align="center" class="headings" colspan="4">Product List</td>
      </tr>
      <tr>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
      </tr>
      <tr>
         <td align="right" class="auto-style1">Product:</td>
         <td align="left" class="auto-style1">
            <asp:TextBox ID="txtProduct" runat="server"></asp:TextBox>
         </td>
         <td align="right" class="auto-style1">Brand:</td>
         <td align="left" class="auto-style1">
            <asp:DropDownList ID="ddlBrand" runat="server" DataSourceID="sdsBrand"
               DataTextField="strBrand" DataValueField="BrandID" Width="200px">
            </asp:DropDownList>
         </td>
      </tr>
      <tr>
         <td align="right">Status:</td>
         <td align="left">
            <asp:DropDownList ID="ddlStatus" runat="server" Width="160px">
               <asp:ListItem Value="-1" Selected="True">- All -</asp:ListItem>
               <asp:ListItem Value="1">Active</asp:ListItem>
               <asp:ListItem Value="0">Inactive</asp:ListItem>
            </asp:DropDownList>
         </td>
         <td align="right">&nbsp;</td>
         <td align="left" category:>
            <asp:DropDownList ID="ddlCategory" runat="server" DataSourceID="sdsCategory"
               DataTextField="strCategory" DataValueField="strCategory"
               Width="200px" Visible="false">
            </asp:DropDownList>

         </td>
      </tr>
      <tr>
         <td align="right">&nbsp;</td>
         <td align="left">&nbsp;</td>
         <td align="right">
            <asp:Button ID="btnSearch" runat="server" Text="Search" />
         </td>
         <td align="left">
            <asp:Button ID="btnAdd1" runat="server" Text="Add" />
         </td>
      </tr>
      <tr>
         <td align="right">&nbsp;</td>
         <td align="left">&nbsp;</td>
         <td align="right">&nbsp;</td>
         <td align="left">&nbsp;</td>
      </tr>
      <tr>
         <td align="left" colspan="4" style="border: 1px solid maroon">
            <asp:GridView ID="gvProduct" runat="server" Width="100%" CellPadding="2"
               AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
               DataSourceID="sdsProduct" PageSize="25" HeaderStyle-CssClass="gvHeader"
               DataKeyNames="strProdCode">
               <Columns>
                  <asp:BoundField DataField="#" HeaderText="#">
                     <HeaderStyle Width="1%" />
                     <ItemStyle Font-Size="Smaller" HorizontalAlign="Right" />
                  </asp:BoundField>
                  <asp:HyperLinkField DataNavigateUrlFields="strProdCode"
                     DataNavigateUrlFormatString="ProductDetails.aspx?PID={0}"
                     DataTextField="strProdCode" HeaderText="Code" SortExpression="strProdCode" />
                  <asp:BoundField DataField="strLongProdDesc" HeaderText="Product" SortExpression="strLongProdDesc" />
                  <asp:BoundField DataField="intSize" HeaderText="Size" SortExpression="intSize" />
                  <asp:BoundField DataField="intPack" HeaderText="Package" SortExpression="intPack" />
                  <asp:HyperLinkField DataNavigateUrlFields="refBrandID"
                     DataNavigateUrlFormatString="BrandDetails.aspx?BID={0}"
                     DataTextField="strBrand" HeaderText="Brand" SortExpression="strBrand"
                     Target="_blank" />
                  <asp:BoundField DataField="strLastUser" HeaderText="Last User" SortExpression="strLastUser" NullDisplayText="n/a">
                     <ItemStyle HorizontalAlign="Left" />
                  </asp:BoundField>
                  <asp:BoundField DataField="dtStamp" HeaderText="Last Edit" SortExpression="dtStamp" NullDisplayText="n/a">
                     <ItemStyle HorizontalAlign="Right" />
                  </asp:BoundField>
                  <asp:CommandField HeaderText="Delete" ShowDeleteButton="True">
                     <ItemStyle HorizontalAlign="Center" />
                  </asp:CommandField>
               </Columns>
               <HeaderStyle CssClass="gvHeader" />
               <AlternatingRowStyle CssClass="lightergrey" />
               <PagerSettings PageButtonCount="20" Mode="NumericFirstLast" FirstPageText="<B>&lt;&lt;</B>" LastPageText="<B>&gt;&gt;</B>" />
               <RowStyle CssClass="gvItem" />


            </asp:GridView>

            <asp:Label ID="lblMessage" CssClass="redBold" runat="server" Text=""></asp:Label>
            <asp:GridView ID="gvExport" runat="server"
               AlternatingRowStyle-CssClass="lightergrey" HeaderStyle-CssClass="gvHeader"
               SelectedRowStyle-CssClass="gvItem" CellPadding="0" Visible="False"
               DataSourceID="sdsProduct" AutoGenerateColumns="False">
               <Columns>
                  <asp:BoundField DataField="strProdCode" HeaderText="Prod Code" ReadOnly="True"
                     SortExpression="strProdCode" />
                  <asp:BoundField DataField="strLongProdDesc" HeaderText="Long Description"
                     SortExpression="strLongProdDesc" />
                  <asp:BoundField DataField="refBrandID" HeaderText="Brand ID"
                     SortExpression="refBrandID" />
                  <asp:BoundField DataField="strBrand" HeaderText="Brand"
                     SortExpression="strBrand" />
                  <asp:BoundField DataField="intSize" HeaderText="Size"
                     SortExpression="intSize" />
                  <asp:BoundField DataField="intPack" HeaderText="Package"
                     SortExpression="intPack" />
                  <asp:BoundField DataField="dblPrice" HeaderText="Price"
                     SortExpression="dblPrice" />
                  <asp:BoundField DataField="strType" HeaderText="Type"
                     SortExpression="strType" />
                  <asp:BoundField DataField="strType2" HeaderText="Type2"
                     SortExpression="strType2" />
                  <asp:BoundField DataField="intShortCode" HeaderText="Short Code"
                     SortExpression="intShortCode" />
                  <asp:BoundField DataField="strPriceSeg" HeaderText="PriceSeg"
                     SortExpression="strPriceSeg" />
                  <asp:BoundField DataField="blnActive" HeaderText="Active"
                     SortExpression="blnActive" />
                  <asp:BoundField DataField="dblFlat" HeaderText="Flat Conversion"
                     SortExpression="dblFlat" />
                  <asp:BoundField DataField="cwsicat" HeaderText="cwsicat" SortExpression="cwsicat" />
                  <asp:BoundField DataField="strPrincipalMaterialRefNum" HeaderText="Principal Material RefNum" SortExpression="strPrincipalMaterialRefNum" />
                  <asp:BoundField DataField="strPrincipalProdDesc" HeaderText="Principal ProdDesc" SortExpression="strPrincipalProdDesc" />
                  <asp:BoundField DataField="blnQF" HeaderText="QF" SortExpression="blnQF" />
                  <asp:BoundField DataField="strLastUser" HeaderText="Last User" SortExpression="strLastUser" />
                  <asp:BoundField DataField="dtStamp" HeaderText="Stamp" SortExpression="dtStamp" />
               </Columns>
               <SelectedRowStyle CssClass="gvItem" />
               <HeaderStyle CssClass="gvHeader" />
               <AlternatingRowStyle CssClass="lightergrey" />
            </asp:GridView>

         </td>
      </tr>
      <tr>
         <td align="left">
            <asp:CheckBox ID="chkResize" runat="server" AutoPostBack="True" CssClass="red" Text="Show 1000" /></td>
         <td align="left">&nbsp;</td>
         <td align="right">&nbsp;</td>
         <td align="left">&nbsp;</td>
      </tr>
      <tr>
         <td align="right">&nbsp;</td>
         <td align="left">&nbsp;</td>
         <td align="right">
            <asp:Button ID="btnExport" runat="server" Text="Export" /></td>
         <td align="left">
            <asp:Button ID="btnAdd2" runat="server" Text="Add" /></td>
      </tr>
   </table>

   <asp:SqlDataSource ID="sdsBrand" runat="server"
      ConnectionString="<%$ ConnectionStrings:csStockControl %>"
      SelectCommand="SELECT 0 as [BrandID], '- All -' as [strBrand]
UNION SELECT [BrandID], [strBrand] FROM [mstBrand] ORDER BY [strBrand]"></asp:SqlDataSource>

   <asp:SqlDataSource ID="sdsCategory" runat="server"
      ConnectionString="<%$ ConnectionStrings:csStockControl %>"
      SelectCommand="SELECT '- All -' AS strCategory UNION SELECT DISTINCT strCategory FROM mstProduct WHERE (strCategory &lt;&gt; N'') ORDER BY strCategory"></asp:SqlDataSource>

   <asp:SqlDataSource ID="sdsProduct" runat="server"
      ConnectionString="<%$ ConnectionStrings:csStockControl %>"
      SelectCommand="SELECT '' AS '#', mstProduct.strProdCode, mstProduct.strLongProdDesc, mstProduct.intSize, mstProduct.intPack, mstProduct.dblPrice, mstProduct.strType, mstProduct.strType2, mstProduct.intShortCode, mstProduct.strPriceSeg, mstProduct.strCategory, mstProduct.blnActive, mstProduct.dblFlat, mstProduct.cwsicat, mstProduct.strCategory2, mstProduct.strPrincipalMaterialRefNum, mstProduct.strPrincipalProdDesc, mstProduct.strLastUser, mstProduct.dtStamp, mstProduct.refBrandID, mstBrand.strBrand, mstBrand.blnActive AS blnBrandActive, mstProduct.blnQF FROM mstProduct LEFT OUTER JOIN mstBrand ON mstProduct.refBrandID = mstBrand.BrandID ORDER BY mstProduct.strProdCode"></asp:SqlDataSource>

</asp:Content>
