コード例 #1
0
        private async void BtnSave_Click(object sender, EventArgs e)
        {
            if (!ValidateChildren())
            {
                return;
            }

            request.Name     = txtName.Text;
            request.Year     = int.Parse(txtYear.Text);
            request.ArtistId = (cmbArtist.SelectedItem as Model.Artists).Id;
            request.AlbumId  = (cmbAlbum.SelectedItem as Model.Albums).Id;
            request.GenreId  = (cmbGenre.SelectedItem as Model.Genres).Id;
            request.Status   = Model.ReviewStatus.Approved;

            if (_id == 0)
            {
                entity = await _serviceSongs.Insert <Model.Songs>(request);

                if (entity != null)
                {
                    MessageBox.Show("Song added");
                    Close();
                }
            }
            else
            {
                entity = await _serviceSongs.Update <Model.Songs>(_id, request);

                if (entity != null)
                {
                    MessageBox.Show("Song updated");
                    Close();
                }
            }
        }
コード例 #2
0
        private void SongComboBox_SelectionChanged(object sender, Syncfusion.XForms.ComboBox.SelectionChangedEventArgs e)
        {
            SfComboBox cmb = sender as SfComboBox;

            Model.Songs song = cmb.SelectedValue as Model.Songs;
            VM.SongId = song.Id;
        }
コード例 #3
0
 private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
 {
     if (e.Item != null)
     {
         Model.Songs song = e.Item as Model.Songs;
         await Navigation.PushAsync(new SongPage(song.Id));
     }
 }
コード例 #4
0
        private async void frmSongDetails_Load(object sender, EventArgs e)
        {
            if (_id != 0)
            {
                entity = await _serviceSongs.GetById <Model.Songs>(_id);

                if (entity != null)
                {
                    if (entity.Status == Model.ReviewStatus.Pending)
                    {
                        btnSave.Text      = "Approve";
                        btnReject.Visible = true;
                    }

                    txtName.Text = entity.Name;
                    txtYear.Text = entity.Year.ToString();

                    await LoadCmbArtists();

                    foreach (var item in cmbArtist.Items)
                    {
                        if ((item as Model.Artists).Id == entity.ArtistId)
                        {
                            cmbArtist.SelectedItem = item;
                            break;
                        }
                    }

                    await LoadCmbAlbums();

                    foreach (var item in cmbAlbum.Items)
                    {
                        if ((item as Model.Albums).Id == entity.AlbumId)
                        {
                            cmbAlbum.SelectedItem = item;
                            break;
                        }
                    }

                    await LoadCmbGenres();

                    foreach (var item in cmbGenre.Items)
                    {
                        if ((item as Model.Genres).Id == entity.GenreId)
                        {
                            cmbGenre.SelectedItem = item;
                            break;
                        }
                    }
                }
            }
            else
            {
                await LoadCmbArtists();
                await LoadCmbGenres();
            }
        }
コード例 #5
0
        private async void BtnReject_Click(object sender, EventArgs e)
        {
            if (!ValidateChildren())
            {
                return;
            }

            request.Name     = txtName.Text;
            request.Year     = int.Parse(txtYear.Text);
            request.ArtistId = (cmbArtist.SelectedItem as Model.Artists).Id;
            request.AlbumId  = (cmbAlbum.SelectedItem as Model.Albums).Id;
            request.GenreId  = (cmbGenre.SelectedItem as Model.Genres).Id;
            request.Status   = Model.ReviewStatus.Rejected;

            entity = await _serviceSongs.Update <Model.Songs>(_id, request);

            if (entity != null)
            {
                MessageBox.Show("Genre rejected");
                DialogResult = DialogResult.OK;
            }
        }