protected void btnAdd_Click(object sender, EventArgs e) { PeriodBiz pBiz = new PeriodBiz(); lwg_Period p; if (string.IsNullOrEmpty(hdfID.Value)) { p = new lwg_Period(); lblNote.Text = "Insert error, please try again"; } else { p = pBiz.GetByID(int.Parse(hdfID.Value)); lblNote.Text = "Update error, please try again"; } if (p != null) { p.Name = txtName.Text; if (pBiz.SavePeriod(p)) { rptPeriod.DataSource = pBiz.GetListPeriod(); rptPeriod.DataBind(); txtName.Text = string.Empty; pnEditPeriod.Visible = false; pnListPeriods.Visible = true; return; } } lblNote.Visible = true; }
private void BindingPeriod() { PeriodBiz pBiz = new PeriodBiz(); rptPeriod.DataSource = pBiz.GetListPeriod(); rptPeriod.DataBind(); }
protected void rptPeriod_ItemCommand(object source, RepeaterCommandEventArgs e) { PeriodBiz pBiz = new PeriodBiz(); lwg_Period p = pBiz.GetByID(int.Parse(e.CommandArgument.ToString())); if (e.CommandName.Equals("EDIT")) { if (p != null) { btnAdd.Text = "Update"; txtTitle.Text = "Update Period"; hdfID.Value = e.CommandArgument.ToString(); pnEditPeriod.Visible = true; pnListPeriods.Visible = false; txtName.Text = p.Name; } } else if (e.CommandName.Equals("DELETE")) { if (p != null) { if (pBiz.DeletePeriod(p)) { BindingPeriod(); } } } }
private void BindingPeriod() { PeriodBiz pBiz = new PeriodBiz(); grdPeriod.DataSource = pBiz.GetListPeriodMappingByCatalogID(ProductId); grdPeriod.DataBind(); }
//protected void gvCatalogInstrTitle_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.DataItem == null) // { // return; // } // lwg_CatalogTitle lg = (lwg_CatalogTitle)e.Row.DataItem; // if (lg != null) // { // Literal ltrProductName = (Literal)e.Row.FindControl("ltrProductName"); // ltrProductName.Text = lg.lwg_Catalog.TitleDisplay; // Literal ltrInstrTitleName = (Literal)e.Row.FindControl("ltrInstrTitleName"); // ltrInstrTitleName.Text = lg.lwg_InstrTitle.Name; // Literal ltrTitleTypeName = (Literal)e.Row.FindControl("ltrTitleTypeName"); // ltrTitleTypeName.Text = lg.lwg_InstrTitle.lwg_TitleType.Name; // LinkButton lnkbtnRemove = (LinkButton)e.Row.FindControl("lnkbtnRemove"); // lnkbtnRemove.CommandArgument = lg.InstrTitleId.ToString(); // } //} //protected void gvCatalogInstrTitle_RowCommand(object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName.Equals("REMOVE")) // { // CatalogBiz cBiz = new CatalogBiz(); // int id = int.Parse(e.CommandArgument.ToString()); // if (cBiz.DeleteCatalogTitle(id,ProductId)) // { // BindingCatalogInstrTitle(); // } // } //} //protected void btnAddInstrTitle_Click(object sender, EventArgs e) //{ // CatalogBiz pBiz = new CatalogBiz(); // if (drpInstrTitle.Items.Count > 0) // { // if (pBiz.SaveCatalogTitle(ProductId, int.Parse(drpInstrTitle.SelectedValue))) // { // BindingCatalogInstrTitle(); // } // } //} //protected void drpTitleType_SelectedIndexChanged(object sender, EventArgs e) //{ // CatalogTitleTypeBiz cttBiz = new CatalogTitleTypeBiz(); // if (drpTitleType.Items.Count > 0) // { // drpInstrTitle.DataSource = cttBiz.GetListInstrTitle(int.Parse(drpTitleType.SelectedValue)); // drpInstrTitle.DataBind(); // } //} //private void BindingCatalogInstrTitle() //{ // CatalogTitleTypeBiz ctBiz = new CatalogTitleTypeBiz(); // gvCatalogInstrTitle.DataSource = ctBiz.GetListCatalogTitleByCatalogID(ProductId); // gvCatalogInstrTitle.DataBind(); //} #endregion private void InitDropdownList() { CatalogTitleTypeBiz cttBiz = new CatalogTitleTypeBiz(); GenerBiz gBiz = new GenerBiz(); PeriodBiz pBiz = new PeriodBiz(); ReprintSourceBiz rBiz = new ReprintSourceBiz(); SeriesBiz sBiz = new SeriesBiz(); drpCatalogGenre.DataSource = gBiz.GetListGenre(); drpCatalogGenre.DataBind(); //drpTitleType.DataSource = cttBiz.GetListTitleType(); //drpTitleType.DataBind(); //if (drpTitleType.Items.Count > 0) //{ // drpInstrTitle.DataSource = cttBiz.GetListInstrTitle(int.Parse(drpTitleType.SelectedValue)); // drpInstrTitle.DataBind(); //} drpPeriod.DataSource = pBiz.GetListPeriod(); drpPeriod.DataBind(); drpReprintSource.DataSource = rBiz.GetListReprintSource(); drpReprintSource.DataBind(); grdReprintsource.DataSource = null; grdReprintsource.DataBind(); drpSeries.DataSource = sBiz.GetListSeries(); drpSeries.DataBind(); grdSeries.DataSource = null; grdSeries.DataBind(); }
protected void grdPeriod_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("REMOVE")) { PeriodBiz pBiz = new PeriodBiz(); int id = int.Parse(e.CommandArgument.ToString()); if (pBiz.DeletePeriodMappingBuyID(id, ProductId)) { BindingPeriod(); } } }
protected void btnPeriodAdd_Click(object sender, EventArgs e) { PeriodBiz pBiz = new PeriodBiz(); lwg_PeriodMapping lwg = new lwg_PeriodMapping(); lwg.CatalogID = ProductId; lwg.PeriodID = int.Parse(drpPeriod.SelectedValue); if (pBiz.SavePeriodMappingByID(lwg)) { BindingPeriod(); } //TODO: save fail }
private void BindPeriod() { PeriodBiz pService = new PeriodBiz(); List <lwg_Period> listPeriod = pService.GetListPeriod(); if (listPeriod != null) { this.drpPeriodStyle.DataSource = listPeriod; this.drpPeriodStyle.DataTextField = "Name"; this.drpPeriodStyle.DataValueField = "PeriodId"; this.drpPeriodStyle.DataBind(); this.drpPeriodStyle.Items.Insert(0, new ListItem("-All Period/Style-", "0")); } }
protected void BindData() { var product = ProductManager.GetProductById(this.ProductId); if (product != null) { ctrlProductRating.Visible = product.AllowCustomerRatings; //Get product extend information CatalogBiz cService = new CatalogBiz(); lwg_Catalog catalog = cService.GetByID(product.ProductId); lProductName.Text = Server.HtmlEncode(product.Name); lProductName1.Text = Server.HtmlEncode(product.Name); lShortDescription.Text = product.ShortDescription; lFullDescription.Text = product.FullDescription; lTableofContents.Text = catalog.TableofContents; ltrSubtitle.Text = catalog.Subtitle; var productPictures = product.ProductPictures; if (productPictures.Count > 1) { defaultImage.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300)); defaultImage.ToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); lvProductPictures.DataSource = productPictures; lvProductPictures.DataBind(); } else if (productPictures.Count == 1) { defaultImage.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300)); defaultImage.ToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); lvProductPictures.Visible = false; } else { defaultImage.ImageUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300)); defaultImage.ToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name); lvProductPictures.Visible = false; } if (catalog != null) { lProductName.Text = catalog.CatalogNumber + " - " + lProductName.Text; //lProductName1.Text = catalog.TitleDisplay; string strCompare = "http://"; AudioBiz audioBiz = new AudioBiz(); //lwg_Audio audio = audioBiz.GetSoundFile(catalog.CatalogId); //if (audio != null) //{ // if (audio.SoundFile.TrimStart().StartsWith(strCompare)) // { // hplListenToTheSample.NavigateUrl = audio.SoundFile; // } // else // { // hplListenToTheSample.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile); // } //} List <lwg_Audio> audioList = audioBiz.GetAllSoundFiles(catalog.CatalogId); if (audioList.Count > 0) { dlListenMusics.DataSource = audioList; dlListenMusics.DataBind(); divListenToTheSample.Attributes.Add("style", "display:block;"); } if (!string.IsNullOrEmpty(catalog.PDF)) { hplPreviewMusic.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetPDFPath(), catalog.PDF); divPreviewMusic.Attributes.Add("style", "display:block;"); } if (catalog.lwg_PersonInRole != null && catalog.lwg_PersonInRole.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (lwg_PersonInRole catComposer in catalog.lwg_PersonInRole.OrderBy(p => p.RoleId)) { if (catComposer.RoleId == LWGUtils.COMPOSER_ROLE_ID) { sb.Insert(0, string.Format("{0} ({1}), ", catComposer.lwg_Person.NameDisplay, catComposer.lwg_Role.Name)); } else { sb.Append(catComposer.lwg_Person.NameDisplay).Append(" (" + catComposer.lwg_Role.Name).Append("), "); } } string composer = sb.ToString(); if (composer.Length > 0) { try { composer = composer.Substring(0, composer.Length - 2); } catch { ; } } ltrComposer.Text = "by " + composer; } else { ltrComposer.Text = string.Empty; } if (product.ProductVariants.Count > 0) { this.ltrPrice.Text = string.Format("{0:c}", product.ProductVariants[0].Price); productVariantRepeater.DataSource = product.ProductVariants.OrderBy(pv => pv.Price); productVariantRepeater.DataBind(); } else { this.ltrPrice.Text = string.Format("{0:c}", "0"); } this.ltrDuration.Text = catalog.Duration; if (catalog.lwg_Instrumental != null) { this.ltrInstrumention.Text = catalog.lwg_Instrumental.LongName; } this.ltrYear.Text = catalog.Year; this.ltrPeriod.Text = string.Empty; List <lwg_PeriodMapping> lstPeriod = new PeriodBiz().GetListPeriodMappingByCatalogID(ProductId); if (lstPeriod != null && lstPeriod.Count > 0) { foreach (lwg_PeriodMapping lwg in lstPeriod) { this.ltrPeriod.Text += lwg.lwg_Period.Name + ", "; } this.ltrPeriod.Text = this.ltrPeriod.Text.Substring(0, this.ltrPeriod.Text.Length - 2); } if (catalog.lwg_CatalogGenre != null && catalog.lwg_CatalogGenre.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (lwg_CatalogGenre catalogGenre in catalog.lwg_CatalogGenre) { sb.Append(catalogGenre.lwg_Genre.Name).Append(", "); } string genre = sb.ToString(); if (genre.Length > 0) { try { genre = genre.Substring(0, genre.Length - 2); } catch { ; } } this.ltrGenre.Text = genre; this.lblGenre.Visible = (genre != ""); // hide when blank field } this.ltrOrigPrint.Text = string.Empty; List <lwg_ReprintSourceMapping> lstReprintSourceMapping = new ReprintSourceBiz().GetListReprintSourceMappingByCatalogID(ProductId); if (lstReprintSourceMapping != null && lstReprintSourceMapping.Count > 0) { foreach (lwg_ReprintSourceMapping lwg in lstReprintSourceMapping) { this.ltrOrigPrint.Text += lwg.lwg_ReprintSource.Name + ", "; } this.ltrOrigPrint.Text = this.ltrOrigPrint.Text.Substring(0, this.ltrOrigPrint.Text.Length - 2); } if (product.ProductCategories != null && product.ProductCategories.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (ProductCategory productCat in product.ProductCategories) { sb.Append(productCat.Category.Name).Append(", "); } string category = sb.ToString(); if (category.Length > 0) { try { category = category.Substring(0, category.Length - 3); } catch { ; } } this.ltrCategory.Text = category; } this.ltrSeries.Text = string.Empty; List <lwg_SeriesMapping> lstSeriesMapping = new SeriesBiz().GetListSeriesMappingByCatalogID(ProductId); if (lstSeriesMapping != null && lstSeriesMapping.Count > 0) { foreach (lwg_SeriesMapping lwg in lstSeriesMapping) { this.ltrSeries.Text += lwg.lwg_Series.Name + ", "; } this.ltrSeries.Text = this.ltrSeries.Text.Substring(0, this.ltrSeries.Text.Length - 2); } this.ltrText.Text = catalog.TextLang; this.lGrade.Text = catalog.Grade; this.ltrCopyrightYear.Text = catalog.CopyrightYear; InitLabels(); // hide if blank field // add Grade Product Info } else { } } else { this.Visible = false; } }