public void BuscarTest()
        {
            EntradaArticulosBLL <EntradaArticulos> entradaArticulos = new EntradaArticulosBLL <EntradaArticulos>();
            EntradaArticulos ea = EntradaArticulosBLL.Buscar(1);

            Assert.IsNotNull(ea);
        }
Exemplo n.º 2
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;
            }
            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)
            {
                Limpiar();
                MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void buttonBuscar_Click(object sender, EventArgs e)
        {
            if (validar(1))
            {
                MessageBox.Show("Introducir Id");
            }
            else
            {
                int id = Convert.ToInt32(EntradaIdNumericUpDown.Value);
                EntradaArticulos entradaarticulo = EntradaArticulosBLL.Buscar(id);

                if (entradaarticulo != null)
                {
                    EntradaIdNumericUpDown.Value    = entradaarticulo.EntradaId;
                    ArticulosComboBox.SelectedValue = entradaarticulo.ArticuloID;
                    CantidadNumericUpDown.Value     = entradaarticulo.Cantidad;
                }
                else
                {
                    MessageBox.Show("No Fue Encontrado!",
                                    "Fallo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                GeneralErrorProvider.Clear();
            }
        }
        public void ModificarTest()
        {
            EntradaArticulosBLL <EntradaArticulos> entradaArticulos = new EntradaArticulosBLL <EntradaArticulos>();
            bool             estado = false;
            EntradaArticulos ea     = EntradaArticulosBLL.Buscar(1);

            ea.Cantidad = 12;
            estado      = EntradaArticulosBLL.Modificar(ea);
            Assert.AreEqual(true, estado);
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            bool             estado  = false;
            EntradaArticulos Entrada = new EntradaArticulos();

            if (Validar())
            {
                MessageBox.Show("Llene los campos correctamente", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                Entrada = LlenaClase();

                if (Convert.ToInt32(IdNumericUpDown.Value) == 0)
                {
                    estado = EntradaArticulosBLL.Guardar(Entrada);
                    MessageBox.Show("Guardado", "Exito",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                }
                else
                {
                    int id = Convert.ToInt32(IdNumericUpDown.Value);
                    EntradaArticulos entradaArticulos = new EntradaArticulos();
                    entradaArticulos = EntradaArticulosBLL.Buscar(id);

                    if (entradaArticulos != null)
                    {
                        estado = EntradaArticulosBLL.Modificar(LlenaClase());
                        MessageBox.Show("Modificado", "Exito",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Id no existe", "Falló",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }


                if (estado)
                {
                    Limpiar();
                }
                else
                {
                    MessageBox.Show("No se pudo guardar", "Falló",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 6
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)
        {
            int id = Convert.ToInt32(IdNumericUpDown.Value);
            EntradaArticulos Entrada = EntradaArticulosBLL.Buscar(id);

            if (Entrada != null)
            {
                FechaDateTimePicker.Value     = Entrada.Fecha;
                ArticuloComboBox.SelectedItem = Entrada.ArticuloId;
                CantidadNumericUpDown.Value   = Entrada.Cantidad;
            }
            else
            {
                MessageBox.Show("No se encontró", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 8
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            var entradaArticulos = EntradaArticulosBLL.Buscar(
                Utilities.Utils.ToInt(EntradaArticuloIDTextbox.Text));

            if (entradaArticulos != null)
            {
                LlenaCampos(entradaArticulos);
                Utilities.Utils.ShowToastr(this, "Busqueda exitosa", "Exito");
            }
            else
            {
                Limpiar();
                Utilities.Utils.ShowToastr(this,
                                           "No se pudo encontrar la Entrada de articulo ",
                                           "Error", "error");
            }
        }
Exemplo n.º 9
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id     = Utilities.Utils.ToInt(EntradaArticuloIDTextbox.Text);
            var cuenta = EntradaArticulosBLL.Buscar(id);


            if (cuenta == null)
            {
                Utilities.Utils.ShowToastr(this, "No se puede Eliminar", "error");
            }

            else
            {
                EntradaArticulosBLL.Eliminar(id);
                Utilities.Utils.ShowToastr(this, "Entrada de articulo Eliminada", "Exito");
                Limpiar();
            }
        }
Exemplo n.º 10
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            EntradaArticulos entradaArticulos = LlenarClase();

            bool paso = false;

            if (Page.IsValid)
            {
                if (entradaArticulos.EntradaArticulosID == 0)
                {
                    paso = EntradaArticulosBLL.Guardar(entradaArticulos);
                }
                else
                {
                    var verificar = EntradaArticulosBLL.Buscar(Utilities.Utils.ToInt(EntradaArticuloIDTextbox.Text));

                    if (verificar != null)
                    {
                        paso = EntradaArticulosBLL.Modificar(entradaArticulos);
                    }
                    else
                    {
                        Utilities.Utils.ShowToastr(this, "Entrada de articulo No Existe", "Fallido", "error");
                        return;
                    }
                }

                if (paso)

                {
                    Utilities.Utils.ShowToastr(this, "Entrada de articulo Registrada", "Exito", "Exito");
                }

                else

                {
                    Utilities.Utils.ShowToastr(this, "No pudo Guardarse la Entrada de articulo", "ERROR", "error");
                }
                Limpiar();
                return;
            }
        }
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(IdNumericUpDown.Value);

            EntradaArticulos Entrada = EntradaArticulosBLL.Buscar(id);

            if (Entrada != null)
            {
                if (EntradaArticulosBLL.Eliminar(id))
                {
                    MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                }

                else
                {
                    MessageBox.Show("No se pudo eliminar!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("No existe!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }