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


           }

  • 相关阅读:
    L309 单音节词读音规则(一)-辅音字母发音规则
    L308 New brain cells made throughout life
    L306 词汇题
    L305 发邮件15分钟
    L304 What Is Death?
    2019.3.22 Week 11 : ZigBee power test and field test
    L302 如何避免秃头
    2019.3.22 Week 12 : ZigBee and T/H chamber test
    L300 3月英语课下
    Pycharm使用方法之调整代码字体大小
  • 原文地址:https://www.cnblogs.com/lgzh3/p/1333643.html
Copyright © 2011-2022 走看看