zoukankan      html  css  js  c++  java
  • 物理删除文件 业务层

     public void Delete(string projectID, string strItemID, string strType)
           {
               string AppPath = "";
               HttpContext HttpCurrent = HttpContext.Current;

               if (HttpCurrent != null)
               {
                   AppPath = HttpCurrent.Server.MapPath("~");
               }
               else
               {
                   AppPath = AppDomain.CurrentDomain.BaseDirectory;
                   if (Regex.Match(AppPath, @"\\$", RegexOptions.Compiled).Success)
                       AppPath = AppPath.Substring(0, AppPath.Length - 1);
               }

               //AppPath = AppPath + "\\ResourceFiles\\";

               string strPath = "";
            
              
              DataSet ds=new DataSet();
              ds=GetDataByItemID(projectID,strItemID,strType);
              if(ds!=null&&ds.Tables.Count>0 && ds.Tables[0].Rows.Count>0)
              {
                  for(int i=0;i<ds.Tables[0].Rows.Count;i++)
                  {
                      strPath = ds.Tables[0].Rows[i]["Path"].ToString();
                      strPath = strPath.Substring(2,strPath.Length-2);
                      strPath = AppPath + strPath;
                      File.Delete(strPath);

                  }
              }
              

             
               string strSQL;
               strSQL = "delete from Resource where ProjectInfoID=" + projectID + " and comment='" + strType + "' and  ProcessSetID ='" + strItemID + "' ";
               sa.ExecuteSQL(strSQL);


           }

  • 相关阅读:
    sublime text2 中Emmet常用的技巧 和快捷键
    JS 常用函数
    javascript 事件模型 及 event对象属性总结
    Plant Ecology Journal Club 分享主题和文献列表, 1-7, 2018年秋
    Perl FASTA文件拆分合并
    筛选特定ID的条目信息
    计算可塑性指数RDPI
    【文献摘抄】2018年9月
    重金属在超富集植物与作物间作系统中的植物吸收和富集
    【R统计】主成分分析2——主成分回归
  • 原文地址:https://www.cnblogs.com/lgzh3/p/1333643.html
Copyright © 2011-2022 走看看