Exemple #1
0
 /// <summary>
 /// 根据ID删除模型中的数据
 /// </summary>
 /// <param name="Info"></param>
 public void ModelDelete(HXD.ModelField.Model.Model Info)
 {
     try
     {
         DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset("select * from " + Info.TableName + " where id in(" + Info.Temp + ")");
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             for (int c = 0; c < ds.Tables[0].Columns.Count; c++)
             {
                 if (ds.Tables[0].Rows[i][c].ToString().IndexOf("/") == 0 && ds.Tables[0].Rows[i][c].ToString().Length > 30)
                 {
                     string[] files = ds.Tables[0].Rows[i][c].ToString().Split(',');
                     for (int k = 0; k < files.Length; k++)
                     {
                         if (files[k].IndexOf("/") == 0)
                         {
                             HXD.Common.Utils.DelThumbnail(files[k]); //删除所有缩略图文件
                             FileOperate.DeleteFile(files[k]);        //删除原始文件
                         }
                     }
                 }
                 if (ds.Tables[0].Rows[i][c].ToString().Length > 30)
                 {
                     FileOperate.GetImgTag(ds.Tables[0].Rows[i][c].ToString());//删除内容中的图片
                     //FileOperate.DelFiles(ds.Tables[0].Rows[i][c].ToString(), "url", "flv");//删除内容中的Flv
                 }
             }
         }
         SQLHelper.ExecuteNonQuery("ModelDelete", Info.Temp, Info.TableName);
     }
     catch { }
 }