<%@ Page language="c#" Codebehind="AgentLevel.aspx.cs" AutoEventWireup="true" Inherits="XpShop.Manage.AgentLevel" %>
<%@ Import Namespace="System.Data"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
	    <!--#include file="inc/head.inc"-->
		<title>AgentLevel</title>
        <%--<script type="text/javascript" src="../inc/calendar.js"></script>--%>
		<script src="inc/agentlevel.js" type="text/javascript"></script>
        <script src="inc/ui.datepicker.cn.js" type="text/javascript"></script>
        <link type="text/css" rel="stylesheet" href="style/ui.datepicker.css" />
        <script type="text/javascript">
        	$(document).ready(function(){
				$("#txtDateFrom").datepicker();
				$("#txtDateTo").datepicker();
			});
        </script>
	</head>
	<body>
	    <div class="container">
		<div class="sub_container">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" />
		<% if(this.Request.QueryString["Action"] == "Manage"){%>推广员等级管理<%}else if(this.Request.QueryString["Action"] == "Add")  {%>推广员等级添加<%}else if(this.Request.QueryString["Action"] == "Modify"){%>推广员等级修改<%}%></div>
		<div class="sub_container_content">
		<form id="Form1" method="post" runat="server">
		    <div class="frame">
		        <div class="frame_title"><asp:Label id="lblAction" runat="server" CssClass="tableHeaderText"></asp:Label></div>
		        <div class="frame_content">
			        <% if(this.Request.QueryString["Action"] == "Manage"){%>
			        <table class="tableBorder" cellspacing="0" cellpadding="0" width="80%" align="center" border="0">
						<tr><input type="button" id="addagentlevel" value="添加推广员等级" class="inputbtn" /></tr>
				        <tr>
					        <td height="23" class="forumRowHighlight" align="left">
						        <asp:datagrid id="dgList" runat="server" AllowPaging="False" PagerStyle-Mode="NumericPages" AutoGenerateColumns="False"
							        DataKeyField="LevelID" Width="100%" HorizontalAlign="Center" HeaderStyle-CssClass="summary-title" OnDeleteCommand="dgList_DeleteCommand">
							        <HeaderStyle Font-Bold="True"></HeaderStyle>
							        <Columns>
								        <asp:TemplateColumn HeaderText="序号">
									        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
									        <ItemTemplate>
										        <%# Container.ItemIndex + 1 %>
									        </ItemTemplate>
								        </asp:TemplateColumn>
										<asp:TemplateColumn HeaderText="推广员等级名称">
									        <HeaderStyle HorizontalAlign="Center" Height="20px"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center" Width="100px" Height="20px"></ItemStyle>
									        <ItemTemplate>
										        <%# DataBinder.Eval(Container.DataItem, "LevelName") %>
									        </ItemTemplate>
								        </asp:TemplateColumn>
										<asp:TemplateColumn HeaderText="下属会员累积消费数量，升级到此级">
									        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center" Width="250px"></ItemStyle>
									        <ItemTemplate>
										        <%# DataBinder.Eval(Container.DataItem, "LevelMoney", "{0:f2}") %>
									        </ItemTemplate>
								        </asp:TemplateColumn>								        
										<asp:TemplateColumn HeaderText="一级大类提成比例">
									        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center"></ItemStyle>
									        <ItemTemplate>
                                                <asp:repeater id="rptEvalReply" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("relation") %>' runat="server">
	                                                <ItemTemplate>
                                                        <span style="line-height:1.5"><%#DataBinder.Eval(Container.DataItem, "[\"Name\"]")%> ： <%#DataBinder.Eval(Container.DataItem, "[\"Ratio\"]")%></span><br />
	                                                </ItemTemplate>
	                                            </asp:repeater>
									        </ItemTemplate>
								        </asp:TemplateColumn>
										<asp:TemplateColumn HeaderText="修改">
									        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
									        <ItemTemplate>
										        <a href="AgentLevel.aspx?Action=Modify&lid=<%# DataBinder.Eval(Container.DataItem, "LevelID") %>">修改</a>
									        </ItemTemplate>
								        </asp:TemplateColumn>
								        <asp:ButtonColumn  HeaderText="删除" Text="&lt;div id=&quot;de&quot; onclick=&quot;javascript:return confirm('警告！！此操作将会删除相应的推广员等级，确认删除吗？')&quot;&gt;删除&lt;/div&gt;" CommandName="Delete">
									        <ItemStyle HorizontalAlign="Center" Width="50px" ></ItemStyle>
								        </asp:ButtonColumn>
							        </Columns>
							        <PagerStyle Mode="NumericPages" Height="20px" HorizontalAlign="center"></PagerStyle>
						        </asp:datagrid>
					        </td>
				        </tr>
			        </table>
			        <%}if(this.Request.QueryString["Action"] == "Add" | this.Request.QueryString["Action"] == "Modify"){%>
			        <table class="ptable" cellspacing="0" cellpadding="0">
				        <tr>
					        <th class="tl">
						        推广员等级名称：
					        </th>
					        <td class="tr">
						        <asp:TextBox id="txtLevelName" runat="server" Width="100px"></asp:TextBox><em>*</em>如金牌推广，钻石推广
					        </td>
				        </tr>
				        <tr>
					        <th class="tl">
						        下属消费者累积消费：
					        </th>
					        <td class="tr">
						        <asp:TextBox id="txtLevelMoney" runat="server" Width="100px"></asp:TextBox><em>*</em>达到金额可升级到此等级
					        </td>
				        </tr>
				        <tr>
					        <th class="tl">
						        一级大类提成比例：
					        </th>
					        <td class="tr">
                                <asp:Repeater Runat="server" ID="rptCatRatio">
                                    <ItemTemplate>
                                        <%#DataBinder.Eval(Container.DataItem,"Name")%> <input type="hidden" name="categoryids" value="<%#DataBinder.Eval(Container.DataItem,"CategoryID")%>" runat=server/><input type="text" name="catratios" style="width:100px;" id="txtCatRatio<%#DataBinder.Eval(Container.DataItem,"CategoryID")%>" runat="server" width="100px"  value="<%#DataBinder.Eval(Container.DataItem,"Ratio")%>"/><em>*</em>0.01代表提成比例为商品价格的1%<br /><br />
                                    </ItemTemplate>
	                            </asp:Repeater>
					        </td>
				        </tr>
				        <tr>
					        <th class="tl"></th>
						    <td class="tr"><asp:Button id="btnSave" OnClick="btnSave_Click" runat="server" Text="保存" CssClass="inputbtn"></asp:Button>
											<input type="button" id="btnCancel" value="取消" class="inputbtn" /></td>
				        </tr>
			        </table>
					        
			        <%}%>
		        </div>
	        </div>
		</form>
		</div>
		</div>
		</div>
	</body>
</HTML>
