private void BindingSeries()
        {
            SeriesBiz sBiz = new SeriesBiz();

            grdSeries.DataSource = sBiz.GetListSeriesMappingByCatalogID(ProductId);
            grdSeries.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();
        }
示例#3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SeriesBiz  pBiz = new SeriesBiz();
            lwg_Series p;

            if (string.IsNullOrEmpty(hdfID.Value))
            {
                p            = new lwg_Series();
                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.SaveSeries(p))
                {
                    rptSeries.DataSource = pBiz.GetListSeries();
                    rptSeries.DataBind();
                    txtName.Text         = string.Empty;
                    pnEditSeries.Visible = false;
                    pnListSeries.Visible = true;
                    return;
                }
            }
            lblNote.Visible = true;
        }
示例#4
0
        protected void rptSeries_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            SeriesBiz  pBiz = new SeriesBiz();
            lwg_Series p    = pBiz.GetByID(int.Parse(e.CommandArgument.ToString()));

            if (e.CommandName.Equals("EDIT"))
            {
                if (p != null)
                {
                    btnAdd.Text          = "Update";
                    txtTitle.Text        = "Update Series";
                    hdfID.Value          = e.CommandArgument.ToString();
                    pnEditSeries.Visible = true;
                    pnListSeries.Visible = false;
                    txtName.Text         = p.Name;
                }
            }
            else if (e.CommandName.Equals("DELETE"))
            {
                if (p != null)
                {
                    if (pBiz.DeleteSeries(p))
                    {
                        BindingSeries();
                    }
                }
            }
        }
示例#5
0
        private void BindingSeries()
        {
            SeriesBiz pBiz = new SeriesBiz();

            rptSeries.DataSource = pBiz.GetListSeries();
            rptSeries.DataBind();
        }
 protected void grdSeries_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("REMOVE"))
     {
         SeriesBiz sBiz = new SeriesBiz();
         int       id   = int.Parse(e.CommandArgument.ToString());
         if (sBiz.DeleteSeriesMappingByID(id, ProductId))
         {
             BindingSeries();
         }
     }
 }
        protected void btnSeries_Click(object sender, EventArgs e)
        {
            SeriesBiz         sBiz = new SeriesBiz();
            lwg_SeriesMapping lwg  = new lwg_SeriesMapping();

            lwg.CatalogID = ProductId;
            lwg.SeriesID  = int.Parse(drpSeries.SelectedValue);
            if (sBiz.SaveSeriesMapping(lwg))
            {
                BindingSeries();
            }
            //TODO: save fail
        }
示例#8
0
        private void BindSeries()
        {
            SeriesBiz         sService   = new SeriesBiz();
            List <lwg_Series> listSeries = sService.GetListSeries();

            if (listSeries != null)
            {
                this.drpSeries.DataSource     = listSeries;
                this.drpSeries.DataTextField  = "Name";
                this.drpSeries.DataValueField = "SeriesId";
                this.drpSeries.DataBind();
                this.drpSeries.Items.Insert(0, new ListItem("-All Series -", "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;
            }
        }