Exemplo n.º 1
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);
            }
        }
        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.º 4
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();
        }
Exemplo n.º 5
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 buttonGuardar_Click(object sender, EventArgs e)
        {
            bool             paso            = false;
            EntradaArticulos entradaarticulo = Llenarclase();

            if (validar(2))
            {
                MessageBox.Show("Favor de Llenar las Casillas");
            }
            else
            {
                if (EntradaIdNumericUpDown.Value == 0)
                {
                    paso = EntradaArticulosBLL.Guardar(entradaarticulo);
                }
                else
                {
                    var V = SegundoParcial.BLL.EntradaArticulosBLL.Buscar(Convert.ToInt32(EntradaIdNumericUpDown.Value));

                    if (V != null)
                    {
                        paso = EntradaArticulosBLL.Modificar(entradaarticulo);
                    }
                }
                LimpiarCampos();
                GeneralErrorProvider.Clear();
                if (paso)
                {
                    MessageBox.Show("Guardado!", "Exitoso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No pudo Guardar!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }