Esempio n. 1
0
    /// <summary>
    /// Radera en fil
    /// </summary>
    /// <param name="selectedFile">Namnet på filen som ska raderas</param>
    private void deleteSelectedFile(string selectedFile)
    {
        //Hämtar rätt fil
        int      activeFolderID = Int32.Parse(folderSelectionExisting.FindControl(Session["activeFolder"].ToString()).ID.Split('_')[1]);
        UserFile fileToDelete   = _userFolders.Folders[activeFolderID].Files.Find(file => file.GetFileName == selectedFile);

        //Raderar filen
        SqlHandler sqlHandler = new SqlHandler();

        sqlHandler.DeleteFile(Session["Username"].ToString(), activeFolderID, fileToDelete.GetFileName);
        fileToDelete.Delete();

        //Uppdaterar filträdet
        getUserFiles(Session["Username"].ToString());
    }