private void btnAdd_Click(object sender, RoutedEventArgs e) { opc = 1; MainWindow mw = (MainWindow)Application.Current.MainWindow; var usuario = mw.Current; var agregarCredencial = new AgregarCredenciales(usuario, true); agregarCredencial.ShowDialog(); if (agregarCredencial.GetIsAdmin()) { Enable(); } }
private void btnEditar_Click(object sender, RoutedEventArgs e) { if (dgServicios.SelectedItem == null) { MessageBox.Show("SELECCIONE UN REGISTRO", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } else { MainWindow mw = (MainWindow)Application.Current.MainWindow; var usuario = mw.Current; var agregarCredencial = new AgregarCredenciales(usuario, true); agregarCredencial.ShowDialog(); if (agregarCredencial.GetIsAdmin()) { opc = 2; lbDescripcion.Visibility = Visibility.Collapsed; txtDescripcion.Visibility = Visibility.Visible; lbPrecio.Visibility = Visibility.Collapsed; txtPrecio.Visibility = Visibility.Visible; lbCupos.Visibility = Visibility.Collapsed; qtyPicker.Visibility = Visibility.Visible; cbxDetallePais.ItemsSource = ubicaciones; dateDetailsFrom.IsEnabled = true; dateDetailsTo.IsEnabled = true; txtDescripcion.Text = lbDescripcion.Content.ToString(); txtPrecio.Text = lbPrecio.Content.ToString(); cbxDetallePais.ItemsSource = ubicaciones; qtyPicker.Value = Convert.ToInt32(lbCupos.Content); btnGuardar.IsEnabled = true; dateDetailsFrom.IsEnabled = true; dateDetailsTo.IsEnabled = true; mw = (MainWindow)Window.GetWindow(this); mw.ListViewMenu.IsEnabled = false; } } }