<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.CommonCls.asp"-->
<!--#include file="../HSK_Cls/HSK.Label.BaseFunCls.asp"-->
<!--#include file="../HSK_Cls/HSK.AdministratorCls.asp"-->
<!--#include file="../HSK_Cls/HSK.UpFileCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%

Dim KSCls
Set KSCls = New Admin_EnterPrise
KSCls.HSK_Run()
Set KSCls = Nothing

Class Admin_EnterPrise
        Private KS,Param,KSCls,subjectID
		Private Action,i,strClass,RS,SQL,maxperpage,CurrentPage,totalPut,TotalPageNum
        Private Sub Class_Initialize()
		  Set KS=New PublicCls
		  Set KSCls=New ManageCls
		End Sub
        Private Sub Class_Terminate()
		 Call CloseConn()
		 Set KS=Nothing
		End Sub

		Public Sub HSK_Run()
		 With Response
		   	 If Not KS.ReturnPowerResult(0, "M530001") Then          '检查是权限
					 Call KS.ReturnErr(1, "")
					 .End
			 End If
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/Common.js"" language=""JavaScript""></script>"
			  .Write "<script src=""../HSK_JS/jQuery.js"" language=""JavaScript""></script>"
			  .Write "<script src='../HSK_JS/HSK.box.js'></script>"
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  If KS.G("action")<>"ShowNote" Then
			  .Write "<ul id='menu_top'>"
			  .Write "<li class='parent' onclick=""window.parent.frames['BottomFrame'].location.href='Split.asp?OpStr='+escape('团购系统 >> <font color=red>添加团购主题</font>')+'&ButtonSymbol=GOSave';location.href='?action=Add';""><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/a.gif' border='0' align='absmiddle'>添加团购</span></li>"
			  .Write "<li class='parent' onclick=""location.href='GroupBuyInt.asp';""><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/move.gif' border='0' align='absmiddle'>兴趣活动分类管理</span></li>"
			  .Write "<li style='margin-left:30px;margin-top:10px'><strong>查看方式:</strong><a href=""GroupBuy.asp"">所有团购</a> <a href=""GroupBuy.asp?flag=1"">进行中的团购</a>  <a href=""GroupBuy.asp?flag=2"">已结束的团购</a> <a href=""GroupBuy.asp?flag=3"">已锁定的团购</a></li>"
              End If
			  .Write "</ul>"
		End With
		
		
		maxperpage = 30 '###每页显示数
		If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
			Response.Write ("错误的系统参数!请输入整数")
			Response.End
		End If
		If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
			CurrentPage = CInt(Request("page"))
		Else
			CurrentPage = 1
		End If
		If CInt(CurrentPage) = 0 Then CurrentPage = 1
		SubjectID=KS.ChkCLng(KS.S("SubjectID"))
		Param=" where SubjectID=" & SubjectId
		If KS.G("KeyWord")<>"" Then
		  If KS.G("condition")=1 Then
		   Param= Param & " and ProductName like '%" & KS.G("KeyWord") & "%'"
		  ElseiF KS.G("condition")=3 Then
		   Param= Param & " and BrandName like '%" & KS.G("KeyWord") & "%'"
		  Else
		   Param= Param & " and Title like '%" & KS.G("KeyWord") & "%'"
		  End If
		End If

		totalPut = Conn.Execute("Select Count(id) From KS_GroupBuyPro " & Param)(0)
		TotalPageNum = CInt(totalPut / maxperpage)  '得到总页数
		If TotalPageNum < totalPut / maxperpage Then TotalPageNum = TotalPageNum + 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		Select Case KS.G("action")
		 Case "ShowNote" Call ShowNote()
		 Case "Add","Edit" Call ProductNameManage()
		 Case "EditSave" Call DoSave()
		 Case "Del"  Call ProductDel()
		 Case "lock"  Call ProductLock()
		 Case "unlock"  Call ProductUnLock()
		 Case "recommend"  Call Productrecommend()
		 Case "Cancelrecommend" Call ProductCancelrecommend()
		 Case Else
		  Call showmain
		End Select
End Sub

