Exemple #1
0
        protected void BtnEliminar_Click(object sender, EventArgs e)
        {
            int id = Utils.ToInt(VentaIdTextBox.Text);

            var Ventas = RepositorioVentas.Buscar(id);

            if (Ventas != null)
            {
                if (RepositorioVentas.Eliminar(id))
                {
                    Utils.ShowToastr(this, "Eliminado Exitosamente!!", "Exito", "info");
                    LimpiarCampos();
                }
                else
                {
                    Utils.ShowToastr(this, "Fallo!! No se Puede Eliminar", "Error", "error");
                }
            }
            else
            {
                Utils.ShowToastr(this, "No hay datos para eliminar!!", "Error", "error");
            }
            if (Utils.ToInt(VentaIdTextBox.Text) == 0)
            {
                Utils.ShowToastr(this, "Id No Puede Ser Cero", "Error", "error");
            }
        }
Exemple #2
0
        public void BuscarTest()
        {
            RepositorioVentas repositorio = new RepositorioVentas();
            int    idVenta = repositorio.GetList(x => true)[0].VentaId;
            Ventas ventas  = repositorio.Buscar(idVenta);
            bool   paso    = ventas.Detalle.Count > 0;

            Assert.AreEqual(true, paso);
        }
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            RepositorioVentas repositorio = new RepositorioVentas();
            Ventas            ventas      = LlenaClase();

            bool paso = false;

            if (UsuarioDropDownList != null)
            {
                if (Page.IsValid)
                {
                    if (ventas.VentaId == 0 && Utils.ToInt(TotalLabel.Text) != 0)
                    {
                        paso = repositorio.Guardar(ventas);
                    }
                    else if (Utils.ToInt(VentaIdTextBox.Text) != 0)
                    {
                        var verificar = repositorio.Buscar(Utils.ToInt(VentaIdTextBox.Text));
                        if (verificar != null)
                        {
                            paso = repositorio.Modificar(ventas);
                        }
                        else
                        {
                            Utils.ShowToastr(this, "No se encuentra el ID", "Fallo", "error");
                            return;
                        }
                    }
                    if (paso)
                    {
                        Utils.ShowToastr(this, "Registro Con Exito", "Exito", "success");
                    }
                    else
                    {
                        Utils.ShowToastr(this, "No se pudo Guardar", "Fallo", "error");
                    }
                    LimpiarCampos();
                    return;
                }
            }
            else
            {
                Utils.ShowToastr(this, "El numero de cuenta no existe", "Fallo", "error");
                return;
            }
        }
Exemple #4
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            Ventas ventas = RepositorioVentas.Buscar(Utils.ToInt(VentaIdTextBox.Text));

            if (ventas != null)
            {
                LlenarCampos(ventas);
            }
            else
            {
                Utils.ShowToastr(this, "No Hay Resultado", "Error", "error");
                LimpiarCampos();
            }

            if (Utils.ToInt(VentaIdTextBox.Text) == 0)
            {
                Utils.ShowToastr(this, "Id No Puede Ser Cero", "Error", "error");
            }
        }
Exemple #5
0
        private void BuscarVentabutton_Click(object sender, EventArgs e)
        {
            RepositorioVentas db = new RepositorioVentas();

            try
            {
                Ventas venta;
                if ((venta = db.Buscar((int)IdVentanumericUpDown.Value)) != null)
                {
                    LlenarCampos(venta);
                }
                else
                {
                    MessageBox.Show("No se pudo encontrar", "Informacion!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }catch (Exception)
            {
                MessageBox.Show("Hubo un error!!", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #6
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Ventas ventas = RepositorioVentas.Buscar(Convert.ToInt32(VentaIdTextBox.Text));

            return(ventas != null);
        }