<%@ Page Title="" Language="C#"  MasterPageFile="~/Admin/SiteMenu.Master" AutoEventWireup="true" CodeBehind="Teacher.aspx.cs" Inherits="Project25175.Teacher" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" href="../assets/css/jquery-ui-1.10.3.full.min.css" />

    <script type="text/javascript">
        function DoubleAddClick() {
            document.getElementById('<%=BT_Add.ClientID %>').click();
        }
        function DoubleEditClick() {
            document.getElementById('<%=BT_Edit.ClientID %>').click();
        }
        function DoubleDelClick() {
            document.getElementById('<%=BtMenuDel.ClientID %>').click();
        }
        //后台调用,区分提示信息底色
        //Danger,Info
        function ChangeMsgClass(MsgType) {
            if (MsgType == "Danger") 
            {
                DivMsg.className = 'alert alert-danger';
            }
            else 
            {
                DivMsg.className = 'alert alert-info';
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
		</script>
		<ul class="breadcrumb">
			<li>
				<i class="<%=PageIcon %>"></i>
                老师维护
			</li>
		</ul>
	</div>

    <div class="page-content">
        <div class="row col-xs-12">
            <div id="DivMsg" class="alert alert-info">
                <i class="icon-hand-right"></i>
                <asp:Label ID="LabMsg" runat="server" Text=" "></asp:Label>
			    <button class="close" data-dismiss="alert">
                <i class="icon-remove"></i>
                </button>
            </div>
        </div>

        <div class="page-header">
            <div class="col-xs-12 widget-box">
                <asp:Button ID="BtMenuList" runat="server" OnClick="BtMenuList_Click" Text="数据列表" CssClass="btn btn-info btn-sm" />
                <asp:Button ID="BtMenuAdd" runat="server" OnClick="BtMenuAdd_Click" Text="添加" CssClass="btn btn-primary btn-sm" />
                <asp:Button ID="BtMenuEdit" runat="server" OnClick="BtMenuEdit_Click" Text="修改" CssClass="btn btn-purple btn-sm" />
                <asp:Button ID="BtMenuDel" runat="server" OnClick="BtMenuDel_Click" Text="删除" CssClass="btn btn-info btn-sm hidden" />
                <asp:Button ID="BtDel" runat="server" Text="删除" CssClass="btn btn-danger btn-sm"/>
                <asp:TextBox runat="server" ID="TxtSearchUser" placeholder="姓名..." CssClass="input-mini"></asp:TextBox>
                <asp:Button ID="BtSearch" runat="server"  CssClass="btn btn-success btn-sm hidden" 
                    Text="查找" onclick="BtSearch_Click" />
				<span >
					<a href="#" data-action="reload"><i class="icon-search nav-search-icon green bigger-140" id="idsearch" title="查找"></i></a>
				</span>       
            </div>
        </div>

        <asp:Panel runat="server" Visible="false" ID="PanelEdit">
            <div id="dialog-edit" class="row clearfix form-actions">
                <div class="form-group col-md-offset-2 col-xs-8" >
				    <label class="col-sm-3 control-label no-padding-right">* ID</label>
	                <asp:TextBox runat="server" id="TxtID_Edit"  CssClass="col-xs-8" ReadOnly="true"/>
                </div>
                <div class="space-4"></div>
			    <div class="form-group col-md-offset-2 col-xs-8" >
				    <label class="col-sm-3 control-label no-padding-right">* 老师账号</label>
	                <asp:TextBox runat="server" id="TxtUserID_Edit"  CssClass="col-xs-8" ReadOnly="true"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">* 姓名</label>
                    <asp:TextBox runat="server" id="TxtUserName_Edit"  CssClass="col-xs-8"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right"> 密码</label>
                    <asp:TextBox runat="server" id="TxtPassword_Edit"  CssClass="col-xs-8" 
                        TextMode="Password"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8" >
                    <label class="col-sm-3 control-label no-padding-right">角色</label>
                    <asp:DropDownList ID="DDLRole_Edit" runat="server" CssClass="col-xs-8">
                    </asp:DropDownList>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">* 身份证</label>
                    <asp:TextBox runat="server" id="TxtIDCard_Edit"  CssClass="col-xs-8"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">毕业学校</label>
                    <asp:TextBox runat="server" id="TxtGraduateSchool_Edit"  CssClass="col-xs-8"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">学历</label>
                    <asp:TextBox runat="server" id="TxtEducation_Edit"  CssClass="col-xs-8"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">职位</label>
                    <asp:TextBox runat="server" id="TxtPosition_Edit"  CssClass="col-xs-8"/>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8" >
                    <label class="col-sm-3 control-label no-padding-right">状态</label>
                    <asp:DropDownList ID="DDLState_Edit" runat="server" CssClass="col-xs-8">
                        <asp:ListItem Value="Y"></asp:ListItem>
                        <asp:ListItem Value="N"></asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8">
                    <label class="col-sm-3 control-label no-padding-right">简介</label>
                    <asp:TextBox ID="TxtIntro_Edit" runat="server" TextMode="MultiLine" 
                        CssClass="col-xs-8"></asp:TextBox>
                </div>
                <div class="space-4"></div>
                <div class="form-group col-md-offset-2 col-xs-8" >
                    <label class="col-sm-3 control-label no-padding-right">备注</label>
                    <asp:TextBox ID="TxtComment_Edit" runat="server" TextMode="MultiLine" 
                        CssClass="col-xs-8"></asp:TextBox>
                </div>
                <div class="space-6"></div>
				<div class="form-group col-xs-12 center">
                    <asp:Button ID="BT_Edit" runat="server" Text="修改" 
                            CssClass="btn btn-info icon-ok bigger-110 hidden " onclick="BT_Edit_Click"/>
                    <button class="btn btn-info" type="button" onclick="DoubleEditClick()">
						<i class="icon-ok bigger-110"></i>
						修改
					</button>
                    <Button id="Button2" type="reset" value="取消"  class="btn" ><i class="icon-undo bigger-110"></i>
					    Reset</Button>
                    <Button id="Button3" type="reset" value="返回"  class="btn" onclick="javascript:history.go(-1)"><i class="icon-backward bigger-110"></i>
					    Back</Button>
                </div>
		    </div><!-- #dialog-message -->
        </asp:Panel>
		
        <div id="dialog-del" class="hide">
			<div class="alert alert-warning bigger-110">
				当前勾选的数据将被删除。
			</div>
			<div class="space-6"></div>
			<p class="bigger-110 bolder center grey">
				<i class="icon-hand-right blue bigger-120"></i>
				确定删除吗?
			</p>
		</div><!-- #dialog-confirm -->



        <asp:Panel runat="server" Visible="false" ID="PanelAdd">         
            <div class="row clearfix form-actions" id="DivAdd">   

	                <div class="form-group col-md-offset-2 col-xs-8" >
					    <label class="col-sm-3 control-label no-padding-right">* 老师账号</label>
                        <div class="space-2"></div>
	                    <asp:TextBox runat="server" id="TxtUserID_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">* 姓名</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtUserName_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">* 密码</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtPassword_ADD"  CssClass="col-xs-6" TextMode="Password"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">* 身份证</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtIDCard_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">毕业学校</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtGraduteSchool_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">学历</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtEducation_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">职位</label>
                        <div class="space-2"></div>
                        <asp:TextBox runat="server" id="TxtPosition_Add"  CssClass="col-xs-6"/>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">状态</label>
                        <div class="space-2"></div>
                        <asp:DropDownList ID="DDLState_Add" runat="server" CssClass="col-xs-2">
                            <asp:ListItem Value="Y"></asp:ListItem>
                            <asp:ListItem Value="N"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">简介</label>
                        <div class="space-2"></div>
                        <asp:TextBox ID="TxtIntro_Add" runat="server" TextMode="MultiLine" 
                            CssClass="col-xs-6"></asp:TextBox>
                    </div>
                    <div class="space-4"></div>
                    <div class="form-group col-md-offset-2 col-xs-8">
                        <label class="col-sm-3 control-label no-padding-right">备注</label>
                        <div class="space-2"></div>
                        <asp:TextBox ID="TxtComment_Add" runat="server" TextMode="MultiLine" 
                            CssClass="col-xs-6"></asp:TextBox>
                    </div>
                    <div class="space-6"></div>
				    <div class="form-group col-xs-12 center">
                        <asp:Button ID="BT_Add" runat="server" Text="新增" 
                                CssClass="btn btn-info icon-ok bigger-110 hidden " OnClick="BT_Add_Click" />
                        <button class="btn btn-info" type="button" onclick="DoubleAddClick()" id="btadd"> 
						    <i class="icon-ok bigger-110"></i>
						    新增
					    </button>
                        <Button id="Reset1" type="reset" value="取消"  class="btn" ><i class="icon-undo bigger-110"></i>
					        Reset
                        </Button>
                    </div>
        </div>
        </asp:Panel>

        <asp:Panel runat="server" Visible="false" ID="PanelData">
            <div class="row">
	            <div class="col-xs-12">
		            <div class="table-responsive">
                        <asp:GridView ID="GridView1" runat="server" 
                            CssClass="table table-striped table-bordered table-hover" 
                            AutoGenerateColumns="False" DataKeyNames="ID" 
                            OnRowDataBound="GridView1_RowDataBound"
                            OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" 
                            OnRowCancelingEdit="GridView1_RowCancelingEdit" AllowPaging="True" 
                            OnPageIndexChanging="GridView1_PageIndexChanging" AllowSorting="True" OnSorting="GridView1_Sorting" >
                            <Columns>
                                <asp:TemplateField HeaderText="选取">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="CheckBoxTitle" runat="server" CssClass="ace"/>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckSelect" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="UserID" HeaderText="老师账号" ReadOnly="True" SortExpression="UserID"/>                                
                                <asp:TemplateField HeaderText="姓名" SortExpression="TeaName">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxtUserName" runat="server" CssClass="col-xs-12" 
                                            Text='<%#Bind("TeaName") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LabUserName" runat="server" Text='<%# Bind("TeaName") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="身份证">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxtIDCard" runat="server" CssClass="col-xs-12" 
                                            Text='<%#Bind("IDCard") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LabIDCard" runat="server" Text='<%# Bind("IDCard") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="密码">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxtPassword" runat="server" CssClass="col-xs-12" TextMode="Password"
                                            Text=""></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LabPassword" runat="server" Text='<%# Bind("Password") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="角色">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DDLRoleName" runat="server" CssClass="col-xs-12" >
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LabRoleName" runat="server" Text='<%# Bind("RoleName") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="状态">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DDLState" runat="server" CssClass="col-xs-12" 
                                            SelectedValue='<%# Bind("state")%>'>
                                            <asp:ListItem Value="Y"></asp:ListItem>
                                            <asp:ListItem Value="N"></asp:ListItem>
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%#Bind("state") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="IsT" HeaderText="班主任" ReadOnly="True" >
                                    <ItemStyle CssClass="col-xs-3" />
                                </asp:BoundField>
                                <asp:CommandField ShowEditButton="True" />
                            </Columns>
                            <PagerSettings Mode="NumericFirstLast" />
                        </asp:GridView>
		            </div><!-- /.table-responsive -->
	            </div><!-- /span -->
            </div>
        </asp:Panel>
    </div>
    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder_Footer" runat="server">
    <script type="text/javascript" src="../assets/js/jquery-2.0.3.min.js"></script>
	<script type="text/javascript">
		window.jQuery || document.write("<script src='../assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
	</script>

	<script type="text/javascript">
		if ("ontouchend" in document) document.write("<script src='../assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
	</script>
	<script type="text/javascript" src="../assets/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../assets/js/typeahead-bs2.min.js"></script>

	<!-- page specific plugin scripts -->
    <!-- page specific plugin scripts -->

	<script type="text/javascript" src="../assets/js/jquery-ui-1.10.3.full.min.js"></script>
	<script type="text/javascript" src="../assets/js/jquery.ui.touch-punch.min.js"></script>

	<!-- ace scripts -->

	<script type="text/javascript" src="../assets/js/ace-elements.min.js"></script>
	<script type="text/javascript" src="../assets/js/ace.min.js"></script>


    <script type="text/javascript">
        jQuery(function ($) {
            //全选确认框
            $('table th input:checkbox').on('click', function () {
                var that = this;
                $(this).closest('table').find('tr > td:first-child input:checkbox')
	            .each(function () {
	                this.checked = that.checked;
	                $(this).closest('tr').toggleClass('selected');
	            });
            });


            //对话框全局
            $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
                _title: function (title) {
                    var $title = this.options.title || '&nbsp;'
                    if (("title_html" in this.options) && this.options.title_html == true)
                        title.html($title);
                    else title.text($title);
                }
            }));

            //            //修改
            //            $("#id-btn-dialog-edit").on('click', function (e) {
            //                e.preventDefault();
            //                var dialog = $("#dialog-edit").removeClass('hide').dialog({
            //                    modal: true,
            //                    title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='icon-ok'></i>修改</h4></div>",
            //                    title_html: true,
            //                    buttons: [
            //	                {
            //	                    text: "Cancel",
            //	                    "class": "btn btn-xs",
            //	                    click: function () {
            //	                        $(this).dialog("close");
            //	                    }
            //	                },
            //	                {
            //	                    text: "OK",
            //	                    "class": "btn btn-primary btn-xs",
            //	                    click: function () {
            //	                        $(this).dialog("close");
            //	                    }
            //	                }]
            //                });
            //            });

            //删除
            $(document.getElementById('<%=BtDel.ClientID %>')).on('click', function (e) {
                e.preventDefault();
                $("#dialog-del").removeClass('hide').dialog(
                {
                    resizable: false,
                    modal: true,
                    title: "<div class='widget-header'><h4 class='smaller'><i class='icon-warning-sign red'></i>删除</h4></div>",
                    title_html: true,
                    buttons: [
						{
						    html: "<i class='icon-trash bigger-110'></i>&nbsp; 确定",
						    "class": "btn btn-danger btn-xs",
						    click: function () {
						        DoubleDelClick();
						    }
						}
						,
						{
						    html: "<i class='icon-remove bigger-110'></i>&nbsp; 取消",
						    "class": "btn btn-xs",
						    click: function () {
						        $(this).dialog("close");
						    }
						}]
                });
            });

            //查询
            $("#idsearch").on('click', function (e) {
                document.getElementById('<%=BtSearch.ClientID %>').click();
            });

//            $("#btadd").on('click', function (e) {
//                document.getElementById('<%=BT_Add.ClientID %>').click();
//            });

        });
    </script>
    

</asp:Content>
