private string SaveSoundFile(FileUpload fileupload, ref string strErr) { strErr = string.Empty; if (fileupload.HasFile) { try { string temp = LWGUtils.SaveSoundFile(fileupload, LWGUtils.GetSoundPath(), ref strErr); if (string.IsNullOrEmpty(strErr)) { return(temp); } } catch (Exception ex) { //TODO: uploadfile error return(string.Empty); } } else { strErr = LWGUtils.NO_FILE; } return(string.Empty); }
protected void gvAudios_RowDeleting(object sender, GridViewDeleteEventArgs e) { int productAudioId = (int)gvAudios.DataKeys[e.RowIndex]["AudioId"]; AudioBiz audioBiz = new AudioBiz(); lwg_Audio audio = audioBiz.GetAudioById(productAudioId); if (audio != null) { audioBiz.DeleteCatalogAudio(productAudioId); LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile)); BindData(); } }
protected void dlListenMusics_ItemDataBound(object sender, DataListItemEventArgs e) { lwg_Audio audio = e.Item.DataItem as lwg_Audio; HyperLink hpListenSampleMusic = e.Item.FindControl("hpListenSampleMusic") as HyperLink; HyperLink hpIconListenSampleMusic = e.Item.FindControl("hpIconListenSampleMusic") as HyperLink; if (audio != null && hpListenSampleMusic != null && hpIconListenSampleMusic != null) { string strCompare = "http://"; if (audio.SoundFile.TrimStart().StartsWith(strCompare)) { hpListenSampleMusic.NavigateUrl = audio.SoundFile; hpIconListenSampleMusic.NavigateUrl = audio.SoundFile; } else { hpListenSampleMusic.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile); hpIconListenSampleMusic.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile); } hpListenSampleMusic.Text = "Listen to the sample " + (e.Item.ItemIndex + 1).ToString(); } }
protected void DeleteButton_Click(object sender, EventArgs e) { try { Product product = ProductManager.GetProductById(this.ProductId); if (product != null) { ProductManager.MarkProductAsDeleted(this.ProductId); CustomerActivityManager.InsertActivity( "DeleteProduct", GetLocaleResourceString("ActivityLog.DeleteProduct"), product.Name); //\ delete catalog CatalogBiz cBiz = new CatalogBiz(); lwg_Catalog lwg = cBiz.GetByID(this.ProductId); if (lwg != null) { foreach (lwg_Audio audio in lwg.lwg_Audio) { LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile)); } foreach (lwg_Video video in lwg.lwg_Video) { LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetVideoPath(), video.QTFile)); } cBiz.DeleteCatalog(lwg); } //\ } Response.Redirect("Products.aspx"); } catch (Exception exc) { ProcessException(exc); } }