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


           }

  • 相关阅读:
    Hadoop集群搭建
    计算机网络学习笔记——初探七层模型
    设计模式之——单例模式
    类的六种关系
    简述JMM
    GC四大算法
    堆和堆参数调优
    Redis持久化
    一次完整的http请求过程
    __add__,关于运算符重载(用户权限)
  • 原文地址:https://www.cnblogs.com/lgzh3/p/1333643.html
Copyright © 2011-2022 走看看