Exemplo n.º 1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.guidaudio bll = new BLL.guidaudio();
     Model.guidaudio model_audio = null;
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             model_audio = bll.GetGuidAudioModel(id);
             if (model_audio != null)
             {
                 if (File.Exists(Server.MapPath(model_audio.audio_path)))
                 {
                     //如果存在则删除
                     File.Delete(Server.MapPath(model_audio.audio_path));
                 }
             }
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
     this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }