<%@ Page Language="c#" CodeBehind="Classroom.aspx.cs" AutoEventWireup="True" Inherits="MTCUN.Mobile.Class.Classroom"
    Title="教室设置-教务" %>

<%@ Import Namespace="MTCUN" %>
<%@ Register Src="../User_Col/col_Header.ascx" TagName="col_Header" TagPrefix="uc1" %>
<!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">
    <link id="mobileCss" runat="server" href="../themes/mobile.css" rel="stylesheet"
        type="text/css" />

    <script type="text/javascript">
        function OpenSearch() {
            if (setContent.style.display == 'none') {
                setContent.style.display = 'block';
                setControl.innerHTML = '▲增加教室';
                __mt__setSearchCookie(1);
            }
            else {
                setContent.style.display = 'none';
                setControl.innerHTML = '▼增加教室';
                __mt__setSearchCookie(0);
            }
        }

        function defaultSearchState() {
            var num = __mt__getSearchCookie();
            if (num == 1) {
                setContent.style.display = 'block';
                setControl.innerHTML = '▲增加教室';
            }
            else {
                setContent.style.display = 'none';
                setControl.innerHTML = '▼增加教室';
            }
        }
    </script>
</head>
<body onload="defaultSearchState()">
    <form id="Form1" method="post" runat="server">
        <uc1:col_Header ID="col_Header1" runat="server" />

        <div id="web_page_contents">
            <div class="search biao_zhun_suo_jin">

                <div class="setandsearch">
                    <ul class="searchtool">
                        <li>
                            <div id="setControl" onclick="OpenSearch()">
                                ▼增加教室
                            </div>
                        </li>
                    </ul>

                    <div id="setContent" style="display: none">
                        <table class=" table_simple_kuan" cellspacing="0" cellpadding="0">
                            <tr>
                                <td style="width: 85px">教室名称：
                                </td>
                                <td>
                                    <asp:TextBox ID="tbxClassroomName" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 60px">容纳人数：
                                </td>
                                <td>
                                    <asp:TextBox ID="tbxSeating" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 60px">校区：
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlSchool" runat="server" DataSource='<%# swq.Cache.Fill(swq.Cache.GetSchool()," ") %>'
                                        DataValueField="SchoolID" DataTextField="SchoolName">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <label class="lab_button">
                                        <asp:Button ID="btnGo" runat="server" Text="查询" OnClick="btnGo_Click"></asp:Button>
                                    </label>
                                    <label class="lab_button">
                                        <asp:Button ID="btnAdd" runat="server" Text="增加" OnClick="btnAdd_Click"></asp:Button>
                                    </label>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                <div class="divpanel">
                    <asp:GridView ID="GridView1" runat="server" CssClass="gridview" AutoGenerateColumns="False"
                        DataKeyNames="ClassroomID" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowCommand="GridView1_RowCommand"
                        OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCreated="GridView1_RowCreated"
                        OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="GridView1_RowDataBound">
                        <Columns>
                            <asp:BoundField DataField="ClassroomID" ReadOnly="True" HeaderText="教室编号" />
                            <asp:BoundField DataField="ClassroomName" HeaderText="教室名称" />
                            <asp:BoundField DataField="Seating" HeaderText="容纳人数" />
                            <asp:TemplateField HeaderText="状态">
                                <ItemTemplate>
                                </ItemTemplate>
                                <EditItemTemplate>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="校区">
                                <ItemTemplate>
                                </ItemTemplate>
                                <EditItemTemplate>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="排序">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnUp" runat="server" CommandName="Up" Text="↑"></asp:LinkButton>
                                    <asp:LinkButton ID="btnDo" runat="server" CommandName="Do" Text="↓"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField HeaderText="编辑" EditText="编辑" CancelText="取消" UpdateText="更新" ShowEditButton="true" />
                            <asp:TemplateField HeaderText="删除">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete" OnClientClick="<%# Rs.Messages.确定删除%>"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>

                    <asp:Repeater ID="repBlock" runat="server" OnItemCommand="repBlock_ItemCommand"
                        OnItemDataBound="repBlock_ItemDataBound">
                        <ItemTemplate>
                            <asp:Panel ID="plItem" runat="server" CssClass="kuai">

                                <h1 class="auto_length_title"><%#Eval("ClassroomName")%></h1>

                                <table class="table_simple_kuan">
                                    <tr>
                                        <td style="width: 80px">容纳人数：</td>
                                        <td style="width: auto"><%#Eval("Seating") %></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">状态：</td>
                                        <td style="width: auto"><%# Rs.Items.GetLockState((int)Eval("LockState"))%></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">校区：</td>
                                        <td style="width: auto"><%# Eval("SchoolName") %></td>
                                    </tr>
                                </table>

                                <table style="width: 100%;" cellpadding="0" cellspacing="2">
                                    <tr>
                                        <td>
                                            <div class="lab_button">
                                                <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete" CommandArgument='<%#Eval("ClassroomID")%>'
                                                    OnClientClick="<%# Rs.Messages.确定删除%>"></asp:LinkButton>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="lab_button">
                                                <asp:LinkButton runat="server" ID="lbnEdit" CommandArgument='<%# Eval("ClassroomID")%>'
                                                    CommandName="Edit" Text="编辑"></asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>


                            </asp:Panel>
                            <asp:Panel ID="plEdit" runat="server" CssClass="kuai edit_kuai">
                                <table class="table_simple_kuan">
                                    <tr>
                                        <td style="width: 80px">教室名称：</td>
                                        <td style="width: auto">
                                            <asp:TextBox ID="tbxClassroomName" Text='<%#Eval("ClassroomName") %>' runat="server"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">容纳人数：</td>
                                        <td style="width: auto">
                                            <asp:TextBox ID="tbxSeating" Text='<%#Eval("Seating") %>' runat="server"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">状态：</td>
                                        <td style="width: auto">
                                            <asp:DropDownList runat="server" ID="ddlLockState" SelectedIndex='<%# Eval("LockState") %>'>
                                                <asp:ListItem Value="0" Text="禁用"></asp:ListItem>
                                                <asp:ListItem Value="1" Text="启用"></asp:ListItem>
                                            </asp:DropDownList></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">校区：</td>
                                        <td style="width: auto">
                                            <asp:DropDownList ID="ddlSchool" runat="server" DataSource="<%# swq.Cache.GetSchool() %>"
                                                SelectedValue='<%# Eval("SchoolID") %>' DataValueField="SchoolID" DataTextField="SchoolName">
                                            </asp:DropDownList></td>
                                    </tr>
                                </table>

                                <table style="width: 100%;" cellpadding="0" cellspacing="2">
                                    <tr>
                                        <td>
                                            <div class="lab_button">
                                                <asp:LinkButton runat="server" ID="lbnUpdate" CommandArgument='<%# Eval("ClassroomID")%>'
                                                    CommandName="Update" Text="更新"></asp:LinkButton>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="lab_button">
                                                <asp:LinkButton runat="server" ID="lbnCancel" CommandArgument='<%# Eval("ClassroomID")%>'
                                                    CommandName="Cancel" Text="取消"></asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>

                            </asp:Panel>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>

                <div class="pager_button">
                    <asp:Literal ID="litPagerButton" runat="server"></asp:Literal>
                </div>

                <div class="divpanel">
                    <b>注意事项：</b><br />
                    1、注意教室不是班级，有几间教室您就设置几间。<br />
                </div>

            </div>
        </div>
    </form>
</body>
</html>
