Example #1
0
 private void btnEliminar_Click(object sender, RoutedEventArgs e)
 {
     Colores c = ((Button)sender).DataContext as Colores;
     MessageBoxResult result = MessageBox.Show("Estas seguro que quieres eliminar el color " +  c.Nombre + ".","Eliminar", MessageBoxButton.OKCancel, MessageBoxImage.Question);
     if (result == MessageBoxResult.OK)
     {
         TDAService.TDAServiceClient tda = new TDAService.TDAServiceClient();
         c = tda.BuscarColorID(c.ID).First();
         Resultado r = tda.DeleteColor(c);
         if (r.ErrorDB)
         {
             MessageBox.Show("No se pudo eliminar el estado " + c.Nombre + ".");
         }
         realizarBusqueda(new Colores());
     }
 }
Example #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (lID == 0)
     {
         btnRegistrar.Visibility = Visibility.Visible;
     }
     else if (lID != 0)
     {
         btnModificar.Visibility = Visibility.Visible;
         TDAService.TDAServiceClient tda = new TDAService.TDAServiceClient();
         var resultado = tda.BuscarColorID(lID);
         tda.Close();
         foreach (var r in resultado)
         {
             txtNombre.Text = r.Nombre;
         }
     }
 }