<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_HotelList.aspx.vb"
    Inherits="TourEx.Web.Admin_HotelList" %>
<%@ Import Namespace="TourEx.BLL" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script language="javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/CreateSelect.js"></script>
</head>
<body>
<form runat="server" id="TourExForm">
<ul class="tools">
	<li class="add" p="8"><span><a href="Admin_Hotel.aspx">添加</a></span></li>
	<li class="save" p="9"><span><a href="javascript:void(0);" onclick="Save(0);return false;">保存</a></span></li>
	<li class="del" p="10"><span><a href="javascript:void(0);" onclick="Del(0);return false;">删除</a></span></li>
	<li class="search">地区：<span id="CityList"><asp:HiddenField ID="CityId" runat="server" /></span>
        分类：<span id="CategoryList"><asp:HiddenField ID="CategoryId" runat="server" /></span>
        关键词：<asp:TextBox ID="Key" runat="server" CssClass="searchTitle"></asp:TextBox>
        推荐：<asp:CheckBox ID="TJ" runat="server" />
        最新排序：<asp:CheckBox ID="Order" runat="server" />
        <input type="button" value="" onclick="location='?CID='+$('#CityId').val()+'&TID='+$('#CategoryId').val()+'&TJ='+$('#TJ:checked').length+'&Top='+$('#Top:checked').length+'&Order='+$('#Order:checked').length+'&Key='+$('#Key').val();" class="searchInput"/></li>
</ul>
<div style="display:block;"><asp:Label ID="navIgation" runat="server" Text=""></asp:Label></div>
</form>
    <form id="BatchSubmit" name="BatchSubmit" method="post" action="?act=edit" style="display: none">
    </form>
<asp:Repeater ID="Repeater" runat="server">
    <HeaderTemplate>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabBox">
            <tr class="tabTitleMain">
                <td width="35" class="selectAll">
                    <a href="javascript:void(0);" onclick="$('input[name=\'H_ID\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));">全选</a>
                </td>
                <td width="50">编号</td>
                <td>酒店名称</td>
                <td width="80">排序</td>
                <td width="180">操作</td>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr id="From_<%#Eval("H_ID")%>" class="tabTextMain" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#F4F7FA';">
            <td>
                <input name="H_ID" id="H_ID_<%#Eval("H_ID")%>" type="checkbox" value="<%#Eval("H_ID")%>" />
            </td>
            <td>
                <%#Eval("H_ID")%>
            </td>
            <td>
                <a href="../Hotel/Show.aspx?id=<%#Eval("H_ID")%>" target="_blank"><%#Eval("H_Name")%></a>
            </td>
            <td>
                <input id="H_OrderID_<%#Eval("H_ID")%>" name="H_OrderID_<%#Eval("H_ID")%>" type="text" value="<%#Eval("H_OrderID")%>" ovalue="<%#Eval("H_OrderID")%>" onkeyup="this.value=this.value.replace(/\D/g,'');" size="6" maxlength="6" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="formTitle"/>
            </td>
            <td>
                <a href="javascript:void(0);" onclick="Save(<%#Eval("H_ID")%>);return false;" p="9">保存</a>
                <a href="Admin_HotelOrder.aspx?HId=<%#Eval("H_ID")%>" p="11,12">订单</a> 
                <a href="Admin_HotelPicList.aspx?hid=<%#Eval("H_ID")%>" p="13,14,15">图片</a> 
                <a href="Admin_RoomList.aspx?id=<%#Eval("H_ID")%>" p="18,19,20">房型</a> 
                <a href="Admin_Hotel.aspx?id=<%#Eval("H_ID")%>" p="9">编辑</a> 
                <a href="javascript:void(0);" onclick="Del(<%#Eval("H_ID")%>);return false;" p="10">删除</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
        <asp:Label ID="lblEmpty" Text="暂无" runat="server" Visible="<%#Boolean.Parse((Repeater.Items.Count = 0).ToString())%>"
            Width="100%" Style="text-align: center">     
        </asp:Label>
    </FooterTemplate>
</asp:Repeater>
<webdiyer:AspNetPager ID="TourExPage" runat="server" UrlPaging="true" ShowPageIndexBox="Never"
    PageIndexBoxType="DropDownList" TextBeforePageIndexBox=""
    PageSize="20" OnPageChanged="BindData" EnableTheming="true" FirstPageText="首页"
    LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" CssClass="page" 
        PagingButtonSpacing="" CurrentPageButtonClass="current" 
    CurrentPageButtonStyle="">
</webdiyer:AspNetPager>
<script type="text/javascript">
 <!--//
 var AP='<%=TourEx.BLL.GetSession("AdminPermissions") %>';
 if(AP!='')
 {
    if(AP.indexOf(',8,')==-1)$('*[p="8"]').remove();
    if(AP.indexOf(',9,')==-1)$('*[p="9"]').remove();
    if(AP.indexOf(',10,')==-1)$('*[p="10"]').remove();
    if(AP.indexOf(',13,')==-1)$('*[p="13"]').remove();
    if(AP.indexOf(',11,')+AP.indexOf(',12,')==-2)$('*[p="11,12"]').remove();
    if(AP.indexOf(',13,')+AP.indexOf(',14,')+AP.indexOf(',15,')==-3)$('*[p="13,14,15"]').remove();
    if(AP.indexOf(',18,')+AP.indexOf(',19,')+AP.indexOf(',20,')==-3)$('*[p="18,19,20"]').remove();
}
function Save(ID) {
    var H_IDs = ID == 0 ? $('input[name="H_ID"]') : $('#H_ID_' + ID);
    var H_O;
    $('#BatchSubmit').html('');
    for (var i = 0; i < H_IDs.length; i++) {
        H_O = $('#H_OrderID_' + H_IDs[i].value).val();
        if (H_O != $('#H_OrderID_' + H_IDs[i].value).attr('ovalue')) {
            H_IDs[i].checked = true;
            $('#From_' + H_IDs[i].value).clone().prependTo("#BatchSubmit");
            $('#H_OrderID_' + H_IDs[i].value, '#BatchSubmit').val(H_O);
        }
    }
    if ($('#BatchSubmit').html() == '') { alert('数据没有改动过，无需保存！'); return; }
    $('input[name="H_ID"]', '#BatchSubmit').attr('checked', true);
    $('#BatchSubmit').submit();
}
 function Del(ID)
 {
 	var Url='?Act=del&';
	var IDs;
	if(ID>0)
	{
	    Url += 'H_ID=' + ID;
	}else{
	    IDs = $("input[name='H_ID']").serialize().replace(/&H_ID=/g, ',');
		if(IDs==''){alert('请选择您要删除的酒店！');return;}
		Url +=IDs;
	}
	if(confirm('将删酒店所有的房型、图片、点评、订单、问答等。\n您确定删除吗！')){location=Url;}
 }
 
$(function(){
CreateSelect("CityList","CityId",$('#CityId').val(),3,"选择地区","","City","../");
CreateSelect("CategoryList","CategoryId",$('#CategoryId').val() ,3,"选择分类","","HotelCategory","../");

});
//-->
</script>

</body>
</html>