Private Sub showmain()
%>
<div style="height:45px;line-height:45px;font-size:14px;text-align:center;font-weight:Bold">
团购主题:<%=LFCls.GetSingleFieldValue("Select Subject From KS_GroupBuy Where ID=" & SubjectID)%>
</div>
<div style="font-size:14px;text-align:right;font-weight:Bold;padding-right:20px">
<img src="images/qs.gif" align="absmiddle">
<a href="#" onclick="javascript:window.parent.frames['BottomFrame'].location.href='Split.asp?OpStr='+escape('团购系统 >> <font color=red>添加商品</font>')+'&ButtonSymbol=GOSave';location.href='GroupBuyPro.asp?action=Add&subjectid=<%=SubjectID%>'">添加商品</a>
</div>
<script>
  function note(id)
	{  
	onscrolls=false;
    new KesionPopup().PopupCenterIframe("查看备注信息","?Action=ShowNote&id="+id,380,200,'no')
	 }
</script>
<table width="100%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr height="25" align="center" class='sort'>
	<td width='5%' nowrap>选择</th>
	<td nowrap>商品名称</th>
	<td nowrap>商品图片</th>
	<td nowrap>所属品牌</th>
	<td nowrap>市场价</th>
	<td nowrap>现场特价</th>
	<td nowrap>备注</th>
	<td nowrap>录入</th>
	<td nowrap>更新时间</th>
	<td nowrap>状态</th>
	<td nowrap>管理操作</th>
</tr>
<%
	Set Rs = Server.CreateObject("ADODB.Recordset")
	SQL = "select * from KS_GroupBuyPro " & Param & " order by id desc"
	If DataBaseType = 1 Then
		If CurrentPage > 100 Then
			Rs.Open SQL, Conn, 1, 1
		Else
			Set Rs = Conn.Execute(SQL)
		End If
	Else
		Rs.Open SQL, Conn, 1, 1
	End If
	If Rs.bof And Rs.EOF Then
		Response.Write "<tr><td height=""25"" align=center bgcolor=""#ffffff"" colspan=7>该主题下还没有添加任何商品信息！</td></tr>"
	Else
		If TotalPageNum > 1 then Rs.Move (CurrentPage - 1) * maxperpage
		i = 0
%>
<form name=selform method=post action=?action=Del>
<%
	Do While Not Rs.EOF And i < CInt(maxperpage)
		If Not Response.IsClientConnected Then Response.End
		
%>
<tr height="25" class='list' onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'">
	<td align="center" class="splittd"><input type=checkbox name=ID value='<%=rs("id")%>'></td>
	<td style="color:#ff6600" class="splittd"><%=Rs("ProductName")%></td>
	<td align="center" class="splittd">
	<%
	dim photourl:photourl=rs("photourl")
	if photourl="" or isnull(photourl) then photourl="../images/nophoto.gif"
	
	%>
	<img src="<%=photourl%>" width="80" height="60"></td>
	<td align="center" class="splittd">&nbsp;<%=rs("brandname")%>&nbsp;</td>
	<td align="center" class="splittd"><%=rs("pricemarket")%> </td>
	<td align="center" class="splittd"><%=rs("price")%> </td>
	<td align="center" class="splittd">
	<%if rs("remark")="" or isnull(rs("remark")) then
	  response.write "---"
	  else
	  response.write "<a href='#' onclick=""note('" & rs("id") & "');"">查看备注</a>"
	  end if
	%>
	</td>
	<td align="center" class="splittd">&nbsp;<%=rs("inputer")%>&nbsp;</td>
	<td align="center" class="splittd"><%=formatdatetime(rs("adddate"),2)%></td>
	<td align="center" class="splittd"><%
		if rs("Status")=0 then
		  response.write "<font color=blue>锁定</font>"
		else
		 response.write "正常"
		end if
	%></td>
	<td align="center" class="splittd"><a href="?action=Edit&ID=<%=RS("ID")%>&SubjectID=<%=SubjectID%>"  onclick="window.parent.frames['BottomFrame'].location.href='Split.asp?OpStr='+escape('团购系统 >> <font color=red>修改团购信息</font>')+'&ButtonSymbol=GOSave';">修改</a> <a href="?Action=Del&ID=<%=rs("id")%>&SubjectID=<%=SubjectID%>" onclick="return(confirm('确定删除该团购吗？'));">删除</a> 
	
	&nbsp;<%if rs("Status")=0 then%><a href="?Action=lock&id=<%=rs("id")%>&SubjectID=<%=SubjectID%>">锁定</a><%else%><a href="?Action=unlock&id=<%=rs("id")%>&SubjectID=<%=SubjectID%>">解锁</a><%end if%>
		

	</td>
