<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_CosClassStu" Title="问答问题管理" Codebehind="KS.CosClassStu.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">

<asp:Panel ID="ListPanel" runat="server" Width="100%">
   
<div class="listedit">
    <ul>
         <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全部选中</label>
            
        <input type="button" value="删除记录" onmouseover="this.className='button_on';" onmouseout="this.className='button';" class="button" onclick="if (GetIDS('del')){this.form.action='?action=del&roomid=<%=RoomID%>';this.form.submit()}" />
       
        <asp:Button   ID="BtnVerify" runat="server" Text="批量审核" CssClass="button"   onclick="BtnVerify_Click"/> 
        <asp:Button ID="BtnUnVerity" runat="server" CssClass="button" Text="取消审核" onclick="BtnUnVerity_Click"/> 
         
         
         
    </ul>
</div> 
<div class="content-area mt20">
	<div class="myTitle clearfix">
    	<span class="fr">
            <a href="?action=add&roomid=<%=RoomID %>" class="button button_on mr15">添加学生</a>
            <a href="<%=KSCMS.S("action").Equals("add")?"KS.CosClassStu.aspx?roomid="+RoomID+"":"KS.CosClassRoom.aspx" %> " class="button mr20"><%=KSCMS.S("action").Equals("add")?"返回学生列表":"返回班级列表" %></a>
        </span>
        学生管理
			
	</div>
    <div class="quickSearch"><asp:TextBox runat="server" ID="TxtKeyWord" CssClass="textbox" /> 
    
    <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text="开始搜索"  onclick="BtnSearch_Click"  /></div>
<KS:ksgv id="list" cssclass="CTable" runat="server" AutoGenerateColumns="False"  EmptyDataText="没有任何问题!" PagerType="CustomNumeric" Width="99%"  GridLines="None" OnRowCommand="List_RowCommand"  OnRowCreated="List_RowCreated" onrowdatabound="list_RowDataBound">
        <Columns>
         <asp:TemplateField HeaderText="选择">
                <itemstyle horizontalalign="Center" Height="30px" width="30px" />
                <itemtemplate>
                <input type="checkbox"  name="ids" id="ids" value="<%#Eval("studentid") %>" /></itemtemplate></asp:TemplateField>
             <asp:BoundField HeaderText="ID号" DataField="TopicID" Visible="false">
                <itemstyle horizontalalign="Center" />
            </asp:BoundField>

             <asp:TemplateField HeaderText="状态">
              <itemstyle width="30px" horizontalalign="Center"/>
              <itemtemplate>
                   <a href="?action=verify&ids=<%#Eval("studentid")%>" <%# Convert.ToString(Eval("verify"))=="0"?"class='no' title='未审核'":"class='ok' title='已审核'" %>></a>
              </itemtemplate>
            </asp:TemplateField>

                <asp:TemplateField HeaderText="学生ID">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
                <%# Eval("userid") %>
                </itemtemplate>
            </asp:TemplateField>
            
                <asp:TemplateField HeaderText="真实名称">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
                <%# UserManage.GetUserInfo(Utils.StrToInt(Eval("userid").ToString())).RealName  %>
                </itemtemplate>
            </asp:TemplateField>
            
                <asp:TemplateField HeaderText="联系方式">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
                <%#UserManage.GetUserInfo(Utils.StrToInt(Eval("userid").ToString())).Mobile  %>
                </itemtemplate>
            </asp:TemplateField>

              <asp:TemplateField HeaderText="学生名称">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
                <%# UserManage.GetUserInfo(Utils.StrToInt(Eval("userid").ToString())).UserName %>
                </itemtemplate>
            </asp:TemplateField>

			   <asp:BoundField HeaderText="问答数" DataField="askcount">
                <itemstyle verticalalign="Middle"  horizontalalign="Center"/>
            </asp:BoundField>
			 <asp:TemplateField HeaderText="是否评价">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
              <%#Eval("IsPj").ToString() == "1" ? "已评" : "未评"%>
                </itemtemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="加入" DataField="adddate">
                <itemstyle verticalalign="Middle"  horizontalalign="Center"/>
            </asp:BoundField>
               <asp:TemplateField HeaderText="删除">
                <itemstyle horizontalalign="Center" width="25px"/>
                 <itemtemplate>
                 <asp:LinkButton CssClass="delete" ToolTip="删除" runat="server" id="delete" commandargument=<%#Eval("studentid") %> commandname="del"></asp:LinkButton></itemtemplate>
             </asp:TemplateField>
        </Columns><HeaderStyle CssClass="CTitle" />
        <EmptyDataRowStyle CssClass="emptycss" />
    </KS:ksgv>
    <KS:Page ID="Page1" runat="server" />
