protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); lstPhotographers.ItemsSource = null; if (e.Parameter != null) { if (e.Parameter.GetType() == typeof(int)) { int id = (int)e.Parameter; show = await Shows.Get(id); txtFecha.Date = show.Fecha.Value; txtBandaArtista.SelectedValue = show.ArtistaId; txtLugar.SelectedValue = show.LugarId; lstPhotographers.ItemsSource = null; lstPhotographers.ItemsSource = show.Fotografos; //LoadData(id); } } else { show = new Show(); show.Id = 0; txtFecha.Date = DateTime.Now; txtBandaArtista.SelectedIndex = -1; txtLugar.SelectedIndex = -1; } //Verify GoBack Method var cParameter = CloureManager.GetParameter(); if (cParameter != null) { if (cParameter.GetType() == typeof(CloureParam)) { CloureParam cloureParam = (CloureParam)cParameter; if (cloureParam.name == "place_id") { LoadPlaces((int)cloureParam.value); } if (cloureParam.name == "artist_id") { LoadBandArtists((int)cloureParam.value); } } else if (cParameter.GetType() == typeof(ObservableCollection <User>)) { fotografos = (ObservableCollection <User>)cParameter; show.Fotografos = fotografos; lstPhotographers.ItemsSource = null; lstPhotographers.ItemsSource = fotografos; } } }
private async void LoadData(int id) { show = await Shows.Get(id); txtFecha.Date = show.Fecha.Value; txtBandaArtista.SelectedValue = show.ArtistaId; txtLugar.SelectedValue = show.LugarId; lstPhotographers.ItemsSource = null; lstPhotographers.ItemsSource = show.Fotografos; //lstPhotographers.ItemsSource = fotografos; }
private async void btnSave_Click(object sender, RoutedEventArgs e) { CloureManager.ShowLoader("Guardando"); foreach (var item in shows) { if (txtBandaArtista.SelectedValue != null) { item.ArtistaId = (int)txtBandaArtista.SelectedValue; } bool res = await Shows.save(item); //CloureManager.ShowDialog("Fecha: "+item.Fecha.Value.ToString()+" Lugar: "+item.LugarId.ToString()); } CloureManager.HideLoader(); CloureManager.GoBack(); }
public async void LoadData() { grdLoader.Visibility = Visibility.Visible; GenericResponse genericResponse = await Shows.GetList(Filter, OrderBy, OrderType, Page); TotalPages = genericResponse.TotalPages; if (genericResponse.Items.Count > 0) { grdNoRegisters.Visibility = Visibility.Collapsed; } else { grdNoRegisters.Visibility = Visibility.Visible; } lstItems.ItemsSource = genericResponse.Items; grdLoader.Visibility = Visibility.Collapsed; if (Page == 1) { btnFirst.IsEnabled = false; btnPrevious.IsEnabled = false; } if (Page > 1) { btnFirst.IsEnabled = true; btnPrevious.IsEnabled = true; } if (Page < TotalPages) { btnNext.IsEnabled = true; btnLast.IsEnabled = true; } if (Page == TotalPages) { btnNext.IsEnabled = false; btnLast.IsEnabled = false; } txtRegister.Text = "Mostrando página " + Page.ToString() + " de " + TotalPages.ToString(); }
private async void Save() { if (txtBandaArtista.SelectedValue == null) { CloureManager.ShowDialog("Debes seleccionar una banda/artista"); } else { show.ArtistaId = (int)txtBandaArtista.SelectedValue; show.LugarId = (int)txtLugar.SelectedValue; show.Fecha = txtFecha.Date.Date; show.Images = images; show.Fotografos = fotografos; if (await Shows.save(show)) { CloureManager.GoBack("reload"); } } }
private async void DisplayDeleteDialog(int id) { ContentDialog deleteFileDialog = new ContentDialog { Title = "¿Está seguro que desea eliminar este registro?", Content = "El registro se borrará de forma permanente", PrimaryButtonText = "Borrar", CloseButtonText = "Cancelar" }; ContentDialogResult result = await deleteFileDialog.ShowAsync(); // Delete the file if the user clicked the primary button. /// Otherwise, do nothing. if (result == ContentDialogResult.Primary) { bool api_result = await Shows.Delete(id); if (api_result) { LoadData(); } } }