</tr>
<%
		Rs.movenext
			i = i + 1
			If i >= maxperpage Then Exit Do
		Loop
	End If
	Rs.Close:Set Rs = Nothing
%>
<tr>
	<td class='list' onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'" height='25' colspan=11>
	&nbsp;&nbsp;<input id="chkAll" onClick="CheckAll(this.form)" type="checkbox" value="checkbox"  name="chkAll">全选
	<input class=Button type="submit" name="Submit2" value=" 删除选中的商品 " onclick="{if(confirm('此操作不可逆，确定要删除选中的记录吗?')){this.document.selform.submit();return true;}return false;}">
	</td>
</tr>
</form>
<tr>
	<td  colspan=17 align=right>
	<%
	 Call KSCLS.ShowPage(totalPut, MaxPerPage, "GroupBuyPro.asp", True, "个", CurrentPage, KS.QueryParam("page"))
	%></td>
</tr>
</table>
<div>
<form action="GroupBuyPro.asp" name="myform" method="get">
   <input type="hidden" value="<%=SubjectID%>" name="subjectid">
   <div style="border:1px dashed #cccccc;margin:3px;padding:4px">
      &nbsp;<strong>快速搜索=></strong>
	 &nbsp;关键字:<input type="text" class='textbox' name="keyword">&nbsp;条件:
	 <select name="condition">
	  <option value=1>按商品名称</option>
	  <option value=2>按标题</option>
	  <option value=3>按品牌</option>
	 </select>
	  &nbsp;<input type="submit" value="开始搜索" class="button" name="s1">
    </div>
</form>
</div>
<%
End Sub

Sub ProductNameManage()
Dim ProductName,AddDate,Address,BrandName,Remark,Price,PhotoUrl,Title,Status,PriceMarket,ShowPhoto,Subjectid
Dim ID:ID=KS.ChkClng(KS.G("ID"))
Dim RS:Set RS=server.createobject("adodb.recordset")
If KS.G("Action")="Edit" Then
	RS.Open "Select top 1 * From KS_GroupBuyPro Where ID=" & ID,conn,1,1
	 If RS.Eof And RS.Bof Then
	  RS.Close:Set RS=Nothing
	  Response.Write "<script>alert('参数传递出错！');history.back();</script>"
	  Response.End
	 Else
	   ProductName=RS("ProductName")
	   BrandName=RS("BrandName")
	   AddDate=RS("AddDate")
	   Price=RS("Price")
	   PriceMarket=rs("PriceMarket")
	   Remark=RS("Remark")
	   BrandName=RS("BrandName")
	   PhotoUrl=RS("PhotoUrl")
	   Subjectid=RS("Subjectid")
	   IF PhotoUrl="" Or IsNull(PhotoUrl) Then
	    ShowPhoto="../images/nopic.gif"
	   Else
	    ShowPhoto=PhotoUrl
	   End IF
	   Title=RS("Title")
	   Status=RS("Status")
	 End If
Else
  AddDate=Now
  Status=1
  PriceMarket=0:Price=0
  Subjectid=KS.ChkClng(KS.G("Subjectid"))
  ShowPhoto="../images/nopic.gif"
 End If
%>
<script>
function CheckForm()
{
	if ($('#ProductName').val()=='')
	{
	 alert('请输入商品名称!');
	 $("#ProductName").focus();
	 return false;
	}
	if ($('#Price').val()=='')
	{
	 alert('请输入团购价格!');
	 $("#Price").focus();
	 return false;
	}
document.myform.submit();
}
</script>
<div style="height:45px;line-height:45px;font-size:14px;text-align:center;font-weight:Bold">
团购主题:<%=LFCls.GetSingleFieldValue("Select Subject From KS_GroupBuy Where ID=" & SubjectID)%>
</div>

