示例#1
0
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            if (Validar(1))
            {
                MessageBox.Show("Ingrese un ID");
                return;
            }

            int id = Convert.ToInt32(EntradaArticuloIDnumericUpDown.Value);

            if (BLL.EntradaArticulosBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                EntradaArticuloIDnumericUpDown.Value = 0;
                CantidadArticulonumericUpDown.Value  = 0;
                ArticulocomboBox.Text.ToString();
                PrecioCompranumericUpDown.Value = 0;
                PrecioVentanumericUpDown.Value  = 0;
                GanancianumericUpDown.Value     = 0;
                EntradaerrorProvider.Clear();
            }

            else
            {
                MessageBox.Show("No se pudo eliminar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void limpiar()
 {
     IdtextBox.Clear();
     CuentaIdcomboBox.Items.Clear();
     CategoriaIdcomboBox.Items.Clear();
     MontomaskedTextBox.Clear();
     DescripciontextBox.Clear();
     EntradaerrorProvider.Clear();
 }
示例#3
0
 private void Nuevobutton_Click(object sender, EventArgs e)
 {
     EntradaArticuloIDnumericUpDown.Value = 0;
     CantidadArticulonumericUpDown.Value  = 0;
     ArticulocomboBox.Text.ToString();
     PrecioCompranumericUpDown.Value = 0;
     PrecioVentanumericUpDown.Value  = 0;
     GanancianumericUpDown.Value     = 0;
     EntradaerrorProvider.Clear();
 }
示例#4
0
        private bool SetError(int error)
        {
            bool paso = false;
            int  ejem = 0;

            if (error == 1 && int.TryParse(CriteriotextBox.Text, out ejem) == false)
            {
                EntradaerrorProvider.SetError(CriteriotextBox, "Debe de introducir un numero");
                paso = true;
            }
            return(paso);
        }
示例#5
0
        private bool ValidarGanancia()
        {
            decimal Compra = Convert.ToDecimal(PrecioCompranumericUpDown.Value);
            decimal Venta  = Convert.ToDecimal(PrecioVentanumericUpDown.Value);
            bool    paso   = true;

            if (Compra > Venta)
            {
                EntradaerrorProvider.SetError(PrecioCompranumericUpDown, "El precio de compra no puede ser mayor a venta");
                paso = false;
            }
            return(paso);
        }
示例#6
0
        private void Limpiar()
        {
            EntradaerrorProvider.Clear();
            EntradaArticuloIDnumericUpDown.Value = 0;
            CantidadArticulonumericUpDown.Value  = 0;
            ArticulocomboBox.Text.ToString();
            PrecioCompranumericUpDown.Value = 0;
            PrecioVentanumericUpDown.Value  = 0;
            GananciaTextBox.Text            = 0.ToString();
            EntradaerrorProvider.Clear();

            LlenarComboBox();
        }
示例#7
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            bool             paso             = false;
            EntradaArticulos entradaArticulos = LlenarClase();

            if (Validar(2))
            {
                MessageBox.Show("Llenar todos los campos marcados");
                return;
            }

            EntradaerrorProvider.Clear();


            if (EntradaArticuloIDnumericUpDown.Value == 0)
            {
                paso = EntradaArticulosBLL.Guardar(entradaArticulos);
            }
            else
            {
                var E = EntradaArticulosBLL.Buscar(Convert.ToInt32(EntradaArticuloIDnumericUpDown.Value));

                if (E != null)
                {
                    paso = EntradaArticulosBLL.Modificar(entradaArticulos);
                }
            }

            if (paso)
            {
                MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);

                EntradaArticuloIDnumericUpDown.Value = 0;
                CantidadArticulonumericUpDown.Value  = 0;
                ArticulocomboBox.Text.ToString();
                PrecioCompranumericUpDown.Value = 0;
                PrecioVentanumericUpDown.Value  = 0;
                GanancianumericUpDown.Value     = 0;
                EntradaerrorProvider.Clear();
            }
            else
            {
                MessageBox.Show("No se pudo guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            LlenarComboBox();
        }
 private void Buscarbutton_Click(object sender, EventArgs e)
 {
     if (IdtextBox.Text.Trim() == "")
     {
         EntradaerrorProvider.SetError(IdtextBox, "Debe especificar el ID ");
         IdtextBox.Focus();
     }
     else
     {
         EntradaerrorProvider.Clear();
     }
     if (IdtextBox.TextLength > 0)
     {
         TryParse();
         CuentaIdcomboBox.Text    = Convert.ToString(entrada.CuentaId);
         CategoriaIdcomboBox.Text = Convert.ToString(entrada.CategoriaId);
         MontomaskedTextBox.Text  = Convert.ToString(entrada.Monto);
         FechadateTimePicker.Text = entrada.Fecha;
     }
 }
示例#9
0
        private bool Validar(int validar)
        {
            bool paso = false;

            if (validar == 1 && EntradaArticuloIDnumericUpDown.Value == 0)
            {
                EntradaerrorProvider.SetError(EntradaArticuloIDnumericUpDown, "Ingrese un ID");
                paso = true;
            }
            if (validar == 2 && ArticulocomboBox.Text == string.Empty)
            {
                EntradaerrorProvider.SetError(ArticulocomboBox, "Ingrese un Articulo");
                paso = true;
            }

            if (validar == 2 && CantidadArticulonumericUpDown.Value == 0)
            {
                EntradaerrorProvider.SetError(CantidadArticulonumericUpDown, "Ingrese una Cantidad");
                paso = true;
            }

            if (validar == 2 && PrecioCompranumericUpDown.Value == 0)
            {
                EntradaerrorProvider.SetError(PrecioCompranumericUpDown, "Ingrese un Precio de compra");
                paso = true;
            }

            if (validar == 2 && PrecioVentanumericUpDown.Value == 0)
            {
                EntradaerrorProvider.SetError(PrecioVentanumericUpDown, "Ingrese un Precio de Venta");
                paso = true;
            }



            return(paso);
        }
 private void Eliminarbutton_Click(object sender, EventArgs e)
 {
     if (IdtextBox.Text.Trim() == "")
     {
         EntradaerrorProvider.SetError(IdtextBox, "Debe especificar el ID ");
         IdtextBox.Focus();
     }
     else
     {
         EntradaerrorProvider.Clear();
     }
     if (IdtextBox.Text.Length > 0)
     {
         entrada.EntradaId = int.Parse(IdtextBox.Text);
         if (entrada.Eliminar())
         {
             MessageBox.Show("La entrada se elimino Correctamente");
         }
         else
         {
             MessageBox.Show("La entrada no ha sido eliminada Correctamente");
         }
     }
 }
示例#11
0
 private void LimpiarError()
 {
     EntradaerrorProvider.Clear();
 }