<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="general_sushe_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>房间设置</title>
    <link rel="stylesheet" type="text/css" href="./../../styles/1/style.css">
</head>
<body class="bodycolor">
    <form id="form1" runat="server">
        <div style="width:780px;">
            <fieldset>
                <legend>添加房间 </legend>
                <div style="width: 98%; float: left;">
                    <asp:Label ID="Label1" runat="server" Text="房间号码："></asp:Label><asp:TextBox ID="TextBox1"
                        runat="server" Width="60px"></asp:TextBox><asp:Label ID="Label2" runat="server" Text="性 &nbsp; &nbsp;别："></asp:Label><asp:DropDownList ID="DropDownList1" runat="server" Width="66px">
                        <asp:ListItem Selected="True">男</asp:ListItem>
                        <asp:ListItem>女</asp:ListItem>
                    </asp:DropDownList><asp:Label ID="Label3" runat="server" Text="宿舍电话："></asp:Label><asp:TextBox ID="TextBox3"
                        runat="server" Width="60px"></asp:TextBox><asp:Label ID="Label4" runat="server" Text="电话端口："></asp:Label><asp:TextBox
                            ID="TextBox4" runat="server" Width="60px"></asp:TextBox><br />
                    <asp:Label ID="Label5" runat="server" Text="网线端口："></asp:Label><asp:TextBox ID="TextBox5"
                        runat="server" Width="60px"></asp:TextBox><asp:Label ID="Label6" runat="server" Text="可住人数："></asp:Label><asp:TextBox
                            ID="TextBox6" runat="server" Width="60px"></asp:TextBox><asp:Label ID="Label7" runat="server"
                                Text="水表底数："></asp:Label><asp:TextBox ID="TextBox7" runat="server" Width="60px"></asp:TextBox><asp:Label
                                    ID="Label8" runat="server" Text="电表底数："></asp:Label><asp:TextBox ID="TextBox8" runat="server" Width="60px"></asp:TextBox>
                
                    <asp:Button ID="Button1" runat="server" Text="添加" CssClass="BigButton" OnClick="Button1_Click" />
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="房间号码格式不正确" ValidationExpression="#\d{1,2}-\d{3}" Display="None"></asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBox4"
                        Display="None" ErrorMessage="电话端口应为数字" ValidationExpression="\d+"></asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="TextBox5"
                        Display="None" ErrorMessage="网络端口应为数字" ValidationExpression="\d+"></asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="TextBox6"
                        Display="None" ErrorMessage="可住人数应为数字" ValidationExpression="\d+"></asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ControlToValidate="TextBox8"
                        Display="None" ErrorMessage="电表底数应为数字" ValidationExpression="\d+"></asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="TextBox7"
                        Display="None" ErrorMessage="水表底数应为数字" ValidationExpression="\d+"></asp:RegularExpressionValidator></div>
            </fieldset>
            <br />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                ShowSummary="False" />
            <br />
            <fieldset>
                <legend>房间信息 </legend>
                <asp:GridView ID="GridView11" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" DataKeyNames="房间号" AllowPaging="True" PageSize="15" EmptyDataText="暂无数据" OnRowDataBound="GridView11_RowDataBound">
                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                    <Columns>
                        <asp:BoundField DataField="房间号" HeaderText="房间号" ReadOnly="True" SortExpression="房间号" >
                            <ItemStyle Width="60px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="入住性别" HeaderText="入住性别" SortExpression="入住性别" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="电话号码" HeaderText="电话号码" SortExpression="电话号码" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="电话端口" HeaderText="电话端口" SortExpression="电话端口" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="网络端口" HeaderText="网络端口" SortExpression="网络端口" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="可住人数" HeaderText="可住人数" SortExpression="可住人数" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="水表底数" HeaderText="水表底数" SortExpression="水表底数" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="电表底数" HeaderText="电表底数" SortExpression="电表底数" >
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:CommandField ShowEditButton="True" >
                            <ItemStyle Width="80px" />
                        </asp:CommandField>
                        <asp:CommandField ShowDeleteButton="True" >
                            <ItemStyle Width="60px" />
                        </asp:CommandField>
                    </Columns>
                    <RowStyle BackColor="#E3EAEB" />
                    <EditRowStyle BackColor="#7C6F57" />
                    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:hqglConnectionString %>"
                        SelectCommand="SELECT * FROM [room_inf]" UpdateCommand="update [room_inf] set 房间号=@房间号,入住性别=@入住性别, 电话号码=@电话号码, 网络端口=@网络端口,可住人数=@可住人数, 水表底数=@水表底数, 电表底数=@电表底数 where 房间号=@房间号"
                        DeleteCommand="delete from [room_inf] where 房间号=@房间号" OnDeleted="SqlDataSource1_Deleted">
                        <DeleteParameters>
                            <asp:ControlParameter ControlID="GridView11" Name="房间号" PropertyName="SelectedValue" />
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="房间号" />
                            <asp:Parameter Name="入住性别" />
                            <asp:Parameter Name="电话号码" />
                            <asp:Parameter Name="网络端口" />
                            <asp:Parameter Name="可住人数" />
                            <asp:Parameter Name="水表底数" />
                            <asp:Parameter Name="电表底数" />
                            <asp:Parameter Name="房间呈" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:hqglConnectionString %>"
                    DeleteCommand="DELETE FROM [std_inf] WHERE [房间号] = @房间号" >
                    <DeleteParameters>
                        <asp:Parameter Name="房间号" Type="String" />
                    </DeleteParameters>
                </asp:SqlDataSource>
            </fieldset>
        </div>
    </form>
</body>
</html>
