<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LessonDegree.aspx.cs" Inherits="MTCUN.Mobile.Class.LessonDegree"
    Title="排课信息-教务" %>

<%@ Import Namespace="MTCUN" %>
<%@ Register Src="../../UserCol/Progress.ascx" TagName="Progress" TagPrefix="uc2" %>
<%@ Register Src="../../UserCol/SimpleCode.ascx" TagName="SimpleCode" TagPrefix="uc1" %>
<%@ Register Src="../../UserCol/Ann.ascx" TagName="Ann" TagPrefix="uc3" %>
<%@ Register Src="../User_Col/col_Header.ascx" TagName="col_Header" TagPrefix="uc4" %>
<%@ Register Src="../User_Col/col_ClassControlPanel.ascx" TagName="col_ClassControlPanel" TagPrefix="uc5" %>
<!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>


    <script type="text/javascript">
        function OpenClass() {
            if (setContent2.style.display == 'none') {
                setContent2.style.display = 'block';
                setControl2.innerHTML = '▲班级概要';
                __mt__setClassCookie(1);
            }
            else {
                setContent2.style.display = 'none';
                setControl2.innerHTML = '▼班级概要';
                __mt__setClassCookie(0);
            }
        }

        function defaultClassState() {
            var num = __mt__getClassCookie();
            if (num == 1) {
                setContent2.style.display = 'block';
                setControl2.innerHTML = '▲班级概要';
            }
            else {
                setContent2.style.display = 'none';
                setControl2.innerHTML = '▼班级概要';
            }
        }
    </script>

    <style type="text/css">
        .ld {
            margin: 0px;
            padding: 0px;
            list-style: none;
        }

            .ld li {
                display: block;
                margin: 2px;
            }

                .ld li span {
                    display: inline-block;
                }
    </style>
