public string DeleteFile(int fileID)
    {
        BLOTextFile tf;

        tf = BLOTextFile.Edit(fileID);
        try
        {
            System.IO.File.Delete(tf.GetFilePath(Server.MapPath("~/Files")));
        }
        catch
        {
            return(null);
        }
        tf.Delete();
        return(null);
    }
Exemple #2
0
    public static List <int> GetDisplayedFileIDs()
    {
        List <int> displayedFileIDs;

        displayedFileIDs = HttpContext.Current.Session["DisplayedFileIDs"] as List <int>;
        if (displayedFileIDs == null)
        {
            displayedFileIDs = new List <int>();
            foreach (BLOTextFile tf in BLOTextFile.Get(new BLOTextFile.SearchDescriptor()))
            {
                displayedFileIDs.Add(tf.ID);
            }
            HttpContext.Current.Session["DisplayedFileIDs"] = displayedFileIDs;
        }
        return(displayedFileIDs);
    }
    public string GetFileDetails(int fileID)
    {
        StringBuilder sb;
        BLOTextFile   tf;

        sb = new StringBuilder();
        tf = BLOTextFile.Edit(fileID);
        sb.Append("<File>\r\n");
        sb.AppendFormat(" <ID>{0}</ID>\r\n", tf.ID);
        sb.AppendFormat(" <SongName>{0}</SongName>\r\n", tf.SongName);
        sb.AppendFormat(" <ArtistName>{0}</ArtistName>\r\n", tf.ArtistName);
        sb.AppendFormat(" <AlbumName>{0}</AlbumName>\r\n", tf.AlbumName);
        sb.AppendFormat(" <Year>{0}</Year>\r\n", tf.Year.HasValue ? tf.Year.Value.ToString() : "");
        sb.AppendFormat(" <SongWriters>{0}</SongWriters>\r\n", tf.SongWriters);
        sb.AppendFormat(" <Duration>{0}</Duration>\r\n", tf.Duration);
        sb.Append("</File>");
        return(sb.ToString());
    }