<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gift_editlist.aspx.cs" Inherits="VA.Modules.JDingMember.gift.gift_editlist" %>

<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>礼品字典管理</title>    
    <!--#include virtual="/include/css/editlist.aspx"-->
    <!--#include virtual="/include/js/editlist.aspx"--> 
    <script type="text/javascript">
       
        //添加；
        function add(){
            var shopCode = $("#hfShopCode").val();
            openFrameWindow("添加礼品", 635, 410, "gift_edit.aspx?shopcode=" + shopCode);
        }     
        
        //单条修改；
        function smodify(keyValue, keyName) {
            var ids = keyValue;

            keyName = keyName.replace(/{单引号}/g, "'");
            keyName = keyName.replace(/{双引号}/g, "\"");

            openFrameWindow("修改礼品("+ keyName +")", 635, 410, "gift_edit.aspx?RID=" + ids);;
            event.stopPropagation();  //阻止事件冒泡，避免行被选中；            
        }

        //单条删除；
        function sdel(keyValue) {
            singleActWrapper("Del", keyValue, "确定要删除该项吗？", "");
        }

        //启用；
        function enable(){            
            batchllyActWrapper("Enable", "", "");
        }

        //停用；
        function disable(){
            batchllyActWrapper("Disable", "", "");
        }   
   
        //导入；
        function dataImport() {
            openListSingleEditWindow(false, "礼品导入", "/modules/member/gift/gift_import.aspx");
        }

        //转为全局字典；
        function convertToGlobal() {
            batchllyActWrapper("ConvertToGlobal", "确定要转为全局字典吗？", "");
        }

        function doWhenServerActSuc(actName, customArg) {
            if (actName == "ConvertToGlobal") {
                completeReload();
            }
        }

        //行双击事件；
        function JTongSmartListTable_trDblclick(trObj) {

            var RID = $(trObj.cells[0]).find("input").eq(0).val();
            var itemName = trObj.cells[3].innerHTML;

            smodify(RID, itemName);
            event.stopPropagation();  //阻止事件冒泡，避免行被选中；
        }

        $(function () {
            initListPage();
        });

    </script>