<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="ctable">
 <form name="myform" action="?action=EditSave" method="post" enctype="multipart/form-data">
   <input type="hidden" value="<%=ID%>" name="id">
   <input type="hidden" value="<%=SubjectID%>" name="Subjectid">
   <input type="hidden" value="<%=request.servervariables("http_referer")%>" name="comeurl">
          <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>产品名称：</strong></td>
           <td width="431" height='30'>&nbsp;<input type='text' name='ProductName' id='ProductName' value='<%=ProductName%>' size="40"> <font color=red>*</font></td>
           <td width="357">&nbsp;</td>
          </tr> 
		   <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>品牌名称：</strong></td>
           <td height='30'>&nbsp;<input type='text' name='BrandName' value="<%=BrandName%>" size="40"/></td>
           <td rowspan="3" style="text-align:center"><div id="pic" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);height:100px;width:95px;border:1px solid #777777">
						<img src="<%=ShowPhoto%>" style="height:100px;width:95px;border:1px solid #cccccc;">
			 </div></td>
	      </tr>  
		   <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>产品图片：</strong></td>
           <td height='30'>&nbsp;<input class="textbox" type="file" name="photo" size="40" onchange='document.getElementById(&quot;pic&quot;).innerHTML=&quot;&quot;;document.getElementById(&quot;pic&quot;).filters.item(&quot;DXImageTransform.Microsoft.AlphaImageLoader&quot;).src=this.value;' />             <font color=red>*</font>
		   <br />&nbsp;&nbsp;<font color=blue>请上传少于200K的图片,支持jpg,gif,png格式</font>
		   
		   </td>
          </tr>  
		   <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>标题：</strong></td>
           <td height='30'>&nbsp;<input type='text' name='Title' value="<%=Title%>" size="40"/></td>
          </tr>  
		  <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>市场价：</strong></td>
           <td height='30' colspan="2">&nbsp;<input type='text' name='PriceMarket' value="<%=PriceMarket%>" size="15"/> 
             如 100元/米</td>
          </tr>  
		  <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>团购价：</strong></td>
           <td height='30' colspan="2">&nbsp;<input type='text' name='Price' id='Price' value="<%=Price%>" size="15"/>
如 80元/米</td>
          </tr>  
		  
		   
          <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>发布时间：</strong></td>
            <td height='30' colspan="2">&nbsp;<select name="AddDate1">
                               <%
					  for i=year(now) to year(now)+1
					   if trim(year(AddDate))=trim(i) then
					   response.write "<option value=" & i & " selected>" & i & "年</option>"
					   else
					   response.write "<option value=" & i & ">" & i & "年</option>"
					   end if
					  next
					  %>
                    </select>
							 
                             <select name="AddDate2">
                               <%
					  for i=1 to 12
					   if trim(month(AddDate))=trim(i) then
					   response.write "<option value=" & i & " selected>" & i & "月</option>"
					   else
					   response.write "<option value=" & i & ">" & i & "月</option>"
					   end if
					  next
					  %>
                             </select>
                             <select name="AddDate3">
                               <%
					  for i=1 to 31
					   if trim(day(AddDate))=trim(i) then
					   response.write "<option value=" & i & " selected>" & i & "日</option>"
					   else
					   response.write "<option value=" & i & ">" & i & "日</option>"
					   end if
					  next
					  %>
                             </select>
                             <select name="AddDate4">
                               <%
					  for i=0 to 23
					   if trim(hour(AddDate))=trim(i) then
					   response.write "<option value=" & i & " selected>" & i & "时</option>"
					   else
					   response.write "<option value=" & i & ">" & i & "时</option>"
					   end if
					  next
					  %>
                             </select>
                             <select name="AddDate5">
                               <%
					  for i=0 to 59
					   if trim(minute(AddDate))=trim(i) then
					   response.write "<option value=" & i & " selected>" & i & "分</option>"
					   else
					   response.write "<option value=" & i & ">" & i & "分</option>"
					   end if
					  next
					  %>
                           </select></td>
          </tr> 
		   <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>备注：</strong></td>
           <td height='30' colspan="2">&nbsp;<textarea name='Remark' cols="60" rows="8"><%=Remark%></textarea></td>
          </tr>  
		   

		  <tr class="tdbg" onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
            <td  width='160' height='30' align='right' class='clefttitle'><strong>状态：</strong></td>
           <td height='30' colspan="2">&nbsp;
		    <input type="radio" name="Status" value="0"<%if Status=0 then response.write " checked"%>>关闭
			<input type="radio" name="Status" value="1"<%if Status=1 then response.write " checked"%>>正常		   </td>
          </tr>  
		  </table>
		 
 
