Exemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            art = string.IsNullOrEmpty(hfArtistID.Value) ? new Artist() : new Artist(Convert.ToInt32(hfArtistID.Value));

            art.IsHidden = chkIsHidden.Checked;

            art.AltName = txtArtistAltName.Text;
            art.Name = txtArtistName.Text;

            if (art.ArtistID == 0)
            {
                if (art.Create() > 0)
                {
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (art.Update())
                {
                }
                else
                {
                    return;
                }
            }

            artprop = new ArtistProperty();
            artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
            artprop.PropertyContent = txtArtistDescription.Text;

            if (artprop.ArtistPropertyID == 0)
            {
                artprop.Create();
            }
            else
            {
                artprop.Update();
            }

            artprop = new ArtistProperty();
            artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
            artprop.PropertyContent = txtArtistMetaDescription.Text;

            if (artprop.ArtistPropertyID == 0)
            {
                artprop.Create();
            }
            else
            {
                artprop.Update();
            }

            if (fupArtistPhoto.HasFile)
            {
                artprop = new ArtistProperty();
                artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());
                artprop.PropertyContent = imgArtistPhoto.ImageUrl;

                var b = new Bitmap(fupArtistPhoto.FileContent);
                string saveS = string.Empty;
                Image imgPhoto = null;
                Color theBGColor = Color.Black;
                string fileRoot = ArtistProperty.Artistimageprefix;
                Guid fileGuid = Guid.NewGuid();

                if (ddlBGColor.SelectedValue.ToLower() == "black")
                {
                    theBGColor = Color.Black;
                }
                else if (ddlBGColor.SelectedValue.ToLower() == "white")
                {
                    theBGColor = Color.White;
                }

                // delete main image if exists
                if (!string.IsNullOrEmpty(artprop.PropertyContent))
                {
                    // delete the existing file
                    try
                    {
                        File.Delete(Server.MapPath(artprop.PropertyContent));
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogError(ex);
                    }
                }

                // 300 x 300
                imgPhoto = b;
                imgPhoto = ImageResize.FixedSize(imgPhoto, 300, 300, theBGColor);
                saveS = fileRoot + artprop.ArtistID + "/" + fileGuid + "_main.jpg";

                string artistFolder = ArtistProperty.Artistimageprefix + artprop.ArtistID;

                if (!Directory.Exists(artistFolder))
                {
                    try
                    {
                        Directory.CreateDirectory(Server.MapPath(artistFolder));
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogError(ex);
                    }
                }

                imgPhoto.Save(Server.MapPath(saveS), ImageFormat.Jpeg);
                artprop.PropertyContent = saveS;

                if (artprop.ArtistPropertyID == 0)
                {
                    artprop.Create();
                }
                else
                {
                    artprop.Update();
                }

                ///////////////////////

                artprop = new ArtistProperty();
                artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.TH.ToString());

                // delete main image if exists
                if (!string.IsNullOrEmpty(artprop.PropertyContent))
                {
                    // delete the existing file
                    try
                    {
                        File.Delete(Server.MapPath(artprop.PropertyContent));
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogError(ex);
                    }
                }

                imgPhoto = b;
                imgPhoto = ImageResize.FixedSize(imgPhoto, 75, 75, theBGColor);
                saveS = fileRoot + artprop.ArtistID + "/" + fileGuid + "_thumb.jpg";

                artprop.PropertyContent = saveS;

                if (!Directory.Exists(artistFolder))
                {
                    try
                    {
                        Directory.CreateDirectory(Server.MapPath(artistFolder));
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogError(ex);
                    }
                }

                imgPhoto.Save(Server.MapPath(saveS), ImageFormat.Jpeg);
                artprop.PropertyContent = saveS;

                if (artprop.ArtistPropertyID == 0)
                {
                    artprop.Create();
                }
                else
                {
                    artprop.Update();
                }
            }

            LoadArtistDetail(art.ArtistID);
        }
Exemplo n.º 2
0
        private void GetArtistProfile(Artist art, Videos vids)
        {
            // photo
            var aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());

            if (!string.IsNullOrEmpty(aprop.PropertyContent))
            {
                ViewBag.ArtistPhoto = VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                ViewBag.ThumbIcon = VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
            }

            // meta descriptione
            aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
            if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent;

            // description
            aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
            if (!string.IsNullOrEmpty(aprop.PropertyContent))
                ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false);

            var sngss = new Songs();

            sngss.GetSongsForArtist(art.ArtistID);

            foreach (Song sn1 in sngss)
            {
                vids.GetVideosForSong(sn1.SongID);
            }
        }
Exemplo n.º 3
0
        private void LoadArtistDetail(int artistID)
        {
            art = new Artist(artistID);

            txtArtistAltName.Text = art.AltName;
            txtArtistName.Text = art.Name;
            chkIsHidden.Checked = art.IsHidden;

            artprop = new ArtistProperty();
            artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
            txtArtistDescription.Text = artprop.PropertyContent;

            artprop = new ArtistProperty();
            artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
            txtArtistMetaDescription.Text = artprop.PropertyContent;

            artprop = new ArtistProperty();
            artprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());
            imgArtistPhoto.ImageUrl = artprop.PropertyContent;
        }