<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="mypage.aspx.cs" Inherits="code_mypage" %>

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sinistra" runat="Server">
    Benvenuto <asp:Label ID="myuser" runat="server" Text="Label"></asp:Label>!<br />
    <asp:LoginStatus ID="LoginStatus1" runat="server" 
        onloggedout="LoginStatus1_LoggedOut" />
    <br />
    <br />
    <asp:Button ID="admin" runat="server" Height="34px" 
        onclick="admin_Click" Text="AdminArea" Visible="False" Width="90px" 
    BorderColor="#FF3300" />
    <br />
    <br />
    I tuoi DataStream:<br />
    <br />
    <asp:DataList ID="DataList1" runat="server" BackColor="LightGoldenrodYellow" 
        BorderColor="Tan" BorderWidth="1px" CellPadding="2" 
        DataKeyField="id_datastream" DataSourceID="AccessDataSource1" ForeColor="Black">
        <AlternatingItemStyle BackColor="PaleGoldenrod" />
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <ItemTemplate>
            Data:
            <asp:Label ID="reg_timeLabel" runat="server" Text='<%# Eval("reg_time") %>' />
            <br />
            ID:
            <asp:Label ID="id_datastreamLabel" runat="server" 
                Text='<%# Eval("id_datastream") %>' />
            <br />
            Descrizione:
            <asp:Label ID="descriptionLabel" runat="server" 
                Text='<%# Eval("description") %>' />
            <br />
            <br />
        </ItemTemplate>
        <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    </asp:DataList>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/ASPNetDB.mdb" 
        SelectCommand="SELECT [reg_time], [id_datastream], [description] FROM [datastreams] WHERE ([user] = ?)">
        <SelectParameters>
            <asp:ControlParameter ControlID="myuser" Name="user" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
&nbsp;
    <br />
    <br />
    <br />
    <div style="clear: both;">
    </div>
    <div class="menu1">
        <ul>
            <li class="menu-01">
                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/code/addstream.aspx">DataStreams settings</asp:HyperLink></li>
            <li class="menu-02">
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/code/addpoint.aspx">DataPoints settings</asp:HyperLink></li>
        </ul>
    </div>


</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="destra" Runat="Server">
    <asp:Label ID="userdestra" runat="server" Text="Label" Visible="False"></asp:Label>
    ID:
    <asp:DropDownList ID="id" runat="server" DataSourceID="AccessDataSource2" DataTextField="id_datastream"
        DataValueField="id_datastream" AutoPostBack="True">
    </asp:DropDownList>
    <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
        
        
        SelectCommand="SELECT [id_datastream] FROM [datastreams] WHERE ([user] = ?)">
        <SelectParameters>
             <asp:ControlParameter ControlID="userdestra" Name="user" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
        Tempo:
    <asp:DropDownList ID="tempo" runat="server" AutoPostBack="True" 
        onselectedindexchanged="tempo_SelectedIndexChanged" >
        <asp:ListItem Value="5">5m</asp:ListItem>
        <asp:ListItem Value="10">10m</asp:ListItem>
        <asp:ListItem Value="15">15m</asp:ListItem>
        <asp:ListItem Value="30">30m</asp:ListItem>
        <asp:ListItem Value="60">1h</asp:ListItem>
        <asp:ListItem Value="120">2h</asp:ListItem>
        <asp:ListItem Value="720">12h</asp:ListItem>
        <asp:ListItem Value="1440">24h</asp:ListItem>       
        <asp:ListItem Value="2880">48h</asp:ListItem>
        <asp:ListItem Value="4320">72h</asp:ListItem>
        <asp:ListItem Value="10080">1week</asp:ListItem>
        <asp:ListItem Value="20160">2weeks</asp:ListItem>
        <asp:ListItem Value="40320">1month</asp:ListItem>
        <asp:ListItem Value="80640">2months</asp:ListItem>
        <asp:ListItem Value="120960">3months</asp:ListItem>
        <asp:ListItem Value="241920">6months</asp:ListItem>
        <asp:ListItem Value="322560">8months</asp:ListItem>
        <asp:ListItem Value="403200">10moths</asp:ListItem>
        <asp:ListItem Value="483840">1year</asp:ListItem>
        <asp:ListItem Value="967680">2year</asp:ListItem>

    </asp:DropDownList>
    From:
    <asp:TextBox ID="from" runat="server" Enabled="True"></asp:TextBox>
    To:
    <asp:TextBox ID="to" runat="server"></asp:TextBox>
    <asp:Button ID="refresh" runat="server" BorderColor="Lime" 
    onclick="refresh_Click" style="margin-left: 29px" Text="Refresh" Width="80px" />
    <asp:Button ID="spline" runat="server" Text="Spline" onclick="spline_Click" />
    <asp:Button ID="button_3d" runat="server" Text="3D" onclick="button_3d_Click" />
    <br />
    <br />
    <asp:Label ID="titolo" runat="server"></asp:Label>
    <br />
    <br />
    <asp:Chart ID="Chart1" runat="server" DataSourceID="AccessDataSource3" 
        Width="637px" onload="Chart1_Load">
        <series>
            <asp:Series ChartType="Line" Name="Series1" XValueMember="data" 
                YValueMembers="myvalue" XValueType="Time" YValuesPerPoint="4">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </chartareas>
        <Titles>
            <asp:Title Name="Title1" Text="Provamelo">
            </asp:Title>
            <asp:Title Alignment="BottomRight" Docking="Bottom" Name="Title2" 
                Text="Andrea Esposito 108/1007 andrea.esposito@studenti.uniparthenope.it">
            </asp:Title>
        </Titles>
    </asp:Chart>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" 
        BackColor="#DEBA84" BorderColor="#DEBA84" BorderWidth="1px" 
        CellPadding="3" DataKeyNames="id" DataSourceID="AccessDataSource3" 
        BorderStyle="None" CellSpacing="2" 
          Width="600px" style="margin-right: 32px">
        <Columns>
            <asp:BoundField DataField="data" HeaderText="Data" SortExpression="data" />
            <asp:BoundField DataField="ip" HeaderText="IP" SortExpression="ip" />
            <asp:BoundField DataField="id" HeaderText="ID" 
                SortExpression="id" InsertVisible="False" ReadOnly="True" />
            <asp:BoundField DataField="myvalue" HeaderText="Value" 
                SortExpression="myvalue" />
        </Columns>
        <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
        <PagerStyle ForeColor="#8C4510" 
            HorizontalAlign="Center" />
        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
        <SelectedRowStyle BackColor="#738A9C" ForeColor="White" Font-Bold="True" />
    </asp:GridView>
    <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
        DataFile="~/App_Data/ASPNetDB.mdb" 
        
        SelectCommand="SELECT [data], [ip], [myvalue], [id] FROM [datapoints] WHERE (([my_datastream] = ?) AND ([data] &gt; ?) AND ([data] &lt; ?))">
        <SelectParameters>
            <asp:ControlParameter ControlID="id" Name="my_datastream" 
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="from" Name="data" PropertyName="Text" 
                Type="DateTime" />
            <asp:ControlParameter ControlID="to" Name="data2" PropertyName="Text" 
                Type="DateTime" />
        </SelectParameters>
    </asp:AccessDataSource>
</asp:Content>