62,041
社区成员
发帖
与我相关
我的任务
分享
//全选或全不选
$(function(){
$('#CheckAll').click(function() {
// 全选或者取消全选
$('input[type=checkbox]').attr("checked", $(this).attr("checked"));
})
});
// 删除按钮
$('#Button1').click(function() {
confirm("确定删除吗?");
var strids = "";
$("input[type=checkbox]:checked:not('#CheckAll')").each(function() {
// 获得ID
strids += $(this).parent().next("td").html()+"|";
// alert(strids);
$('#Hidden2').val(strids);
});
show();
$.ajax({
type:"get",//请求方式
url:"../ajax/DeleteRes.ashx",//载入页面的URL地址
data:{id:strids},
success:function(data){//返回成功的函数
if(data =="0"){
setTimeout("dong();",3000);
setTimeout("window.location.href='../PublicResources/PublicResources.aspx'",500);
}else
if(data=="1")
{
alert('删除失败!');
}else{setTimeout("dong();",3000);
setTimeout("window.location.href='../PublicResources/PublicResources.aspx'",500);}
}
});
});
//获得guid
string fielid = context.Request["id"];
string[] fileids = fielid.TrimEnd('|').Split('|');
Asiastar.NRBLL.File bll = new Asiastar.NRBLL.File();
foreach (string guid in fileids)
{
if (bll.FN_SerchPathByFileId(new Guid(guid)) != null || bll.FN_SerchPathByFileId(new Guid(guid)).Tables[0].Rows.Count > 0)
{
for (int i = 0; i < bll.FN_SerchPathByFileId(new Guid(guid)).Tables[0].Rows.Count; i++)
{ //定义变量接收数据库资源完整路径
string path = bll.FN_SerchPathByFileId(new Guid(guid)).Tables[0].Rows[i]["FilePath"].ToString();
if (!Directory.Exists(path))
{
try
{
//如果存在 在执行对数据库filepath的删除操作
System.IO.File.Delete(path);
}
catch (Exception ex)
{
context.Response.Write(ex.ToString());
}
NRBLL.File nbf = new Asiastar.NRBLL.File();
if (nbf.FN_DeleteRes(new Guid(guid)) == true)
{
context.Response.Write("0");
}
else
{
context.Response.Write("1");
}
}
}
}
}