<%
End Sub

Sub DoSave()
		  	Dim Fobj:Set FObj = New UpFileClass
			on error resume next
			FObj.GetData
			if err.number<>0 then
			 call ks.alerthistory("出错了,文件超出大小",-1)
			 response.End()
			end if
			
	   Dim Subjectid:Subjectid=KS.ChkClng(Fobj.Form("Subjectid"))
	   If Subjectid=0 Then
			 Response.Write "<script>alert('对不起,您没有选择团购主题！');history.back();</script>"
			 Exit Sub
	   End If
       Dim ID:ID=KS.ChkClng(Fobj.Form("id"))
	   Dim ProductName:ProductName=KS.LoseHtml(Fobj.Form("ProductName"))
       Dim AddDate:AddDate=Fobj.Form("AddDate1") & "-" & Fobj.Form("AddDate2") & "-" & Fobj.Form("AddDate3") & " " & Fobj.Form("AddDate4") & ":" & Fobj.Form("AddDate5")
			if not isdate(AddDate) then
			 Response.Write "<script>alert('添加时间格式不正确！');history.back();</script>"
			 Exit Sub
			End If
	   Dim BrandName:BrandName=KS.LoseHtml(Fobj.Form("BrandName"))
	   Dim Title:Title=KS.LoseHtml(Fobj.Form("Title"))
	   Dim Remark:Remark=Fobj.Form("Remark")
	   Dim PriceMarket:PriceMarket=Fobj.Form("PriceMarket")
	   Dim Price:Price=Fobj.Form("Price")
	   'If Not IsNumeric(PriceMarket) Then
	    'Call KS.AlertHistory("对不起,市场价格格式不正确!",-1)
	   ' Exit Sub
	  ' End If
	   'If Not IsNumeric(Price) Then
	   ' Call KS.AlertHistory("对不起,团购价格不正确!",-1)
		'Exit Sub
	   'End If
	   Dim Status:Status=KS.ChkClng(Fobj.Form("Status"))


			Dim MaxFileSize:MaxFileSize = 200   '设定文件上传最大字节数
			Dim AllowFileExtStr:AllowFileExtStr = "gif|jpg|png"
			Dim FormPath:FormPath = KS.GetUpFilesDir() & "/groupbuy/"
			Call KS.CreateListFolder(FormPath) 
			Dim ReturnValue:ReturnValue = FObj.UpSave(FormPath,MaxFileSize,AllowFileExtStr,"tg" & right(Year(Now),2) & right("0" & Month(Now),2) & right("0" & Day(Now),2) & right("0"&Hour(Now),2) & right("0"&Minute(Now),2) & right("0"&Second(Now),2))
			Select Case ReturnValue
			  Case "errext" Call KS.AlertHistory("文件上传失败,文件类型不允许\n允许的类型有" + AllowFileExtStr + "\n",-1):exit sub
	          Case "errsize"  Call KS.AlertHistory("文件上传失败,文件超过允许上传的大小\n允许上传 " & MaxFileSize & " KB的文件\n",-1):exit sub
			End Select

	   Dim PhotoUrl:PhotoUrl=ReturnValue
	   
		
	   If ProductName="" Then Response.Write "<script>alert('商品名称必须输入');history.back();</script>":response.end

            Dim RS: Set RS=Server.CreateObject("Adodb.RecordSet")
			  RS.Open "Select * From KS_GroupBuyPro Where ID=" & ID,Conn,1,3
			  If RS.Eof And RS.Bof Then
			     RS.AddNEW
				 RS("Inputer")=KS.C("AdminName")
			  End If
			     RS("SubjectID")=SubjectID
			     RS("ProductName")=ProductName
				 RS("BrandName")=BrandName
				 RS("AddDate")=AddDate
				 If PhotoUrl<>"" Then
				 RS("PhotoUrl")=PhotoUrl
				 End If
				 RS("Title")=Title
				 RS("PriceMarket")=PriceMarket
				 RS("Price")=Price
				 RS("Remark")=Remark
				 RS("Status")=Status
		 		 RS.Update
				 If ID=0 Then
				   RS.MoveLast
                   Call KS.FileAssociation(1006,RS("ID"),Remark&RS("PhotoUrl"),0)
				 Else
                   Call KS.FileAssociation(1006,ID,Remark&RS("PhotoUrl"),1)
				 End If
			     RS.Close
				 Set RS=Nothing
				 
				 If ID=0 Then
				  Response.Write "<script>if (confirm('商品发布成功,继续添加吗?')){location.href='?action=Add&Subjectid=" & SubjectId& "';}else{parent.frames['BottomFrame'].location.href='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("团购系统 >> <font color=red>商品管理</font>") & "';location.href='GroupBuyPro.asp?subjectid=" & subjectid & "';}</script>"
				 Else
				 
				  Response.Write "<script>alert('商品修改成功！');parent.frames['BottomFrame'].location.href='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("团购系统 >> <font color=red>商品管理</font>") & "';location.href='"& Fobj.Form("ComeUrl") & "';</script>"
				 End If
				 Set Fobj=Nothing

