private bool ValidarEntradas()
        {
            bool resultado = false;

            if (ServiciosDeValidacion.ValidarCadena(TextBoxCodigo.Text) &&
                ServiciosDeValidacion.ValidarCadena(TextBoxNombre.Text) &&
                ServiciosDeValidacion.ValidarCadena(TextBoxCodigoBarras.Text) &&
                ServiciosDeValidacion.ValidarNumeroDecimal(TextBoxCosto.Text) &&
                ServiciosDeValidacion.ValidarNumeroDecimal(TextBoxCantidad.Text))
            {
                if (CheckBoxIngredienteCompuesto.IsChecked == true)
                {
                    if (Componentes.Count <= 0)
                    {
                        MessageBox.Show("Este ingrediente no tiene componentes.", "Alerta");
                    }
                    else
                    {
                        resultado = true;
                    }
                }
                else
                {
                    resultado = true;
                }
            }

            return(resultado);
        }
        private void TextBoxCosto_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            TextBox padre = sender as TextBox;

            if (!ServiciosDeValidacion.ValidarEntradaDeDatosSoloDecimal(e.Text))
            {
                e.Handled = true;
            }
        }
        private void TextBoxNombre_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            TextBox padre = sender as TextBox;

            if (!ServiciosDeValidacion.ValidarCadena(e.Text))
            {
                e.Handled = true;
            }
        }
        private bool ValidarCampos()
        {
            bool resultado = false;

            if (ServiciosDeValidacion.ValidarCadena(TextBoxNombreDePlaylist.Text))
            {
                resultado = true;
            }
            return(resultado);
        }
Exemplo n.º 5
0
        private bool ValidarParaGuardar(Playlists playlist)
        {
            bool resultado = false;

            if (ServiciosDeValidacion.ValidarCadena(playlist.Nombre))
            {
                resultado = true;
            }

            return(resultado);
        }
        private bool ValidarCampos()
        {
            bool respuesta = false;

            if (ServiciosDeIO.ExisteArchivo(DireccionDeArchivoDeCaratula))
            {
                if (ServiciosDeValidacion.ValidarCadena(TextBoxNombreDeAlbum.Text) && ServiciosDeValidacion.ValidarCadena(TextBoxDescripcionDeAlbum.Text))
                {
                    respuesta = true;
                }
            }

            return(respuesta);
        }
 private void TextBoxCodigoBarras_Pasting(object sender, DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(string)))
     {
         string entrada = (string)e.DataObject.GetData(typeof(string));
         if (!ServiciosDeValidacion.ValidarEntero(entrada))
         {
             e.CancelCommand();
         }
     }
     else
     {
         e.CancelCommand();
     }
 }