<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_ShopList, LebiMall" %>
<%@ 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">
    <title>店铺管理</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/checked.js"></script>
    <script type="text/javascript" src="../images/js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" language="javascript" src="js/topHead.js"></script>
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script type="text/javascript">
        var page='<%=page %>';
        function updete(id_,i){
            var txtname=document.getElementById('txt_name'+i).value;
            var txtaddress=document.getElementById('txt_address'+i).value;
            var txtphone=document.getElementById('txt_phone'+i).value;
            var txtendtime=document.getElementById('txt_endtime'+i).value;
            var txtremark=document.getElementById('txt_remark'+i).value;
            window.location.href="ShopM.aspx?txtname="+escape(txtname)+"&txtaddress="+escape(txtaddress)+"&txtphone="+escape(txtphone)+"&txtendtime="+escape(txtendtime)+"&id="+id_+"&txtremark="+txtremark+"&type=update&page="+page;
        }
        function edit(id){
            window.location.href="ShopEdit.aspx?id="+id+"&page=open";
        }
        function del(id){
            if (confirm("是否要将店铺放入回收站？")) {
                window.location.href="ShopM.aspx?id="+id+"&type=recycle&page="+page;
            }
        }
        function updates(){
            var form =document.forms[0];
            var flag=false;
            var regu = "^(txt_remark)";
            for(i=0;i<form.elements.length;i++)
            {
                if(form.elements[i].id!="strkey"){
                    if(form.elements[i].type=="text")
                    {   
                        var dd=form.elements[i].name;
                        var re = new RegExp(regu);
                        if(dd.search(re)!=-1)      
    	                {     
                           flag=true;    
    	                }     
    	                else     
    	                {   
                            if(form.elements[i].value==""){
                            document.getElementById("msg").innerHTML="<span class='msg_submit'>以下填写不能为空！</span>";
                                flag=false;
                                break;
                            }else{
                                flag=true;
                            }
     	                }  
                    }       
                }
            }
            if(flag){
                document.getElementById("form1").submit();
            }
        }
        function dels(){
            var form =document.forms[0];
            var strid="";
            if (confirm("是否要将店铺放入回收站？")) {
                for(i=0;i<form.elements.length;i++)
                {
                    if(form.elements[i].type=="checkbox")
                    {
                        if(form.elements[i].checked==true){
                            strid+=form.elements[i].value+",";
                        }
                    }
                }
                if(strid!="")
                window.location.href="ShopM.aspx?strid="+strid+"&type=recycles&page="+page;
            }
        }
        function select(){
            var strkey=document.getElementById("strkey").value;
            window.location.href="ShopList.aspx?strkey="+escape(strkey)+"&page=1";
        }
    </script>
</head>
<body>
<form id="form1" runat="server" method="post">
<script>header(1,0,"images/");</script>
        <div class="blank clearfix"></div>
        <!--功能区-->
        <div class="tabmenus mainwidth">
             <ul>
            <li class="current"><a href="Shoplist.aspx"><span>店铺管理</span></a></li>
            <li><a href="ShoplistClose.aspx"><span>过期店铺管理</span></a></li>
             <li><a href="ShopListOver.aspx"><span>过期店铺管理</span></a></li>
             <li><a href="ShopListR.aspx"><span>回收站</span></a></li>
        </ul>
        </div>
        <div class="tab-mainbody">
            <div class="tab-mainbody2">
                <div class="functionHandleArea clearfix" style="padding:3px 0 3px 4px" >
                <table cellpadding="0" cellspacing="0">
                        <tr><td>
                   <input type="text" id="strkey" class="input" style="width:150px;" runat=server /><input type="button"  title=" 查询 " onclick="location.href='javascript:select()';return false;" class="btn-search" align="absmiddle"></td>
                 </tr><tr><td style="height:30px;">
                  <input type="image"  title=" 保存 " onclick="updates();return false;" src="images/bt_app.gif" align="absmiddle">
                    <input type="image"  title=" 回收站 " onClick="dels();return false;" src="images/bt_delete.gif" align="absmiddle">
                    <span id="msg"></span>
            </td></tr></table>
            </div>
                <div id="datalist">
        <table cellpadding="0" cellspacing="0" width="100%" border="0" id="list">
            <tr>
                <th style="width: 6%; cursor: pointer;" title="全选" onclick="AllChecked()">
                    选择</th>
                <th style="width: 8%">
                    店铺名称</th>
                <th style="width: 15%">
                    联系地址
                </th>
                <th style="width: 10%">
                    联系电话
                </th>
                <th style="width: 15%">
                    用户名
                </th>
                <th style="width: 15%">
                    到期时间
                </th>
                <th style="width: 14%">
                    备注
                </th>
                <th style="width: 17%">
                    操作
                </th>
            </tr>
            <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++){%>
            <tr class="row">
                <td class="row">
                    <input type="checkbox" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                    <input type="hidden" id="hidden_id<%=i %>" name="hidden_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>"/>
                </td>
                <td class="row">
                    <input type="text" id="txt_name<%=i %>" name="txt_name<%=i %>" value="<%=ds.Tables[0].Rows[i]["Sname"] %>"
                        class="input" style="width:70px;" />
                </td>
                <td class="row">
                    <input type="text" id="txt_address<%=i %>" name="txt_address<%=i %>" value="<%=ds.Tables[0].Rows[i]["Saddress"] %>"
                        class="input" />
                </td>
                <td class="row">
                    <input type="text" id="txt_phone<%=i %>" name="txt_phone<%=i %>" value="<%=ds.Tables[0].Rows[i]["Sphone"] %>"
                        class="input" style="width:100px;"/>
                </td>
                <td class="row">
                    <%=subStr(ds.Tables[0].Rows[i]["username"].ToString()) %>
                </td>
                <td class="row">
                    <input type="text" id="txt_endtime<%=i %>" name="txt_endtime<%=i %>" value="<%=dateFormat(ds.Tables[0].Rows[i]["Endtime"].ToString()) %>"
                                class="texttime" style="width:100px;" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" />
                </td>
                <td class="row">
                <input type="text" id="txt_remark<%=i %>" name="txt_remark<%=i %>" value="<%=ds.Tables[0].Rows[i]["Sremark"] %>"
                        class="input" style="width:120px;"/>
                    
                </td>
                <td class="row">
                    <a href="javascript:edit(<%=ds.Tables[0].Rows[i]["id"] %>)" >编辑</a>&nbsp;|&nbsp;
                    <a href="javascript:del(<%=ds.Tables[0].Rows[i]["id"] %>)">放入回收站</a>&nbsp
                </td>
            </tr>
            <%} %>
            <tr>
                <td colspan="8" class="list-foot">
                    <div class="fy">
                        <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                            runat="server" RecordCount="228" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                            PrevPageText="上一页" PageSize="20" UrlPaging="True" NumericButtonCount="5">
                        </webdiyer:AspNetPager>
                    </div>
                </td>
            </tr>
        </table>
        <script type="text/javascript">tdshowm("list");</script>
    </div></div>
</div>
</form>
</body>
</html>
