protected void ArchiveFile(object sender, CommandEventArgs e) { var mediaProvider = new MediaProvider(); var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); if (e.CommandName == "Unarchive") { f.Archived = false; } else { f.Archived = true; } mediaProvider.SaveOrUpdate(f); RebindFiles(); }
protected void DeleteFile(object sender, CommandEventArgs e) { var mediaProvider = new MediaProvider(); var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); _defaultFile = string.Empty; //update the project var nodeListingProvider = new NodeListingProvider(); IListingItem project = nodeListingProvider.GetListing((int)ProjectId); project.DefaultScreenshot = _defaultFile; nodeListingProvider.SaveOrUpdate(project); var mem = Member.GetCurrentMember(); if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) mediaProvider.Remove(f); RebindFiles(); }
protected void DeleteFile(object sender, CommandEventArgs e) { var mediaProvider = new MediaProvider(); var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); var mem = Member.GetCurrentMember(); if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) //if the file is the default file we need to clear it out of the system to stop it showing as the default download if (f.Id.ToString() == _defaultFile) { _defaultFile = string.Empty; var nodeListingProvider = new NodeListingProvider(); var project = nodeListingProvider.GetListing((int)ProjectId); project.CurrentReleaseFile = _defaultFile; nodeListingProvider.SaveOrUpdate(project); } mediaProvider.Remove(f); RebindFiles(); }