<%@ Page Language="c#" CodeBehind="StuClass.aspx.cs" AutoEventWireup="True" Inherits="SWTraining.Register.StuClass"
    Title="报名管理-学员选班列表" %>

<%@ Register Src="../UserCol/Progress.ascx" TagName="Progress" TagPrefix="uc1" %>
<%@ Import Namespace="SWTraining" %>
<!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="linkStyle" runat="server" href="../Themes/Orange/css.css" rel="stylesheet"
        type="text/css" />
</head>
<body>
    <form id="Form1" method="post" runat="server">

    <script type="text/javascript">
        function Prints() {
            var StuClassID = "";
            for (var i = 0; i < document.forms[0].elements.length; i++) {
                var e = document.forms[0].elements[i];
                if (e.type == "checkbox" && e.id == "id") {
                    if (e.checked) {
                        StuClassID += "," + e.value;
                    }
                }
            }

            if (StuClassID.length > 0) {
                StuClassID = StuClassID.substring(1, StuClassID.length);
                if (document.forms[0].inStudentCard.checked) {
                    document.frames.PrintWeb.location = "../Report/Print.aspx?StuClassID=" + StuClassID + "&Templet=sys_StudentCard.xsl&DocType=2";
                }

                if (document.forms[0].inCourseCard.checked) {
                    document.frames.PrintWeb.location = "../Report/Print.aspx?StuClassID=" + StuClassID + "&Templet=sys_CourseCard.xsl&DocType=2";
                }

                if (document.forms[0].inScore.checked) {
                    document.frames.PrintWeb.location = "../Report/Print.aspx?StuClassID=" + StuClassID + "&Templet=sys_StudentScore.xsl&DocType=3";
                }
            }
        }

        function Checks(checkbox) {
            for (var i = 0; i < document.forms[0].elements.length; i++) {
                var e = document.forms[0].elements[i];
                if (e.type == "checkbox" && e.id == "id") {
                    e.checked = checkbox.checked;
                }
            }
        }
      
    </script>

    <div id="sw_content">
        <div class="divpanel">
            <asp:GridView ID="GridView1" runat="server" CssClass="gridview" AutoGenerateColumns="False"
                DataKeyNames="StuClassID" OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="GridView1_RowDataBound">
                <SelectedRowStyle CssClass="selected" />
                <Columns>
                    <asp:TemplateField HeaderText="选班号">
                        <ItemTemplate>
                            <input type="checkbox" id="id" value='<%#Eval("StuClassID")%>' />
                            <%#Eval("StuClassID")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="学员">
                        <ItemTemplate>
                            <%#Eval("StudentName")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="DateAndTime" ReadOnly="True" HeaderText="选班日期" />
                    <asp:TemplateField HeaderText="班级名称">
                        <ItemTemplate>
                            <asp:HyperLink ID="hlkClassShow" runat="server" Text='<%#Eval("ClassName")%>' NavigateUrl='<%# string.Format("Class.aspx?ClassID={0}&GetURL={1}",Eval("ClassID"),swq.Web.PathAndQuery()) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="上课地点">
                        <ItemTemplate>
                            <%#Eval("SchoolName")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="选班状态">
                        <ItemTemplate>
                            <%#Rs.Items.GetScState(Eval("ScStateID"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="续报">
                        <ItemTemplate>
                            <%#Rs.Items.GetYN(Eval("ContinueReg"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="课时进度">
                        <ItemTemplate>
                            <uc1:Progress ID="Progress1" runat="server" MaxNum='<%#Eval("Lessons") %>' MinNum='<%#Eval("CourseProgress") %>'
                                ProgressWidth="65%" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="PostSchoolName" ReadOnly="True" HeaderText="报名点" />
                    <asp:TemplateField HeaderText="课时库存">
                        <ItemTemplate>
                            <asp:HyperLink ID="hlkBuy" runat="server" Text="课时库存" NavigateUrl='<%# string.Format("BuyLessonsLog.aspx?StuClassID={0}",Eval("StuClassID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="浏览">
                        <ItemTemplate>
                            <asp:HyperLink ID="hlkShow" runat="server" Text="浏览" NavigateUrl='<%# string.Format("StuClassShow.aspx?StuClassID={0}",Eval("StuClassID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="编辑">
                        <ItemTemplate>
                            <asp:HyperLink ID="hlkEdit" runat="server" Text="编辑" NavigateUrl='<%# string.Format("PostStuClass.aspx?StuClassID={0}&StudentID={1}&ClassID={2}&GetURL={3}",Eval("StuClassID"),Eval("StudentID"),Eval("ClassID"),Server.UrlEncode(Request.Url.PathAndQuery)) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="删除">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete" CommandArgument='<%#Eval("UserID")%>'
                                OnClientClick="<%# Rs.Messages.确定删除%>"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <div class="divpanel" style="text-align: left">
            <input onclick="Checks(this)" type="checkbox">全选
            <input id="inStudentCard" name="group" type="radio" checked="checked" />学员证
            <input id="inCourseCard" name="group" type="radio" />听课证
            <input id="inScore" name="group" type="radio" />成绩单 批量打印：
            <asp:HyperLink ID="hlkPrint" runat="server" NavigateUrl='<%#string.Format("javascript:Prints();void(0);") %>'
                ImageUrl='<%# accTheme("print.gif")%>'></asp:HyperLink>
        </div>
        <div class="backpanel">
            <input causesvalidation="false" type="button" runat="server" onclick="back()" value="返回" />
        </div>
    </div>
    </form>
    <iframe id="PrintWeb" width="0" height="0"></iframe>
</body>
</html>
