Esempio n. 1
0
 public void DeleteDFile(int id)
 {
     try
     {
         string mappth   = System.AppDomain.CurrentDomain.BaseDirectory;
         string fileName = "";
         List <t_DM_DevicesFiles> listfile = bll.t_DM_DevicesFiles.Where(d => d.fk_DID == id).ToList();
         if (listfile.Count > 0)
         {
             listfile.ForEach(d =>
             {
                 fileName = mappth + d.FilePath.Replace("~", "").Replace("/", "\\");
                 DirectoryUtil.DeleteFile(fileName);
                 bll.DeleteObject(d);
             });
             bll.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         string result = ex.ToString();
     }
 }