private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(IdnumericUpDown.Value);
            RepositorioBase <Factura> repositorio = new RepositorioBase <Factura>();
            Factura factura = repositorio.Buscar(id);

            if (factura != null)
            {
                if (factura.TipoPago == "Contado")
                {
                    if (repositorio.Eliminar(id))
                    {
                        MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Limpiar();
                    }
                }
                else if (factura.TipoPago == "Credito")
                {
                    RepositorioFactura repo = new RepositorioFactura();
                    if (repo.Eliminar(id))
                    {
                        MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Limpiar();
                    }
                }
                else
                {
                    MessageBox.Show("No se pudo eliminar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("No existe!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            if (EsAdmin() == false)
            {
                MessageBox.Show("No tienes permiso para eliminar Facturas.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            int  ID = Convert.ToInt32(IDnumericUpDown.Value);
            bool paso;
            RepositorioFactura repositorio = new RepositorioFactura();

            if (!Existe())
            {
                MessageBox.Show("No se puede eliminar porque no existe.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                var resultado = MessageBox.Show("De eliminar esta Factura perdera información importante importante."
                                                + " Desea Continuar?", "ButterSoft", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (resultado == DialogResult.Yes)
                {
                    paso = repositorio.Eliminar(ID);
                    if (paso)
                    {
                        Limpiar();
                        MessageBox.Show("Factura eliminada!!", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se pudo eliminar la Factura", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        public void Eliminar()
        {
            RepositorioFactura repositorio = new RepositorioFactura();
            int  id   = 2;
            bool paso = repositorio.Eliminar(id);

            Assert.AreEqual(true, paso);
        }
        public void EliminarTest()
        {
            RepositorioFactura repositorio = new RepositorioFactura();
            bool paso;
            int  id = 1;

            paso = repositorio.Eliminar(id);
            Assert.AreEqual(paso, true);
        }
        protected void ButtonEliminar_Click(object sender, EventArgs e)
        {
            RepositorioFactura rep      = new RepositorioFactura();
            Facturas           facturas = rep.Buscar(int.Parse(TextBoxFacturaID.Text));

            if (facturas != null)
            {
                if (rep.Eliminar(int.Parse(TextBoxFacturaID.Text)))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Factura eliminada')", true);
                    ClearAll();
                    //Invisible();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('No se pudo eliminar la factura')", true);
                }
            }
        }
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            GridViewRow        grid        = DetalleGridView.SelectedRow;
            RepositorioFactura repositorio = new RepositorioFactura();
            int id         = Utils.ToInt(IDTextBox.Text);
            var evaluacion = repositorio.Buscar(id);

            if (evaluacion != null)
            {
                if (repositorio.Eliminar(id))
                {
                    Utils.ShowToastr(this.Page, "Exito Eliminado", "error");
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this.Page, "No Eliminado", "error");
                }
            }
        }
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();

            int id = 0;

            int.TryParse(IDNumericUpDown.Text, out id);

            RepositorioBase <Facturas> repo  = new RepositorioBase <Facturas>();
            RepositorioFactura         repof = new RepositorioFactura();

            int id2 = Convert.ToInt32(ClienteComboBox.SelectedValue.ToString());

            Limpiar();
            var Resultado = MessageBox.Show("Esta seguro que desea eliminar este Articulo", "Ferreteria Nelson", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            Limpiar();
            if (Resultado == DialogResult.Yes)
            {
                if (repo.Buscar(id) != null)
                {
                    if (repof.Eliminar(id, id2, this.detalle))
                    {
                        MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se pudo eliminar este registro", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Registro no encontrado", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        protected void eliminarutton_Click(object sender, EventArgs e)
        {
            RepositorioFactura repositorio = new RepositorioFactura();
            int id = Utils.ToInt(facturaIdTextBox.Text);

            var factura = repositorio.Buscar(id);

            if (factura != null)
            {
                if (repositorio.Eliminar(id))
                {
                    Utils.ShowToastr(this, "Eliminado", "Exito", "success");
                    LimpiaObjetos();
                }
                else
                {
                    Utils.ShowToastr(this, "No se pudo eliminar", "Error", "error");
                }
            }
            else
            {
                Utils.ShowToastr(this, "No existe", "Error", "error");
            }
        }
        public void EliminarTest()
        {
            RepositorioFactura repositorio = new RepositorioFactura();

            Assert.IsTrue(repositorio.Eliminar(4));
        }