Exemplo n.º 1
0
        public bool Delete()
        {
            bool ret = ClientData.Current.DeleteJobFile(this.JobFileId);

            if (ret)
            {
                string physicalPath    = HttpContext.Current.Server.MapPath(this.Path);
                string trashPath       = HttpContext.Current.Server.MapPath(Settings.Default.TrashFolder);
                string safeName        = SiteUtils.ConflictFreeFilename(trashPath, this.Name, 2);
                string fileInTrashPath = trashPath + @"\" + safeName;

                try
                {
                    FileInfo fi = new FileInfo(physicalPath);
                    fi.MoveTo(fileInTrashPath);
                }
                catch
                {
                    throw new Exception(SiteUtils.ExceptionMessageForCustomer("Failed to delete file."));
                }
            }

            return(ret);
        }