示例#1
0
        private void AgregarOrdenButton_Click(object sender, RoutedEventArgs e)
        {
            ////agrega un nuevo detalle con los datos introducidos.
            ordenes.OrdenesDetalle.Add(new OrdenDetalles(ordenes.OrdenId, Convert.ToInt32(ProductoIdTex.Text), Convert.ToInt32(ClienteIdTex.Text),
                                                         DescrepcionTex.Text, Convert.ToInt32(CantidadOdenTex.Text),
                                                         Convert.ToDecimal(PrecioTex.Text), Convert.ToDecimal(MontoTotalTex.Text)));
            //OrdenDetalles
            Llenar();

            ProductoIdTex.Clear();
            DescrepcionTex.Clear();
            PrecioTex.Clear();
            CantidadOdenTex.Clear();
            MontoTotalTex.Clear();
            ProductoIdTex.Focus();
        }
示例#2
0
        //private void CargarDataGrid()
        //{
        //    DetalleDataGrid.ItemsSource = null;
        //    DetalleDataGrid.ItemsSource = ordenes.OrdenesDetalle;
        //}
        private bool Validar()
        {
            bool paso = true;

            //if (string.IsNullOrWhiteSpace(ClienteIdTex.Text))
            //{
            //    MessageBox.Show("El Campo ClienteId Debe LLenarse..");
            //    ClienteIdTex.Focus();
            //    paso = false;
            //}
            if (string.IsNullOrWhiteSpace(ProductoIdTex.Text))
            {
                MessageBox.Show("Los Campos ProductoId---ClienteId--Y--Cantidad  Debe LLenarse..");
                ProductoIdTex.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(CantidadOdenTex.Text))
            {
                MessageBox.Show("El Campo CANTIDAD no puede estar vacio");
                CantidadOdenTex.Focus();
                paso = false;
            }
            else
            {
                foreach (var caracter in CantidadOdenTex.Text)
                {
                    if (!char.IsDigit(caracter))
                    {
                        paso = false;
                        MessageBox.Show("Escriba solo numeros en el campo CANTIDAD..");
                    }
                    else
                    if (!char.IsDigit(caracter))
                    {
                        paso = true;
                    }
                }
            }
            return(paso);
        }