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);


           }

  • 相关阅读:
    SQL随机生成6位数字
    安装时提示 INSTALL_PARSE_FAILED_MANIFEST_MALFORMED 解决办法
    Windows 7 完美安装 Visual C++ 6.0
    解决js中window.location.href不工作的问题
    DataList中动态显示DIV
    Gridview、DataList、Repeater获取行索引号
    Java多jdk安装
    【CentOS】samba服务器安装与配置
    【CentOS】IBM X3650M4 IMM远程管理【转载】
    【Java】Eclipse导出jar包与javadoc
  • 原文地址:https://www.cnblogs.com/lgzh3/p/1333643.html
Copyright © 2011-2022 走看看