<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderList.aspx.cs" Inherits="Admin_Order_OrderList"
    EnableViewState="true" %>

<%@ Register Src="../Controls/EditionItem.ascx" TagName="EditionItem" TagPrefix="uc2" %>
<%@ Register Assembly="SnSee.Control" Namespace="SnSee.Control" TagPrefix="cc1" %>
<!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">
    <title></title>
    <link href="../Stylesheet/Main.css" rel="stylesheet" type="text/css" />

    <script src="../Javascript/Common.js" type="text/javascript" language="JavaScript"></script>

    <script src="../Javascript/Calendar.js" type="text/javascript" language="JavaScript"></script>

    <script>
function SetDropWhere2(obj)
{
    if(obj==null)
    {
        return;
    }
    var txtKeyword=document.getElementById("txtKeyword");
    if(txtKeyword==null)
    {
        return;
    }
    if(obj.value=="0")
    {
        txtKeyword.style.display='none';
    }else
    {
        txtKeyword.style.display='';
    }
}
function SetDropWhere(obj)
{
    if(obj==null)
    {
        return;
    }
    var dropWhere2=document.getElementById("dropWhere2");
    var txtKeyword=document.getElementById("txtKeyword");
    if(dropWhere2==null)
    {
        return;
    }
    if(obj.value=="")
    {
        dropWhere2.style.display='none';
        txtKeyword.style.display='none';
    }else
    {
        dropWhere2.style.display='';
        txtKeyword.style.display='';
    }
}
function CheckSearch()
{
    var dropWhere1=document.getElementById("dropWhere1");
    var dropWhere2=document.getElementById("dropWhere2");
    var txtKeyword=document.getElementById("txtKeyword");
    
    if(dropWhere1.value!="" && dropWhere2.value!="0" && txtKeyword.value=="")
    {
        alert("请输入搜索关键词！");
        txtKeyword.focus();
        return false;
    }
}
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <ul class="tool">
            <li>
                <div class="tool_back">
                    <a href="javaScript:history.back(-1)">返回上一步</a></div>
            </li>
        </ul>
        <div class="main_body">
            <h1>
                <asp:Literal ID="litTitle" runat="server"></asp:Literal>订单管理</h1>
            <div class="ht2">
            </div>
            <div class="item">
                <ul class="item_list">
                    <li class="item_list_cell" runat="server" id="itemBoxAll">
                        <div>
                            <a href="OrderList.aspx">全部</a>
                        </div>
                    </li>
                    <asp:Repeater ID="rptStateList" runat="server" OnItemDataBound="rptStateList_ItemDataBound">
                        <ItemTemplate>
                            <li class="item_list_cell" runat="server" id="itemBox">
                                <div>
                                    <asp:HyperLink ID="hlkState" runat="server"><%#Eval("ClassName") %></asp:HyperLink>
                                </div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                    <li class="item_list_cell" runat="server" id="item3">
                        <div>
                            <a href="OrderRecycleList.aspx">回收站</a>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="ht2">
            </div>
            <div class="divbox">
                <div class="padding8px">
                    <asp:Panel ID="pnlSearch" runat="server" DefaultButton="lbtnSearch">
                        <b>搜索：</b>查询条件：<asp:DropDownList ID="dropWhere1" runat="server" onchange="SetDropWhere(this)">
                            <asp:ListItem Value="">全部</asp:ListItem>
                            <asp:ListItem Value="OrderSn">订单号</asp:ListItem>
                            <asp:ListItem Value="UserBaseID">订购用户</asp:ListItem>
                            <asp:ListItem Value="Country">国家</asp:ListItem>
                            <asp:ListItem Value="Province">省份</asp:ListItem>
                            <asp:ListItem Value="City">城市</asp:ListItem>
                            <asp:ListItem Value="ContactPerson">联系人</asp:ListItem>
                            <asp:ListItem Value="Phone">电话</asp:ListItem>
                            <asp:ListItem Value="Fax">传真</asp:ListItem>
                            <asp:ListItem Value="Email">邮箱</asp:ListItem>
                            <asp:ListItem Value="Company">公司</asp:ListItem>
                            <asp:ListItem Value="Address">地址</asp:ListItem>
                            <asp:ListItem Value="PostalCode">邮编</asp:ListItem>
                            <asp:ListItem Value="Message">备注信息</asp:ListItem>
                            <asp:ListItem Value="ProductName">产品名称</asp:ListItem>
                            <asp:ListItem Value="ProductModel">产品型号</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList runat="server" ID="dropWhere2" onchange="SetDropWhere2(this)" Style="display: none;">
                            <asp:ListItem Value="1">包含</asp:ListItem>
                            <asp:ListItem Value="2">等于</asp:ListItem>
                            <asp:ListItem Value="3">不包含</asp:ListItem>
                            <asp:ListItem Value="4">不等于</asp:ListItem>
                            <asp:ListItem Value="0">为空</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox ID="txtKeyword" runat="server" Width="100px" Style="display: none;"></asp:TextBox>
                        状态：<asp:DropDownList ID="dropStateSearch" runat="server" DataTextField="ClassName"
                            DataValueField="ID">
                        </asp:DropDownList>
                        时间：从<asp:TextBox ID="txtStartTime" runat="server" Width="65px"></asp:TextBox><img src="../Images/icon_rq.gif" id="img_begin" align="absmiddle" style="cursor: hand;" onclick="javaScript:popCalendar(document.all('txtStartTime'),'StartColor=\'#9DBCEA\';EndColor=\'White\';HightColor=\'#0066FF\';CurrentColor=\'#E9FF33\';WeekBackColor=\'#D8E4F7\';GridColor=\'#9DBCEA\';BorderColor=\'#D0DFFF\'')">
                        到<asp:TextBox ID="txtEndTime" runat="server" Width="65px"></asp:TextBox><img src="../Images/icon_rq.gif" id="img1" align="absmiddle" style="cursor: hand;" onclick="javaScript:popCalendar(document.all('txtEndTime'),'StartColor=\'#9DBCEA\';EndColor=\'White\';HightColor=\'#0066FF\';CurrentColor=\'#E9FF33\';WeekBackColor=\'#D8E4F7\';GridColor=\'#9DBCEA\';BorderColor=\'#D0DFFF\'')">
                        <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn_bg" OnClick="lbtnSearch_Click"
                            OnClientClick="return CheckSearch()">搜索</asp:LinkButton></asp:Panel>
                </div>
            </div>
            <div class="ht2">
            </div>
            <div class="divbox2">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tbbox">
                    <tr>
                        <th width="3%" class="input_no">
                            <input id="Checkbox1" type="checkbox" onclick="UnSelectCheckBox(this,'chkSelect')" />
                        </th>
                        
                        <th width="8%">
                            订单号
                        </th>
                        <th width="12%">
                            日期
                        </th>
                        <th width="15%"  runat="server" id="boxUser">
                            订购用户
                        </th>
                        <th style="padding: 0px;">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td colspan="5" align="center">
                                        订购产品
                                    </td>
                                </tr>
                                <tr>
                                    <td width="30%" align="center">
                                        产品名称
                                    </td>
                                    <td width="22%" align="center">
                                        型号
                                    </td>
                                    <td width="14%" align="center">
                                        数量
                                    </td>
                                    <td width="16%" align="center" runat="server" id="boxProductPrice">
                                        单价
                                    </td>
                                    <td width="18%" align="center" runat="server" id="boxProductPrice2">
                                        小计
                                    </td>
                                </tr>
                            </table>
                        </th>
                        <th width="7%">
                            状态
                        </th>
                        <th width="7%">
                            操作
                        </th>
                        <th width="18%">
                            处理
                        </th>
                    </tr>
                    <asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand" OnItemDataBound="rptList_ItemDataBound">
                        <ItemTemplate>
                            <tr>
                                <td align="center" class="input_no">
                                    <asp:Literal ID="litID" runat="server" Text='<%#Eval("ID")%>' Visible="false"></asp:Literal>
                                    <asp:CheckBox ID="chkSelect" runat="server" />
                                </td>
                                <td align="center">
                                    <%#Eval("OrderSn")%>
                                </td>
                                <td align="center">
                                    <%#Eval("CreateTime","{0:yyyy-MM-dd}")%>
                                </td>
                                <td align="left" runat="server" id="boxUser2" visible="<%#SnSee.Module.Admin.Admin.ModuleIsOpen(SnSee.Config.SystemModule.User) %>">
                                    <a href="../User/UserDetail.aspx?ID=<%#Eval("UserBaseID")%>">
                                        <%#Eval("UserName") == DBNull.Value ? "未注册用户" : Eval("UserName")%>
                                    </a>
                                </td>
                                <td align="left" style="padding: 0px;">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbbox3">
                                        <asp:Repeater ID="rptProductList" runat="server">
                                            <ItemTemplate>
                                                <tr>
                                                    <td width="30%" align="left" style="text-align: left; padding-left: 2px;">
                                                        <a href="../Product/ProductEdition.aspx?ID=<%#Eval("ProductBaseID") %>"><%#Eval("ProductName") %></a>
                                                    </td>
                                                    <td width="22%" align="left" style="text-align: left; padding-left: 2px;">
                                                        <a href="../Product/ProductEdition.aspx?ID=<%#Eval("ProductBaseID") %>"><%#Eval("ProductModel") %></a>
                                                    </td>
                                                    <td width="14%" align="center">
                                                        <%#Eval("ProductQuantity")%>
                                                    </td>
                                                    <td width="16%" align="center" runat="server" id="boxProductPrice" visible="<%#SnSee.Config.ProductConfig.PriceOpen %>">
                                                        <%#Eval("ProductPrice", "{0:F2}")%>
                                                    </td>
                                                    <td width="18%" align="center" runat="server" id="boxProductPrice2" visible="<%#SnSee.Config.ProductConfig.PriceOpen %>">
                                                        <%#Eval("ProductPrice") != DBNull.Value && Eval("ProductQuantity") != DBNull.Value ? (Convert.ToDecimal(Eval("ProductPrice")) * Convert.ToInt32(Eval("ProductQuantity"))).ToString("F2") : "0"%>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </table>
                                </td>
                                <td align="center">
                                    <asp:Literal ID="litState" runat="server" Text="未处理"></asp:Literal>
                                </td>
                                <td align="center">
                                    <a href="OrderDetail.aspx?OrderBaseID=<%#Eval("ID")%>" title="详情">
                                        <img src="../images/icon_bj.gif" border="0" align="absmiddle" /></a>
                                    <asp:LinkButton ID="lbtnDel" runat="server" ToolTip="将当前订单放入回收站" CommandArgument='<%#Eval("ID")%>'
                                        CommandName="Delete_Command" OnClientClick="return confirm('确认将当前订单放入回收站？')"><img src="../images/icon_hs.gif" border="0" align="absmiddle" /></asp:LinkButton>
                                </td>
                                <td align="center">
                                    <asp:DropDownList ID="dropState" runat="server" DataTextField="ClassName" DataValueField="ID">
                                    </asp:DropDownList>
                                    <asp:LinkButton ID="lbtnState1" runat="server" CssClass="btn_bg" ToolTip="确定已选择操作"
                                        CommandArgument='<%#Eval("ID")%>' CommandName="State_Command" OnClientClick="return confirm('确认将当前订单置为当前状态？')">确定</asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
            <div class="ht2">
            </div>
            <div class="padding4px">
                <input type="button" id="Button7" value="全选" onclick="SelectCheckBox(this, 'chkSelect',1)"
                    class="btn_bg2" />
                <input type="button" id="Button8" value="反选" onclick="UnSelectCheckBox(this,'chkSelect')"
                    class="btn_bg2" />
                <input type="button" id="Button9" value="取消" onclick="SelectCheckBox(this, 'chkSelect',2)"
                    class="btn_bg2" />
                |
                <asp:DropDownList ID="dropState" runat="server" DataTextField="ClassName" DataValueField="ID">
                </asp:DropDownList>
                <asp:Button ID="btnAllState" runat="server" Text="确定设置" CssClass="btn_bg2" OnClientClick="return confirm('确认将当前选中订单设置为已选的状态？')"
                    ToolTip="将当前选中订单设置为已选的状态" OnClick="btnAllState_Click" />
                <asp:Button ID="btnAllDel" runat="server" Text="放入回收站" CssClass="btn_bg2" OnClick="btnAllDel_Click"
                    OnClientClick="return confirm('确认将当前选中订单放入回收站？')" ToolTip="将当前选中订单放入回收站" />
            </div>
            <div class="webpage">
                <cc1:WebPage ID="WebPage1" runat="server" PageSize="20">
                </cc1:WebPage>
                <asp:DataList ID="DataList1" runat="server">
                </asp:DataList>
            </div>
            <div class="ht">
            </div>
            <div class="ht">
            </div>
            <ul class="ac_intro" runat="server" id="boxPageExplain">
                <li class="ac_intro_title">说明：</li>
                <li class="ac_intro_item">1. 订单的管理。</li>
            </ul>
        </div>
    </form>
</body>
</html>