</head>
<body onload="defaultSearchState();defaultClassState()">
    <form id="form1" runat="server">
        <uc3:Ann ID="Ann1" runat="server" />
        <uc4:col_Header ID="col_Header1" runat="server" />
        <div id="web_page_contents">

            <div class="biao_zhun_suo_jin">
                <uc5:col_ClassControlPanel ID="col_ClassControlPanel1" runat="server" />

                <div class="setandsearch" style="margin-bottom: 5px">
                    <ul class="searchtool">
                        <li>
                            <div id="setControl2" onclick="OpenClass()">
                                ▼班级概要
                            </div>
                        </li>
                    </ul>
                    <div id="setContent2" style="display: none">
                        <asp:FormView ID="fvClass" runat="server" CellPadding="5" Width="100%">
                            <ItemTemplate>
                                <table class="table" cellspacing="0">
                                    <tr>
                                        <td>班号：<%#Eval("ClassID")%></td>
                                    </tr>
                                    <tr>
                                        <td>班级名称：<%#Eval("ClassName")%></td>
                                    </tr>
                                    <tr>
                                        <td>上课规律：<%#Eval("TimeRule")%></td>
                                    </tr>
                                    <tr>
                                        <td>开课时间：<%#Eval("StartDate","{0:d}")%></td>
                                    </tr>
                                    <tr>
                                        <td>总课时：<%#Eval("Lessons")%></td>
                                    </tr>
                                    <tr>
                                        <td>每课分钟：<%#Eval("LessonMinute")%></td>
                                    </tr>

                                </table>
                            </ItemTemplate>
                        </asp:FormView>
                    </div>

                </div>

                <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">
                            <tr>
                                <td style="width: 90px">排课参数：
                                </td>
                                <td>
                                    <table border="0" width="100%">
                                        <tr>
                                            <td>
                                                <ul class="ld">
                                                    <li><span>周期：</span><span>
                                                        <asp:DropDownList ID="ddlWeek" runat="server" Width="80px">
                                                            <asp:ListItem Text="周日" Value="0"></asp:ListItem>
                                                            <asp:ListItem Text="周一" Value="1"></asp:ListItem>
                                                            <asp:ListItem Text="周二" Value="2"></asp:ListItem>
                                                            <asp:ListItem Text="周三" Value="3"></asp:ListItem>
                                                            <asp:ListItem Text="周四" Value="4"></asp:ListItem>
                                                            <asp:ListItem Text="周五" Value="5"></asp:ListItem>
                                                            <asp:ListItem Text="周六" Value="6"></asp:ListItem>
                                                            <asp:ListItem Text="全周" Value="-1"></asp:ListItem>
                                                        </asp:DropDownList></span></li>
                                                    <li><span>时段：</span><span><asp:DropDownList ID="ddlTimes" runat="server">
                                                    </asp:DropDownList></span>
                                                        <span>
                                                            <asp:DropDownList ID="ddlGroupType" runat="server" DataTextField="PeriodTimeGroupName"
                                                                DataValueField="PeriodTimeGroupID" AutoPostBack="True" OnSelectedIndexChanged="ddlGroupType_SelectedIndexChanged">
                                                            </asp:DropDownList></span></li>
                                                    <li><span>讲师：</span><span><asp:DropDownList runat="server" ID="ddlTeacher" DataTextField="TrueName" DataValueField="UserID">
                                                    </asp:DropDownList></span><span>
                                                        <uc1:SimpleCode ID="SimpleCode1" runat="server" UsersControlID="ddlTeacher" />
                                                    </span>
                                                    </li>
                                                    <li><span>助教：</span><span><asp:DropDownList runat="server" ID="ddlAssistant" DataTextField="TrueName" DataValueField="UserID">
                                                    </asp:DropDownList></span><span>
                                                        <uc1:SimpleCode ID="SimpleCode2" runat="server" UsersControlID="ddlAssistant" />
                                                    </span>
                                                    </li>
                                                    <li><span>教室：</span><span><asp:DropDownList ID="ddlClassroom" runat="server" DataTextField="ClassroomName"
                                                        DataValueField="ClassroomID">
                                                    </asp:DropDownList></span></li>
                                                    <li><span>课题：</span><span><asp:TextBox runat="server" ID="tbxSubject"></asp:TextBox></span></li>
                                                    <li>
                                                        <label class="lab_button_kuan">
                                                            <asp:Button ID="btnAddTime" runat="server" CausesValidation="False" OnClick="btnAddTime_Click"
                                                                Text="添加" />
                                                        </label>
                                                    </li>
                                                </ul>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 0px">
                                                <ul class="ld">
                                                    <li style="min-width: 60%">

                                                        <asp:Repeater ID="repSmallBlock" runat="server" OnItemCommand="repSmallBlock_ItemCommand"
                                                            OnItemDataBound="repSmallBlock_ItemDataBound">
                                                            <ItemTemplate>

                                                                <asp:Panel ID="plItem" runat="server" CssClass="kuai">
                                                                    <table cellpadding="0" cellspacing="0" class="table_simple_kuan">
                                                                        <tr>
                                                                            <td style="width: 50px">周期：</td>
                                                                            <td><%# Rs.Items.GetWeekText(Eval("Week")) %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>时段：</td>
                                                                            <td><%# Eval("PeriodTimeName") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>分钟：</td>
                                                                            <td><%# Eval("Minute") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>课时：</td>
                                                                            <td><%# Eval("Lessons") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>讲师：</td>
                                                                            <td><%# Eval("TeacherName") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>助教：</td>
                                                                            <td><%# Eval("AssistantName") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>教室：</td>
                                                                            <td><%# Eval("ClassroomName") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>课题：</td>
                                                                            <td><%# Eval("Subject") %></td>
                                                                        </tr>
                                                                    </table>
                                                                    <table class="table_simple_kuan">
                                                                        <tr>
                                                                            <td>
                                                                                <div class="lab_button">
                                                                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
                                                                                </div>
                                                                            </td>
                                                                            <td>
                                                                                <div class="lab_button">
                                                                                    <asp:LinkButton ID="lbnEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="编辑"></asp:LinkButton>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>

                                                                </asp:Panel>
                                                                <asp:Panel ID="plEdit" runat="server" CssClass="kuai edit_kuai">
                                                                    <table cellpadding="0" cellspacing="0" class="table_simple_kuan">
                                                                        <tr>
                                                                            <td style="width: 50px">周期：</td>
                                                                            <td><%# Rs.Items.GetWeekText(Eval("Week")) %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>时段：</td>
                                                                            <td><%# Eval("PeriodTimeName") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>分钟：</td>
                                                                            <td><%# Eval("Minute") %></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>课时：</td>
                                                                            <td>
                                                                                <asp:TextBox ID="tbxLessons" runat="server" Text='<%# Eval("Lessons") %>'></asp:TextBox></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>讲师：</td>
                                                                            <td>
                                                                                <asp:DropDownList runat="server" ID="ddlTeacher" SelectedValue='<%# Eval("TeacherID") %>'
                                                                                    DataSource='<%# swq.Cache.GetUsers() %>' DataTextField="TrueName" DataValueField="UserID">
                                                                                </asp:DropDownList></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>助教：</td>
                                                                            <td>
                                                                                <asp:DropDownList runat="server" ID="ddlAssistant" SelectedValue='<%# Eval("AssistantID") %>'
                                                                                    DataSource='<%# swq.Cache.Fill(swq.Cache.GetUsers()," ") %>' DataTextField="TrueName"
                                                                                    DataValueField="UserID">
                                                                                </asp:DropDownList></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>教室：</td>
                                                                            <td>
                                                                                <asp:DropDownList runat="server" ID="ddlClassroom" SelectedValue='<%# Eval("ClassroomID") %>'
                                                                                    DataSource='<%# swq.Cache.GetClassroom() %>' DataTextField="ClassroomName" DataValueField="ClassroomID">
                                                                                </asp:DropDownList></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>课题：</td>
                                                                            <td>
                                                                                <asp:TextBox runat="server" ID="tbxSubject" Text='<%# Eval("Subject") %>'></asp:TextBox></td>
                                                                        </tr>
                                                                    </table>
                                                                    <table class="table_simple_kuan">
                                                                        <tr>
                                                                            <td>
                                                                                <div class="lab_button">
                                                                                    <asp:LinkButton ID="lbnUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="更新"></asp:LinkButton>
                                                                                </div>
                                                                            </td>
                                                                            <td>
                                                                                <div class="lab_button">
                                                                                    <asp:LinkButton ID="lbnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </asp:Panel>

                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </li>
                                                </ul>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>排课起始日：
                                </td>
                                <td>
                                    <asp:TextBox ID="tbxStartDate" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>可排课时数：
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlLessons" runat="server">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>排课截止日：</td>
                                <td>
                                    <asp:TextBox ID="tbxEndDate" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>排课完成度：
                                </td>
                                <td>
                                    <uc2:Progress ID="Progress1" runat="server" Text="课时" Width="40%" />
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                </td>
                                <td>
                                    <label class="lab_button_kuan">
                                        <asp:Button ID="btnAutoAddLessonDegree" runat="server" OnClick="btnAutoAddLessonDegree_Click"
                                            Text="自动排课" />
                                    </label>
                                    <label class="lab_button_kuan">
                                        <asp:Button ID="btnAddOneLessonDegree" runat="server" OnClick="btnAddOneLessonDegree_Click"
                                            Text="逐个排课" />
                                    </label>
                                    <label class="lab_button_kuan">
                                        <asp:Button ID="btnClearLessonDegree" runat="server" OnClick="btnClearLessonDegree_Click"
                                            Text="清除排课" OnClientClick="return confirm('执行此操作，将删除所有未上课的排课信息，您确定要这么做？');" />
                                    </label>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

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

                                <table class=" table_simple_kuan" cellspacing="0" border="0">
                                    <tr>
                                        <td style="width: 70px"><%# (int)Eval("LeStateID") == 0 ? "<span class ='weishangke'>未上课</span>": "<span class ='yishangke'>已上课</span>"%></td>
                                        <td style="width: auto"></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">课题：</td>
                                        <td style="width: auto"><%#Eval("Subject")%></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">上课日期：</td>
                                        <td style="width: auto">
                                            <asp:HyperLink runat="server" ID="hlkClassInfo" Text='<%#Eval("StartDate","{0:d}")%>'
                                                NavigateUrl='<%# string.Format("Attend.aspx?ClassID={0}&LessonDegreeID={1}&GetUrl={2}",Eval("ClassID"),Eval("LessonDegreeID"),swq.Web.PathAndQuery()) %>'></asp:HyperLink>
                                            <span style="color: Red; font-size: 9px">[<%#GetWeek(Eval("StartDate"))%>]</span></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">上课时段：</td>
                                        <td style="width: auto">
                                            <%# string.Format("{0}-{1}", Eval("StartDate", "{0:HH:mm}"),EndDate(Eval("EndDate")))%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">类型：</td>
                                        <td style="width: auto">
                                            <asp:Label runat="server" ID="labLessonType" Text='<%#(int)Eval("LessonType") == 1 ? "正常" : "补课"%>'></asp:Label><asp:Label
                                                runat="server" ID="labPlace" ForeColor="Red" Text='<%#(int)Eval("LessonType") == 0 ? (swq.Tools.GetInt(Eval("Place")) == 1 ? "(他)" : "(本)") : ""%>'
                                                ToolTip='<%#(int)Eval("LessonType") == 0 ? (swq.Tools.GetInt(Eval("Place")) == 1 ? "(他)表示在他班补课" : "(本)表示在本班补课") : ""%>'></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">课时：</td>
                                        <td style="width: auto"><%#Eval("Lessons")%></td>
                                    </tr>

                                    <tr>
                                        <td style="width: auto">讲师：</td>
                                        <td style="width: auto">
                                            <%#Eval("TeacherName")%></td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">助教：</td>
                                        <td style="width: auto">
                                            <%#Eval("AssistantName")%></td>
                                    </tr>
                                    <tr>
                                        <td>教室：</td>
                                        <td>
                                            <%#Eval("ClassroomName") %>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: auto">出勤：</td>
                                        <td style="width: auto">实到:<%#Eval("FactCount")%>
                                    旷课:<%#Eval("TruancyCount")%>
                                    请假:<%#Eval("LeaveCount")%></td>
                                    </tr>
                                </table>

                                <table style="width: 100%;" cellpadding="0" cellspacing="2">
                                    <tr>
                                        <td>
                                            <div class="lab_button" id="divDelete" runat="server">
                                                <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete" CommandArgument='<%#Eval("LessonDegreeID")%>'
                                                    OnClientClick="<%# Rs.Messages.确定删除%>"></asp:LinkButton>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="lab_button" id="divEdit" runat="server">
                                                <asp:HyperLink runat="server" NavigateUrl='<%#string.Format("PostLessonDegree.aspx?LessonDegreeID={0}&ClassID={1}&GetUrl={2}",Eval("LessonDegreeID"),Eval("ClassID"),swq.Web.PathAndQuery())%>'
                                                    ID="hlkEdit" Text="编辑" />
                                            </div>
                                        </td>
                                        <td>
                                            <div class="lab_button dianming">
                                                <asp:HyperLink runat="server" ID="hlkAttend" Text="点名" NavigateUrl='<%# string.Format("Attend.aspx?ClassID={0}&LessonDegreeID={1}&GetUrl={2}",Eval("ClassID"),Eval("LessonDegreeID"),swq.Web.PathAndQuery()) %>'></asp:HyperLink>

                                            </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="backpanel">
                    <label class="lab_button_kuan" id="__mt_labBack" runat="server">
                        <input id="back" causesvalidation="false" type="button" runat="server" onclick="back(this)" value="返回" />
                    </label>
                </div>

                <div class="divremark">
                    <b>注意事项：</b><br />
                    1、点击日期进入学员考勤。<br />
                    2、日期后面红色数字表示当天是星期几。<br />
                    3、点击“清除排课”仅删除未上课的排课，不影响已考勤的排课。<br />
                </div>
            </div>
        </div>
    </form>
</body>
</html>
