<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server">
    <title>Сведения по переговорам в LCS ООО ЦТС</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        От пользователя
        <asp:DropDownList ID="listFormUser" runat="server" Width="290px" AutoPostBack="True" OnSelectedIndexChanged="listFormUser_SelectedIndexChanged">
        </asp:DropDownList><br />
        К пользователю&nbsp;
        <asp:DropDownList ID="listToUser" runat="server" Width="288px" AutoPostBack="True" OnSelectedIndexChanged="listToUser_SelectedIndexChanged">
        </asp:DropDownList><br />
        или<br />
        Все разговоры (к нему и от него) пользователя
        <asp:DropDownList ID="listUser" runat="server" AutoPostBack="True" OnSelectedIndexChanged="listUser_SelectedIndexChanged"
            Width="265px">
        </asp:DropDownList>
        <br />
        <asp:Button ID="butShowAll" runat="server" OnClick="butShowAll_Click" Text="Показать всё" /><br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333"
            GridLines="None" Style="font-size: 8pt; font-family: Verdana" Width="100%" OnDataBinding="GridView1_DataBinding" OnDataBound="GridView1_DataBound" PageSize="30">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:BoundField DataField="d" HeaderText="Дата" ReadOnly="True" SortExpression="d">
                    <ItemStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="t" HeaderText="Время" ReadOnly="True" SortExpression="t">
                    <ItemStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="from_field" HeaderText="От" SortExpression="from_field">
                    <ItemStyle Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="to_field" HeaderText="К" SortExpression="to_field">
                    <ItemStyle Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="body" HeaderText="Текст" SortExpression="body" />
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        &nbsp;</div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=server_db.domain.local;Initial Catalog=LcsLog;Integrated Security=True"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT     CONVERT(varchar(15),DATEADD(hh,4,messages.date),104) as d,CONVERT(varchar(50),DATEADD(hh,4,messages.date),108) as t, users.useruri as from_field, users_1.useruri AS to_field, messages.body &#13;&#10;FROM         messages INNER JOIN users ON messages.fromid = users.userid INNER JOIN&#13;&#10;  users AS users_1 ON messages.toid = users_1.userid" FilterExpression="{0}">
            <FilterParameters>
                <asp:SessionParameter Name="user" SessionField="curuser" />
            </FilterParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>
