<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Admin.Master" CodeBehind="CompanyList.aspx.vb" Inherits="Superbowl.CompanyList" 
    title="Untitled Page" EnableEventValidation="false"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
<table width="100%" cellpadding="2">
    <tr>
        <td align="center" class="headings" colspan="4">Company List</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td width="35%">&nbsp;</td>
    </tr>
    <tr>		 
        <td align="right">Company Name:</td>
        <td  align="left"><asp:TextBox ID="txtCompany" runat="server"></asp:TextBox></td>        
        <td>&nbsp;</td>
        <td>&nbsp;</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="gvCompany" runat="server" Width="100%" CellPadding="2" 
				  AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
				  DataSourceID="sdsCompany" PageSize="25" HeaderStyle-CssClass="gvHeader" 
				  DataKeyNames="CompanyID,strCompany">	  	
					<Columns>
						<asp:BoundField DataField="#" HeaderText="#" ReadOnly="True" >
							<HeaderStyle Width="1%" />
							<ItemStyle Font-Size="Smaller" HorizontalAlign="Right" />
						</asp:BoundField>
						<asp:HyperLinkField DataNavigateUrlFields="CompanyID"	SortExpression="strCompany"
							DataNavigateUrlFormatString="CompanyDetails.aspx?CID={0}" 
							DataTextField="strCompany" HeaderText="Company" 
							 ItemStyle-Width="30%" ><ItemStyle Width="30%"></ItemStyle>
						</asp:HyperLinkField>	
												 						
						<asp:BoundField DataField="strFYStart" HeaderText="Fin Year Start" 
              SortExpression="strFYStart" />
            <asp:BoundField DataField="strFYEnd" HeaderText="Fin Year End" 
              SortExpression="strFYEnd" />
						<asp:BoundField DataField="strLastUser" HeaderText="Last User" 
							SortExpression="strLastUser" />
						<asp:BoundField DataField="dtStamp" HeaderText="Last Edit" 
							SortExpression="dtStamp" >
							<ItemStyle HorizontalAlign="Right" Wrap="False" Width="5%" />
						</asp:BoundField>
						<asp:CommandField HeaderText="Delete" ShowDeleteButton="True">
							<ItemStyle HorizontalAlign="Center" />
						</asp:CommandField>
					</Columns>
					<HeaderStyle CssClass="gvHeader" Wrap="False"/>				  
				  <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="sdsCompany" AutoGenerateColumns="False" DataKeyNames="CompanyID">
				   <Columns>
						
						<asp:BoundField DataField="CompanyID" HeaderText="CompanyID" 
							SortExpression="CompanyID" InsertVisible="False" ReadOnly="True" />
						<asp:BoundField DataField="strCompany" HeaderText="Company" 
							SortExpression="strCompany" />
						<asp:BoundField DataField="strFYStart" HeaderText="Fin Year Start" 
							SortExpression="strFYStart"/>
					   <asp:BoundField DataField="strFYEnd" HeaderText="Fin Year End" 
               SortExpression="strFYEnd" />
             <asp:BoundField DataField="strLastUser" HeaderText="Last User" 
               SortExpression="strLastUser" />
             <asp:BoundField DataField="dtStamp" HeaderText="dtStamp" 
               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="sdsCompany" runat="server" 
				  ConnectionString="<%$ ConnectionStrings:csStockControl %>" 
				  DeleteCommand="DELETE FROM [mstCompany] WHERE [CompanyID] = @CompanyID" 				  
				  
		
    SelectCommand="SELECT '' AS '#', CompanyID, strCompany, strFYStart, strFYEnd, strLastUser, dtStamp FROM mstCompany ORDER BY strCompany" 				  >
				  <DeleteParameters>
					  <asp:Parameter Name="CompanyID" Type="Int32" />
				  </DeleteParameters>		  				  
			  </asp:SqlDataSource>			  
</asp:Content>


