protected void gvVideos_RowDeleting(object sender, GridViewDeleteEventArgs e) { int productVideoId = (int)gvVideos.DataKeys[e.RowIndex]["VideoId"]; VideoBiz videoBiz = new VideoBiz(); lwg_Video video = videoBiz.GetVideoById(productVideoId); if (video != null) { videoBiz.DeleteCatalogVideo(productVideoId); LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetVideoPath(), video.QTFile)); BindData(); } }
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 btnDeletePDFFile_Click(object sender, EventArgs e) { CatalogBiz catalogBiz = new CatalogBiz(); lwg_Catalog catalog = catalogBiz.GetByID(this.ProductId); if (catalog != null) { if (!string.IsNullOrEmpty(catalog.PDF)) { LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetPDFPath(), catalog.PDF)); catalog.PDF = string.Empty; catalogBiz.SaveCatalog(catalog); BindingCatalog(); } } }
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); } }
public void SaveCatalogLWG() { Page.Validate("AddEdit"); if (Page.IsValid) { CatalogBiz pBiz = new CatalogBiz(); Product product = ProductManager.GetProductById(ProductId); lwg_Catalog p = pBiz.GetByID(ProductId); if (p == null) { p = new lwg_Catalog(); p.CatalogId = ProductId; lblNote.Text = "Insert error, please try again"; } else { lblNote.Text = "Update error, please try again"; } if (p != null) { // insert data p.CatalogNumber = txtCatalogNumber.Text; p.Duration = txtDuration.Text.TrimStart().TrimEnd(); // "Duration1"; if (!string.IsNullOrEmpty(txtGrade.Text)) { p.Grade = txtGrade.Text; } if (drpInstrumental.Items.Count > 0 && !drpInstrumental.SelectedValue.Equals("-1")) { p.InstrumentalId = int.Parse(drpInstrumental.SelectedValue); } p.KaldbNumber = txtKaldbNumber.Text;// "Kalddbnumber1"; p.pages = txtPages.Text; string tempPDF = string.Empty; string strPDF = SavePDFFile(uploadPDF, ref tempPDF); if (string.IsNullOrEmpty(tempPDF)) { LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetPDFPath(), p.PDF)); p.PDF = strPDF; //TODO: change to uploadfile control } p.PDF = p.PDF == null ? string.Empty : p.PDF; p.Subtitle = txtSubTitle.Text; p.TextLang = txtTextLang.Text; // replace YearTo, YearFrom by Year p.Year = txtYear.Text.Trim(); p.CopyrightYear = txtCopyrightYear.Text.Trim(); p.InstrDetail = txtInstrDetail.Text.TrimStart().TrimEnd(); p.VocAccomp = chkVocAccomp.Checked; p.TableofContents = txtTableofContents.Content; if (string.IsNullOrEmpty(p.SoundIcon)) { p.SoundIcon = string.Empty; } //Save Catalog if (pBiz.SaveCatalog(p)) { // save publisher, genre,... pBiz.SaveCatalogPublisher(p.CatalogId, int.Parse(drpCatalogPublisher.SelectedValue)); if (!string.IsNullOrEmpty(txtCatalogInstrSearch.Text)) { lwg_CatalogInstrumentSearch lwg = new lwg_CatalogInstrumentSearch(); lwg.CatalogId = p.CatalogId; lwg.IntrText = txtCatalogInstrSearch.Text; pBiz.SaveCatalogInstrumentalSearch(lwg); } if (!string.IsNullOrEmpty(txtCatalogNameSearch.Text)) { lwg_CatalogNameSearch lwg = new lwg_CatalogNameSearch(); lwg.CatalogId = p.CatalogId; lwg.Name = txtCatalogNameSearch.Text; pBiz.SaveCatalogNameSearch(lwg); } lblNote.Text = "Save success!"; //ClearData(); } } lblNote.Visible = true; } }