当前位置: 首页>>代码示例>>C#>>正文


C# Artist.Create方法代码示例

本文整理汇总了C#中Artist.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Artist.Create方法的具体用法?C# Artist.Create怎么用?C# Artist.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Artist的用法示例。


在下文中一共展示了Artist.Create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VideoSubmit

        public ActionResult VideoSubmit(string video,
            string videoType,
            string personType,
            string footageType,
            string band,
            string song,
            string contestID)
        {
            string invalidSubmissionLink = string.Concat("~/videosubmission.aspx?statustype=", InvalidStatus.ToString());

            if (string.IsNullOrWhiteSpace(video))
            {
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }
            var vir = new VideoRequest {RequestURL = video};

            string vidKey = Utilities.ExtractYouTubeVideoKey(video);
            vir.RequestURL = vir.RequestURL;
            vir.VideoKey = vidKey;

            if (string.IsNullOrWhiteSpace(vir.VideoKey))
            {
                vir.StatusType = InvalidStatus;
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }

            if (string.IsNullOrWhiteSpace(videoType) ||
                string.IsNullOrWhiteSpace(personType) ||
                string.IsNullOrWhiteSpace(footageType) ||
                string.IsNullOrWhiteSpace(band) ||
                string.IsNullOrWhiteSpace(song))
            {
                vir.StatusType = 'P';
                Response.Redirect("~/videosubmission.aspx?statustype=P");
                return new EmptyResult();
            }

            var vid = new Lib.BOL.Video(Provider, vidKey) {ProviderCode = Provider};

            try
            {
                var youTubeVideo = GetYouTubeVideo(vidKey);
                TimeSpan ts = XmlConvert.ToTimeSpan(youTubeVideo.ContentDetails.Duration);
                vid.Duration = (float) Convert.ToDouble(ts.TotalSeconds);
                vid.ProviderUserKey = youTubeVideo.Snippet.ChannelId;
                vid.PublishDate = Convert.ToDateTime(youTubeVideo.Snippet.PublishedAtRaw);
            }
            catch (GDataRequestException gdex)
            {
                vid.IsEnabled = false;
                vid.Update();
                vir.StatusType = InvalidStatus;
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }
            catch (ClientFeedException)
            {
                vir.StatusType = InvalidStatus;
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }
            catch (Exception ex)
            {
                vir.StatusType = InvalidStatus;
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }

            vid.VolumeLevel = 5;

            if (string.IsNullOrWhiteSpace(vid.ProviderKey))
            {
                // invalid
                vir.StatusType = InvalidStatus;
                Response.Redirect(invalidSubmissionLink);
                return new EmptyResult();
            }

            if (vid.VideoID == 0)
            {
                vid.IsHidden = false;
                vid.IsEnabled = true;
                vid.Create();
            }
            else
            {
                // just go to the video...
                vid.Update();
                Response.Redirect(vid.VideoURL);
            }

            // if there is a contest, add it now since there is an id
            int subContestId;

            if (!string.IsNullOrWhiteSpace(contestID) &&
                int.TryParse(contestID, out subContestId) &&
                subContestId > 0)
            {
//.........这里部分代码省略.........
开发者ID:dasklub,项目名称:kommunity,代码行数:101,代码来源:HomeController.cs

示例2: btnSubmit_Click

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                var allartsis = new Artists();
                allartsis.RemoveCache();

                if (gvwRequestedVideos.SelectedDataKey != null)
                {
                    vidreq = new VideoRequest(Convert.ToInt32(gvwRequestedVideos.SelectedDataKey.Value))
                    {
                        StatusType = 'A'
                    };
                    vidreq.Update();
                }

                vid = new Video("YT", txtVideoKey.Text)
                {
                    Duration = (float) Convert.ToDouble(txtDuration.Text),
                    Intro = (float) Convert.ToDouble(txtSecondsIn.Text),
                    LengthFromStart = (float) Convert.ToDouble(txtElasedEnd.Text),
                    ProviderCode = ddlVideoProvider.SelectedValue,
                    ProviderUserKey = txtUserName.Text,
                    VolumeLevel = Convert.ToInt32(ddlVolumeLevel.SelectedValue),
                    IsEnabled = chkEnabled.Checked,
                    EnableTrim = chkEnabled.Checked
                };

                // vid.IsHidden = chkHidden.Checked;

                /// publish date
                var yousettings = new YouTubeRequestSettings("Das Klub", devkey);
                var yourequest = new YouTubeRequest(yousettings);
                var Url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + vid.ProviderKey);
                var video = new Google.YouTube.Video();
                video = yourequest.Retrieve<Google.YouTube.Video>(Url);
                vid.PublishDate = video.YouTubeEntry.Published;

                if (vid.VideoID == 0)
                {
                    vid.Create();
                }
                else
                    vid.Update();

                // if there is a contest, add it now since there is an id
                if (ddlContest.SelectedValue != unknownValue)
                {
                    //TODO: check if it already is in the contest

                    ContestVideo.DeleteVideoFromAllContests(vid.VideoID);

                    var cv = new ContestVideo();

                    cv.ContestID = Convert.ToInt32(ddlContest.SelectedValue);
                    cv.VideoID = vid.VideoID;
                    cv.Create();
                }
                else
                {
                    // TODO: JUST REMOVE FROM CURRENT CONTEST, NOT ALL
                    ContestVideo.DeleteVideoFromAllContests(vid.VideoID);
                }

                // vid type
                if (!string.IsNullOrWhiteSpace(ddlVideoType.SelectedValue)
                    && ddlVideoType.SelectedValue != selectText)
                {
                    propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP);
                    mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                    MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID);
                    mp.RemoveCache();
                    MultiPropertyVideo.AddMultiPropertyVideo(
                        Convert.ToInt32(
                            ddlVideoType.SelectedValue), vid.VideoID);
                }

                // human
                if (!string.IsNullOrWhiteSpace(ddlHumanType.SelectedValue)
                    && ddlHumanType.SelectedValue != selectText)
                {
                    propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN);
                    mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                    MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID);
                    mp.RemoveCache();
                    MultiPropertyVideo.AddMultiPropertyVideo(
                        Convert.ToInt32(
                            ddlHumanType.SelectedValue), vid.VideoID);
                }

                // footage
                if (!string.IsNullOrWhiteSpace(ddlFootageType.SelectedValue)
                    && ddlFootageType.SelectedValue != selectText)
                {
                    propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG);
                    mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                    MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID);
                    mp.RemoveCache();
                    MultiPropertyVideo.AddMultiPropertyVideo(
                        Convert.ToInt32(
//.........这里部分代码省略.........
开发者ID:dasklub,项目名称:kommunity,代码行数:101,代码来源:VideoInput.aspx.cs

示例3: VideoSubmit


//.........这里部分代码省略.........
                //vid.Intro = (float)Convert.ToDouble(txtSecondsIn.Text);
                //vid.LengthFromStart = (float)Convert.ToDouble(txtElasedEnd.Text);
                //vid.ProviderCode = ddlVideoProvider.SelectedValue;
                //vid.ProviderUserKey = txtUserName.Text;
                //vid.VolumeLevel = Convert.ToInt32(ddlVolumeLevel.SelectedValue);
                //vid.IsEnabled = chkEnabled.Checked;
                //// vid.IsHidden = chkHidden.Checked;
                //vid.EnableTrim = chkEnabled.Checked;

                ///// publish date
                //YouTubeRequestSettings yousettings =
                //    new YouTubeRequestSettings("You Manager", devkey, username, password);
                //YouTubeRequest yourequest;
                //Uri Url;

                //yourequest = new YouTubeRequest(yousettings);
                //Url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + vid.ProviderKey);
                //video = new Google.YouTube.Video();
                //video = yourequest.Retrieve<Google.YouTube.Video>(Url);
                //vid.PublishDate = video.YouTubeEntry.Published;

                if (string.IsNullOrWhiteSpace(vid.ProviderKey))
                {
                    // invalid
                    vir.StatusType = 'I';
                    Response.Redirect("~/videosubmission.aspx?statustype=I");
                    return new EmptyResult();
                }

                if (vid.VideoID == 0)
                {
                    vid.IsHidden = false;
                    vid.IsEnabled = true;
                    vid.Create();
                }
                else
                {
                    vid.Update();
                }

                // if there is a contest, add it now since there is an id
                int subContestID = 0;
                if (!string.IsNullOrWhiteSpace(contestID) && int.TryParse(contestID, out subContestID) && subContestID > 0)
                {
                    //TODO: check if it already is in the contest

                    ContestVideo.DeleteVideoFromAllContests(vid.VideoID);

                    ContestVideo cv = new ContestVideo();

                    cv.ContestID = subContestID;
                    cv.VideoID = vid.VideoID;
                    cv.Create();
                }
                else
                {
                    // TODO: JUST REMOVE FROM CURRENT CONTEST, NOT ALL
                    ContestVideo.DeleteVideoFromAllContests(vid.VideoID);
                }

                PropertyType propTyp = null;
                MultiProperty mp = null;

                // vid type

                propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP);
开发者ID:pakoito,项目名称:web,代码行数:67,代码来源:HomeController.cs

示例4: addButton_Click

        // add artist and album
        private void addButton_Click(object sender, EventArgs e)
        {
            try
               {
                string artistName = artistTBox.Text;

                if (artistName == "")
                {
                   Exception ex = new Exception("Please, insert artist's name!");
                   throw ex;
                }

                string gName = genreBox.Text;
                Genre gID = Genre.GetGenreID(gName);
                Artist findartist = Artist.CheckArtist(artistName);

                Artist artist = new Artist();

                if (findartist == null)
                {
                    artist = new Artist(artistName, gID);
                    artist.Create();
                    artist = Artist.CheckArtist(artistName);
                }
                else
                {
                    artist = Artist.CheckArtist(artistName);
                }
                string y = yearBox.Text;

                YearTable year = YearTable.GetYearID(y);

                if (year == null)
                {
                    year = new YearTable(y);
                    year.Create();
                    year = YearTable.GetYearID(y);
                }
                else
                {
                    year = YearTable.GetYearID(y);
                }

                string l = lableBox.Text;
                Lable lable = Lable.GetLableID(l);

                if (lable == null)
                {
                    lable = new Lable(l);
                    lable.Create();
                    lable = Lable.GetLableID(l);
                }
                else
                {
                    lable = Lable.GetLableID(l);
                }

                string af = formatBox.Text;
                AlbumFormat format = AlbumFormat.GetFormatID(af);

                if (format == null)
                {
                    format = new AlbumFormat(af);
                    format.Create();
                    format = AlbumFormat.GetFormatID(af);
                }
                else
                {
                    format = AlbumFormat.GetFormatID(af);
                }

                string alname = albumTBox.Text;

                Album album = new Album(alname, artist, year, lable, format);
                album.Create();

                album = Album.GetAlbumID(alname);

                string[] tracklist = tracklistTBox.Lines;

                TrackList tl;

                for (int i = 0; i < tracklist.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < tracklist[i].Length; ++j)
                    {
                        if (tracklist[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += tracklist[i][j];
//.........这里部分代码省略.........
开发者ID:Apolotary,项目名称:GinTunes,代码行数:101,代码来源:AddMusicControl.cs

示例5: AddByArtist_Click

        private void AddByArtist_Click(object sender, EventArgs e)
        {
            try
            {
                string artistName = artistTBox.Text;

                if (artistName == "")
                {
                    Exception ex = new Exception("Please, insert artist's name!");

                    throw ex;
                }

                string gName = genreBox.Text;
                Genre gID = Genre.GetGenreID(gName);
                Artist findartist = Artist.CheckArtist(artistName);

                Artist artist = new Artist();

                if (findartist == null)
                {
                    artist = new Artist(artistName, gID);
                    artist.Create();
                }
                else
                {
                    MessageBox.Show("Such artist already exists in your library!", "Whoops!");
                }
                MessageBox.Show("Done!^_^", "TheResult");
            }
            catch
            {
                MessageBox.Show("Something bad has happened!", "Whoops!");
            }
        }
开发者ID:Apolotary,项目名称:GinTunes,代码行数:35,代码来源:AddMusicControl.cs

示例6: AddButtClick

        public void AddButtClick()
        {
            try
            {
                if (_addMusicControl.ArtistAdd == "")
                {
                    Exception ex = new Exception("Please, insert artist's name!");
                    throw ex;
                }

                Genre gId = Genre.GetGenreID(_addMusicControl.GenreAdd);
                Artist findartist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                Artist artist;

                if (findartist == null)
                {
                    artist = new Artist(_addMusicControl.ArtistAdd, gId);
                    artist.Create();
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }
                else
                {
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }

                YearTable year = YearTable.GetYearID(_addMusicControl.YearAdd);

                if (year == null)
                {
                    year = new YearTable(_addMusicControl.YearAdd);
                    year.Create();
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }
                else
                {
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }

                Lable lable = Lable.GetLableId(_addMusicControl.LableAdd);

                if (lable == null)
                {
                    lable = new Lable(_addMusicControl.LableAdd);
                    lable.Create();
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }
                else
                {
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }

                AlbumFormat format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);

                if (format == null)
                {
                    format = new AlbumFormat(_addMusicControl.FormatAdd);
                    format.Create();
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }
                else
                {
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }

                Album album = new Album(_addMusicControl.AlbumAdd, artist, year, lable, format);
                album.Create();
                album = Album.GetAlbumId(_addMusicControl.AlbumAdd);
                TrackList tl;

                for (int i = 0; i < _addMusicControl.TrackListAdd.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < _addMusicControl.TrackListAdd[i].Length; ++j)
                    {
                        if (_addMusicControl.TrackListAdd[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += _addMusicControl.TrackListAdd[i][j];
                        }
                    }
                    tname = tempp;
                    tl = new TrackList(tname, tnum, album);
                    tl.Create();
                }
                _addMusicControl.ShowSuccessMessage();
            }
            catch
            {
                _addMusicControl.ShowErrorMessage();
            }
        }
开发者ID:Apolotary,项目名称:GinTunes,代码行数:99,代码来源:AddMusicControlP.cs

示例7: AddByArtistClick

 public void AddByArtistClick()
 {
     try
     {
         if (_addMusicControl.ArtistAdd == "")
         {
             Exception ex = new Exception("Please, insert artist's name!");
             throw ex;
         }
         Genre gId = Genre.GetGenreID(_addMusicControl.GenreAdd);
         Artist findartist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
         Artist artist;
         if (findartist == null)
         {
             artist = new Artist(_addMusicControl.ArtistAdd, gId);
             artist.Create();
         }
         else
         {
             MessageBox.Show("Such artist already exists in your library!", "Whoops!");
         }
         _addMusicControl.ShowSuccessMessage();
     }
     catch
     {
         _addMusicControl.ShowErrorMessage();
     }
 }
开发者ID:Apolotary,项目名称:GinTunes,代码行数:28,代码来源:AddMusicControlP.cs

示例8: btnSubmit_Click

        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))
//.........这里部分代码省略.........
开发者ID:dasklub,项目名称:kommunity,代码行数:101,代码来源:ArtistProperties.aspx.cs


注:本文中的Artist.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。