</head>
<body>
<!--说明：该页面是以 employee_editlist_nofresh_5.aspx 为原型封装的结果-->
<form id="Form1" method="post" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<div id="pageWrapper" class="pageWrapper">   
    
    <div id="toolBar">                          
        <a href="javascript:add()" class="jtongui-toolbarbutton" icon="icon-add">添加</a>
        <a href="javascript:enable()" class="jtongui-toolbarbutton" icon="icon-enable">启用</a>        
        <a href="javascript:disable()" class="jtongui-toolbarbutton" icon="icon-disable">停用</a>      
        <a href="javascript:dataImport()" class="jtongui-toolbarbutton" icon="icon-import">导入</a>                   
        <asp:LinkButton ID="lbnExportToExcel" runat="server" CssClass="jtongui-toolbarbutton" icon="icon-export" OnClick="lbnExportToExcel_Click">导出</asp:LinkButton>        
        <% if (Request.QueryString["range"] == VA.Modules.JDingMember.Core.Enums.GlobalVariables.BIZ_RANGE_LOCAL) { %>
        <a href="javascript:convertToGlobal()" class="jtongui-toolbarbutton" icon="icon-convert">转为全局字典</a>
        <% } %>
        <a href="javascript:refresh()" class="jtongui-toolbarbutton" icon="icon-reload">刷新</a>            
    </div><!--toolBar.END-->   

    <% if (VA.Modules.JDingMember.Core.SystemInfo.SoftInfo.SoftType == VA.Modules.JDingMember.Core.Enums.SoftType.MultiShop) {%>
    <div id="noteBar">
        <p>说明：全局礼品字典为所有连锁门店所共享，本店礼品字典为本店专用；</p>
    </div>       
    <% } %>      
                     
    <div id="searchBar">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

        <asp:DropDownList ID="ddlItemType" runat="server" 
             AutoPostBack="true"
             OnSelectedIndexChanged="ddlItemType_SelectedIndexChanged"
             Visible="false">           
        </asp:DropDownList>

        <asp:DropDownList ID="ddlCategory" runat="server" 
             AutoPostBack="true"
             OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">           
        </asp:DropDownList>

        <asp:DropDownList ID="ddlGiftStatus" runat="server" 
             AutoPostBack="true"
             OnSelectedIndexChanged="ddlGiftStatus_SelectedIndexChanged">           
        </asp:DropDownList>
                               
        <asp:DropDownList ID="ddlSearchField" runat="server" EnableViewState="false">
        <asp:ListItem Value="">检索字段</asp:ListItem>
        <asp:ListItem Value="1">礼品名称</asp:ListItem>
        <asp:ListItem Value="2">礼品代码</asp:ListItem>
        </asp:DropDownList>               
                 
     <%--   <asp:DropDownList ID="ddlSearchType" runat="server" EnableViewState="false">
        <asp:ListItem Value="1">模糊匹配</asp:ListItem>
        <asp:ListItem Value="2">精确匹配</asp:ListItem>
        </asp:DropDownList>  --%>             

        <asp:TextBox ID="txtKeyWords" runat="server"
            CssClass="input keywords"
            Width="150px" />
   
        <asp:Button ID="btnSearch" runat="server" 
             CssClass="simpleBtn"
             Text="查询" 
             Onclick="btnSearch_Click" />
        
        </ContentTemplate>
        </asp:UpdatePanel>

    </div><!--searchBar.END-->    

    <div id="dataBar">

    <!--MainList.Start-->    
    <div class="jtongui-smartlisttable" id="jtongui-smartlisttable">

    <table cellpadding="3" cellspacing="0" class="tableheader" id="tb1_header" >
    <thead>
    <tr>
        <td style="width:30px;text-align:center;"><input type="checkbox" id="ckb_selectAll"/></td>
       <%-- <td style="width:70px;text-align:center;">礼品类型</td>--%>
        <td style="width:70px;text-align:center;">礼品代码</td>
        <td style="width:200px;text-align:center;">礼品名称</td>
        <td style="width:70px;text-align:center;">输入码</td>
        <td style="width:50px;text-align:center;">单位</td>        
        <td style="width:60px;text-align:center;">兑换分值</td>        
        <td style="width:70px;text-align:center;">创建人</td>
        <td style="width:70px;text-align:center;">创建日期</td>        
	    <td style="width:70px;text-align:center;">状态</td>	         
        <td style="width:200px;text-align:center;">备注</td>	
        <td style="width:30px;text-align:center;">修改</td>	    	 
        <td style="width:30px;text-align:center;">删除</td>	    	  	       	        	       	    
        <td></td>
    </tr>    
    </thead>
    </table>

    <div id="dataBody">
    <asp:Repeater ID="myRepeater" Runat="server" EnableViewState="False"  >
    <HeaderTemplate>
    <div class="bodyContainer">
    <% = base.ShowNoRecordInfo() %>    
    <table cellpadding="3" cellspacing="0" class="tablebody" tbHeader="tb1_header">
    </HeaderTemplate>
    <ItemTemplate>
    <tr>
        <td style="text-align:center;"><input type="checkbox" name="ckb_dataItem" value="<%# Eval("RID")%>" /></td>
       <%-- <td align="center"><%# VA.Modules.JDingMember.Core.Enums.GiftTypeConverter.Convert_Value_ToText(Eval("Item_Type").ToString(), true)%></td>--%>
        <td align="center"><%# Eval("Item_Code")%></td>
        <td align="left"><%# Eval("Item_Name")%></td>        
        <td align="center"><%# Eval("Input_Code")%></td>
        <td align="center"><%# Eval("Unit")%></td>                
        <td align="center"><%# Eval("Cost_Points")%></td>                
        <td align="center"><%# Eval("Operator_Name")%></td>	    
        <td align="center"><%# String.Format("{0:yyyy-MM-dd}",Eval("Create_Date"))%></td>
        <td align="center"><%# VA.Modules.JDingMember.Core.Enums.GiftStatusConverter.Convert_Value_ToText(Eval("Status").ToString(),true)%></td>                
        <td align="left"><%# Eval("Remark")%></td>  
        <td align="center">
            <a href="#" onclick="javascript:smodify('<%# Eval("RID")%>','<%# Eval("Item_Name").ToString().Replace("'","{单引号}").Replace("\"","双引号")%>');"><img src="/app_themes/icons/edit.png" alt="修改"/>  </a>
        </td>              	       	     
        <td align="center">
            <a href="#" onclick="javascript:sdel('<%# Eval("RID")%>');"><img src="/app_themes/icons/delete.png" alt="删除"/>  </a>
        </td>                	       	                 	       	     
        <td></td>
    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </div><!--bodyContainer.END-->        

    <div id="divPagerInfo" style="display:none">
       <%=base.pageInfo%>
    </div>

    <input type="hidden" id="hidden_pageCnt" value="<% = base.PageCnt%>" />
    <input type="hidden" id="hidden_rdCnt" value="<% = base.RdCnt%>" />
    <input type="hidden" name="chkNum" value="<%=chkNum%>" />

    </FooterTemplate>
    </asp:Repeater>    
    </div><!--dataBody.END-->

    </div><!--jtongui-smartlisttable.END-->        
    <!--MainList.End-->  

    </div><!--dataBar.END-->

    <div id="pagerBar">
       ……
    </div><!--pageNavBar.END-->
    
    <asp:HiddenField runat="server" ID="hfCurrPage" EnableViewState="true" />
    
</div>

<asp:HiddenField ID="hfShopCode" runat="server" />

</form>
</body>
</html> 