</asp:Panel>

     
    <asp:Panel ID="AddPanel" runat="server"  Width="100%" Visible="false">
<div class="content-area mt20 pageBlank">

 <div class="t_tybox">
         <div class="myTitle">班级名称：<%=ClassRoomTitle %></div>
       <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="CTable"> 
				<tr>
					<td align="right" class="lefttd" height="30"><strong>用户名：</strong></td>
					<td class="righttd" valign="top">
						<table border="0" width='100%' class="exam_seacher">
							<tr>
								<td class="tag_left" style="width:300px"><span class="top_c_sc"><input name="TxtSJKey" type="text" id="TxtSJKey" class="textbox" style="width:160px;" />
									<input type="button" value="搜索" class="button" onclick="searchSJ();" cssclass="button" style="margin-left: 10px; border-radius: 5px; border: 1px solid #dce2e4;" /></span>
									<br />
									<br />
									<select size="4" name="LstB2" multiple="multiple" id="LstB2" style="height:300px;width:200px;float: left; height: 200px !important; background: #fff"></select>
								</td>
								<td>
									<p>
										<input type="button" value=" > " onclick="addUser()" class="ty_button" />
									</p>
									<br />
									<p>
										<input type="button" value=" < " onclick="delUser()" class="ty_button" />
									</p>
								</td>
								<td class="tag_left" style="line-height: 30px;">指给下列用户：
									<br />
									<br />
									<select size="4" name="LstB1" multiple="multiple" id="LstB1" style="height:300px;width:200px;float: left; height: 200px !important; background: #fff"></select>
								</td>
							</tr>
						</table>
					</td>
				</tr> 
    </table>
	<input name="action" value="save" type="hidden" />
	<input name="roomid" value="<%=RoomID %>" type="hidden" />
     </div>


	 <script>
	 	function CheckForm() {
	 		var idArr = new Array();
	 		var dest = document.getElementById('LstB1');
	 		for (var i = 0; i < dest.options.length; i++) {
	 			dest.options[i].selected = "true";
	 			idArr.push(dest.options[i].value);
	 		}
	 		if (idArr.length <= 0) {
	 			alert("你没有指定用户!");
	 			return false;
	 		}
	 		return true;
	 	}
	 	function searchSJ() {
	 		var key = jQuery("#TxtSJKey").val();
	 		if (key == '') {
	 			KesionJS.Alert("请输入试卷关键字！", "jQuery('#TxtSJKey').focus()");
	 			return false;
	 		} else {

	 			puburl = "/plus/course/CourseAjax.ashx?action=GetUser&RoomID=<%=RoomID%>&Key=" + escape(key)+"";

			jQuery.ajax({
				url: puburl, success: function (d) {

					jQuery("#LstB2").empty();
					jQuery("#LstB2").html(d);
				}
			});

		}
	}
	function addUser() {
		var src = document.getElementById('LstB2');
		var dest = document.getElementById('LstB1');

		for (var i = 0; i < src.options.length; i++) {
			if (src.options[i].selected) {
				var exist = false;
				for (var j = 0; j < dest.options.length; j++) {
					if (dest.options[j].value == src.options[i].value) {
						exist = true;
						break;
					}
				}
				if (!exist) {
					var opt = document.createElement('OPTION');
					opt.value = src.options[i].value;
					opt.text = src.options[i].text;
					dest.options.add(opt);
				}
			}
		}
	}
	function delUser() {
		var dest = document.getElementById('LstB1');

		for (var i = dest.options.length - 1; i >= 0; i--) {
			if (dest.options[i].selected) {
				dest.options[i] = null;
			}
		}
	}

	 </script>
 </div>
        <KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
      
    </asp:Panel>
   

</asp:Content>
