コード例 #1
0
        void AccountDiscographyManage_EditSave(object sender, ModuleModeEventArgs e)
        {
            AuthoriseRequestSid();

            string title = Functions.TrimStringToWord(core.Http.Form["title"], 63);
            ReleaseType releaseType = (ReleaseType)core.Functions.FormByte("release-type", (byte)ReleaseType.Demo);

            Release release = null;

            switch (e.Mode)
            {
                case "add":
                    // TODO:
                    release = Release.Create(core, (Musician)Owner, releaseType, title, -1);
                    SetRedirectUri(BuildUri());
                    break;
                case "edit":
                    long releaseId = core.Functions.FormLong("id", 0);

                    try
                    {
                        release = new Release(core, releaseId);
                    }
                    catch (InvalidReleaseException)
                    {
                        // TODO: throw exception
                        return;
                    }

                    if (release.Musician.Id != Owner.Id)
                    {
                        // TODO: throw exception
                        return;
                    }

                    release.Title = title;
                    release.ReleaseType = releaseType;

                    release.Update();

                    SetInformation("Release information updated");
                    break;
            }
        }
コード例 #2
0
        void AccountDiscographyManage_Edit(object sender, ModuleModeEventArgs e)
        {
            SetTemplate("account_discography_album_edit");

            /* */
            TextBox titleTextBox = new TextBox("title");
            titleTextBox.MaxLength = 63;

            /* */
            SelectBox releaseTypeSelectBox = new SelectBox("release-type");
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Demo).ToString(), "Demo"));
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Single).ToString(), "Single"));
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Album).ToString(), "Album"));
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.EP).ToString(), "EP"));
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.DVD).ToString(), "DVD"));
            releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Compilation).ToString(), "Compilation"));

            switch (e.Mode)
            {
                case "add":

                    releaseTypeSelectBox.SelectedKey = ((byte)ReleaseType.Demo).ToString();
                    break;
                case "edit":
                    long releaseId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0));

                    Release release = null;

                    try
                    {
                        release = new Release(core, releaseId);

                        titleTextBox.Value = release.Title;
                        releaseTypeSelectBox.SelectedKey = ((byte)release.ReleaseType).ToString();
                    }
                    catch (InvalidReleaseException)
                    {
                        return;
                    }
                    break;
            }

            template.Parse("S_TITLE", titleTextBox);

            SaveMode(AccountDiscographyManage_EditSave);
        }
コード例 #3
0
ファイル: Release.cs プロジェクト: smithydll/boxsocial
        public static void Show(object sender, ShowMPageEventArgs e)
        {
            e.Template.SetTemplate("Musician", "viewrelease");

            Release release = null;

            try
            {
                release = new Release(e.Core, e.Slug);
            }
            catch
            {
                e.Core.Functions.Generate404();
                return;
            }

            List<Track> tracks = release.GetTracks();

            foreach (Track track in tracks)
            {
                VariableCollection trackVariableCollection = e.Template.CreateChild("track_list");

            }

            e.Core.Display.DisplayComments(e.Template, release.Musician, release);
        }