EnD Sub

'删除
Sub ProductDel()
 Dim ID:ID=KS.G("ID")
 Dim UserName,DefaultTemplateID
 If ID="" Then Response.Write "<script>alert('对不起，您没有选择!');history.back();</script>":response.end
 Conn.execute("Delete From KS_GroupBuyPro Where id In("& id & ")")
 Conn.execute("Delete From KS_UploadFiles Where ChannelID=1006 and InfoID In("& id & ")")
 Response.Write "<script>alert('删除成功！');location.href='" & Request.servervariables("http_referer") & "';</script>"
End Sub


'锁定
Sub ProductLock()
 Dim ID:ID=KS.G("ID")
 If ID="" Then Response.Write "<script>alert('对不起，您没有选择!');history.back();</script>":response.end
 Conn.execute("Update KS_GroupBuyPro Set Status=1 Where id In("& id & ")")
 Response.Write "<script>location.href='" & Request.servervariables("http_referer") & "';</script>"
End Sub
'解锁
Sub ProductUnLock()
 Dim ID:ID=KS.G("ID")
 If ID="" Then Response.Write "<script>alert('对不起，您没有选择!');history.back();</script>":response.end
 Conn.execute("Update KS_GroupBuyPro Set Status=0 Where id In("& id & ")")
 Response.Write "<script>location.href='" & Request.servervariables("http_referer") & "';</script>"
End Sub

Sub ShowNote()
 Response.Write "<style>" & vbcrlf
 Response.Write ".l{margin-left:10px;margin-top:20px;}"
 response.write ".l li{height:20px}"
 response.write "</style>"
 Dim ID:ID=KS.ChkClng(KS.G("ID"))
 Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
 RS.Open "Select Remark From KS_GroupBuyPro Where ID=" & ID,conn,1,1
   Response.Write "<div class='l'>"
   If RS.Eof And RS.Bof Then
     Response.Write "对不起，参数出错！"
   Else
	 Do While Not RS.Eof
	   Response.Write "<li><strong>备注:</strong><font color=#ff6600>" & RS(0) & "</font></li>"
	   RS.MoveNext
	 Loop
   End If
	   Response.Write "</div>"
 RS.Close:Set RS=Nothing
End Sub
End Class
%> 
