private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Ventas AnteriorVenta = VentasBLL.Buscar(contenedor.ventas.VentaId);

            if (AnteriorVenta == null)
            {
                MessageBox.Show("No se Puede Eliminar un venta que no existe");
                return;
            }

            List <Pagos> pagos = PagosBLL.GetList(p => true);

            foreach (var item in pagos)
            {
                if (item.PagoDetalle[0].VentaId == contenedor.ventas.VentaId)
                {
                    MessageBox.Show("No se puede eliminar esta ya que tiene un pago");
                    return;
                }
            }

            if (VentasBLL.Eliminar(contenedor.ventas.VentaId))
            {
                ContratosBLL.RestablecerCantidadPendiente(contenedor.ventas.VentaDetalle[0].ContratoId);
                Limpiar();
                MessageBox.Show("Eliminado");
            }
            else
            {
                MessageBox.Show("No se Puede Eliminar Una Venta Que no Existe");
            }
        }
Exemplo n.º 2
0
        private void VentaBuscarButton_Click(object sender, RoutedEventArgs e)
        {
            float total = 0;

            if (VentaIdTextBox.Text.Length > 0)
            {
                venta = VentasBLL.Buscar(int.Parse(VentaIdTextBox.Text));

                if (venta.VentaId > 0)
                {
                    //busca las cuotas pendientes y la muestra en el grid...
                    listado = new List <PagosDetalle>();
                    var item = venta.Cuotas.FindAll(e => e.Balence > 0);

                    foreach (Cuotas cuota in item)
                    {
                        listado.Add(new PagosDetalle(0, cuota.CuotaId, cuota.Monto, cuota.Balence, 0, cuota.NumCuota, 0));
                        total += cuota.Balence;
                    }

                    DetalleDataGrid.ItemsSource = null;
                    DetalleDataGrid.ItemsSource = listado;
                    TotalPendienteTextBox.Text  = total.ToString();
                }
            }
            else
            {
                MessageBox.Show($"Debe colocar el numero de la venta", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Ventas VentaAnterior = VentasBLL.Buscar(contenedor.ventas.VentaId);

            if (VentaAnterior != null)
            {
                contenedor.ventas = VentaAnterior;
                llenarDataGrid();
                obtenerListado();
                UsuarioLabel.Content = obtenerNombreUsuario(contenedor.ventas.UsuarioId);

                Contratos contrato = ContratosBLL.Buscar(Convert.ToInt32(ContratoIdComboBox.SelectedItem));
                CantidadPendienteLabel.Content = Convert.ToString(contrato.CantidadPendiente);

                ClientesComboBox.IsEnabled   = false;
                ContratoIdComboBox.IsEnabled = false;

                Recargar();
            }
            else
            {
                Limpiar();
                MessageBox.Show("Venta No Encontrada");
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int Id;

            this.FechaTextBox.Text = string.Format("{0:G}", DateTime.Now);
            if (!Page.IsPostBack)
            {
                LLenarComboVendedor();


                if (Request.QueryString["Id"] != null)
                {
                    Id = Utilidades.TOINT(Request.QueryString["Id"].ToString());

                    if (Id > 0)
                    {
                        Ventas ventas = new Ventas();
                        VentasBLL.Buscar(Id);

                        Utilidades.ShowToastr(this, "Registro no encontrado", "Error", "Danger");
                    }
                    else
                    {
                        IdTextBox.Text = Id.ToString();
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void BuscarTest()
        {
            Ventas ventas;

            ventas = VentasBLL.Buscar(2);
            Assert.IsNotNull(ventas);
        }
Exemplo n.º 6
0
 private void BuscarButton_Click(object sender, EventArgs e)
 {
     if (ValidarId("Ingrese el id de la venta que quiere buscar") && Search())
     {
         Fill(VentasBLL.Buscar(Utilidades.StringToInt(ventaIdTextBox.Text)));
     }
 }
Exemplo n.º 7
0
        private void ButtonRecibo_Click(object sender, EventArgs e)
        {
            int    id    = Convert.ToInt32(VentaIdNumericUpDown.Value);
            Ventas venta = VentasBLL.Buscar(id);

            int           Id     = Convert.ToInt32(VentaIdNumericUpDown.Value);
            List <Ventas> ventas = new List <Ventas>();

            if (venta != null)
            {
                if (VentaIdNumericUpDown.Value > 0)
                {
                    ventas = VentasBLL.GetList(v => v.VentaId == Id);
                    vRecibo vRecibo = new vRecibo(ventas);
                    vRecibo.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Introduzca un Id!!", "Fallo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("No Hay Una Venta Con Ese Id!!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 8
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Pagos pago = PagosBLL.Buscar(contenedor.pagos.PagoId);

            if (pago != null)
            {
                contenedor.pagos = pago;
                llenarDataGrid();
                obtenerListado();
                UsuarioLabel.Content = obtenerNombreUsuario(contenedor.pagos.UsuarioId);

                Ventas venta = VentasBLL.Buscar(Convert.ToInt32(VentaComboBox.SelectedItem));
                BalanceLabel.Content = Convert.ToString(venta.Balance);

                ClientesComboBox.IsEnabled = false;
                VentaComboBox.IsEnabled    = false;

                reCargar();
            }
            else
            {
                limpiar();
                MessageBox.Show("Pago no encontrado");
            }
        }
Exemplo n.º 9
0
        private bool ExisteEnLaBaseDeDatos()
        {
            RepositorioBase <Ventas> db = new RepositorioBase <Ventas>();
            Ventas ventas = VentasBLL.Buscar((int)VentaIdTextBox.Text.ToInt());

            return(ventas != null);
        }
        public void BuscarTest()
        {
            int    idVenta = VentasBLL.GetList(x => true)[0].VentaId;
            Ventas ventas  = VentasBLL.Buscar(idVenta);
            bool   paso    = ventas.Detalle.Count > 0;

            Assert.AreEqual(true, paso);
        }
Exemplo n.º 11
0
        public void BuscarTest()
        {
            int    id    = 1;
            Ventas venta = new Ventas();

            venta = VentasBLL.Buscar(id);
            Assert.IsNotNull(venta);
        }
        public void ContratoDisponibleTest()
        {
            Ventas venta = VentasBLL.Buscar(1);

            bool paso = VentasBLL.ContratoDisponible(venta);

            Assert.IsTrue(paso);
        }
Exemplo n.º 13
0
 private void BuscarIdbutton_Click_1(object sender, EventArgs e)
 {
     if (validarId("Favor ingresar el id de la Venta que desea buscar") && ValidarBuscar())
     {
         factura = VentasBLL.Buscar(ut.StringInt(FacturaIdtextBox.Text));
     }
     Llenar();
 }
Exemplo n.º 14
0
 private void Eliminarbutton_Click_1(object sender, EventArgs e)
 {
     if (validarId("Favor digitar el id de la Venta  que desea eliminar") && ValidarBuscar())
     {
         VentasBLL.Eliminar(VentasBLL.Buscar(ut.StringInt(FacturaIdtextBox.Text)));
         Limpiar();
         MessageBox.Show("ELiminado con exito");
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Metodo qeu compruba s
        /// </summary>
        /// <returns></returns>
        public bool Existe()
        {
            VentasBLL reposistorio = new VentasBLL();
            Contexto  contexto     = new Contexto();

            Ventas pro = VentasBLL.Buscar((int)VentasIdNumericUpDown.Value);

            return(pro != null);
        }
Exemplo n.º 16
0
        private bool ValidarBuscar()
        {
            if (VentasBLL.Buscar(ut.StringInt(FacturaIdtextBox.Text)) == null)
            {
                MessageBox.Show("Este registro no existe");
                return(false);
            }

            return(true);
        }
Exemplo n.º 17
0
        public void EntradaValidaTest()
        {
            bool paso = false;

            Ventas ventas = VentasBLL.Buscar(1);

            paso = VentasBLL.EntradaValida(ventas);

            Assert.AreEqual(paso, true);
        }
Exemplo n.º 18
0
        private bool Search()
        {
            if (VentasBLL.Buscar(Utilidades.StringToInt(ventaIdTextBox.Text)) == null)
            {
                MessageBox.Show("El id no existe");
                return(false);
            }

            return(true);
        }
Exemplo n.º 19
0
        private void EditarButton_Click(object sender, EventArgs e)
        {
            int    id = 0;
            Ventas p  = new Ventas();

            int.TryParse(ConsultaDataGridView.CurrentRow.Cells[0].Value.ToString(), out id);
            p = VentasBLL.Buscar(id);
            rVentas rp = new rVentas(p);

            this.Hide();
            rp.ShowDialog();
        }
Exemplo n.º 20
0
        public void BuscarTest()
        {
            bool paso = true;

            var ventas = VentasBLL.Buscar(1);

            if (ventas != null)
            {
                paso = true;
                Assert.AreEqual(paso, true);
            }
        }
        public void BuscarTest()
        {
            Ventas venta = new Ventas();
            bool   paso  = false;

            venta = VentasBLL.Buscar(1);

            if (venta != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
Exemplo n.º 22
0
        protected void guardarButton_Click(object sender, EventArgs e)
        {
            VentasBLL repositorio = new VentasBLL();
            Ventas    venta       = new Ventas();
            bool      paso        = false;

            if (Validar())
            {
                return;
            }
            else
            {
                //todo: validaciones adicionales
                venta = LlenarClase();

                if (Utils.ToInt(IdTextBox.Text) == 0)
                {
                    paso = repositorio.Guardar(venta);
                    Utils.ShowToastr(this, "Guardado", "Correcto", "success");
                    Limpiar();
                }
                else
                {
                    Ventas    vent       = new Ventas();
                    int       id         = Utils.ToInt(IdTextBox.Text);
                    VentasBLL repository = new VentasBLL();
                    vent = repository.Buscar(id);

                    if (vent != null)
                    {
                        paso = repositorio.Modificar(LlenarClase());
                        Utils.ShowToastr(this, "Modificado", "Correcto", "success");
                    }
                    else
                    {
                        Utils.ShowToastr(this, "No encontrado", "Error", "error");
                    }
                }

                if (paso)
                {
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this, "No se pudo guardar", "Error", "error");
                }
            }
        }
Exemplo n.º 23
0
        private void ButtonBuscar_Click(object sender, EventArgs e)
        {
            int    id    = Convert.ToInt32(VentaIdNumericUpDown.Value);
            Ventas venta = VentasBLL.Buscar(id);

            if (venta != null)
            {
                LlenarCampos(venta);
            }
            else
            {
                MessageBox.Show("No se encontro!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 24
0
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            Repositorio <Ventas> ProRepositorio = new Repositorio <Ventas>(new Contexto());
            int    id    = Convert.ToInt32(IdNumericUpDown.Value);
            Ventas venta = VentasBLL.Buscar(id);

            if (venta != null)
            {
                LlenaCampos(venta);
            }
            else
            {
                MessageBox.Show("No se encontró!!!", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 25
0
        private void calcularPago()
        {
            Ventas venta = VentasBLL.Buscar(Convert.ToInt32(VentaComboBox.SelectedItem));

            decimal total   = 0.0m;
            decimal balance = venta.Total;

            foreach (var item in contenedor.listaPagos)
            {
                total     += item.Monto;
                balance   -= item.Monto;
                item.Saldo = balance;
            }

            TotalLabel.Content   = Convert.ToString(total);
            BalanceLabel.Content = Convert.ToString(balance);
        }
Exemplo n.º 26
0
        //—————————————————————————————————————————————————————[ BUSCAR ]—————————————————————————————————————————————————————
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Ventas encontrado = VentasBLL.Buscar(ventas.VentaId);

            if (encontrado != null)
            {
                ventas = encontrado;
                Cargar();
            }
            else
            {
                MessageBox.Show($"Este pedido no fue encontrado.\n\nAsegurese que existe o cree uno nuevo.", "ERROR", MessageBoxButton.OK, MessageBoxImage.Warning);
                Limpiar();
                VentaIdTextbox.Clear();
                VentaIdTextbox.Focus();
            }
        }
Exemplo n.º 27
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            VentasBLL repositorio = new VentasBLL();

            var venta = repositorio.Buscar(Utils.ToInt(IdTextBox.Text));

            if (venta != null)
            {
                Utils.ShowToastr(this, "Encontrado", "Exito", "success");
                LlenarCampos(venta);
            }
            else
            {
                Limpiar();
                Utils.ShowToastr(this, "No Encontrado", "Error", "error");
            }
        }
Exemplo n.º 28
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            int    id;
            Ventas venta = new Ventas();

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

            venta = VentasBLL.Buscar(id);

            if (venta != null)
            {
                LlenaCampo(venta);
            }
            else
            {
                MessageBox.Show(" No encontrado !!!", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemplo n.º 29
0
        public void DevolverCacaoTest()
        {
            Cacaos cacao = CacaosBLL.Buscar(1);
            Ventas venta = VentasBLL.Buscar(1);

            decimal cantidad      = cacao.Cantidad;
            decimal cantidadVenta = 0;

            foreach (var item in venta.VentaDetalle)
            {
                cantidadVenta += item.Cantidad;
            }

            CacaosBLL.DevolverCacao(1);

            cacao = CacaosBLL.Buscar(1);

            Assert.IsTrue(cantidad + cantidadVenta == cacao.Cantidad);
        }
        private void BucarButton_Click(object sender, RoutedEventArgs e)
        {
            var venta = VentasBLL.Buscar(Convert.ToInt32(VentaIdTextBox.Text));

            if (venta != null)
            {
                this.venta = venta;
            }
            else
            {
                this.venta = new Entidades.Ventas();
                MessageBox.Show("El Registro No Existe", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }

            Limpiar();
            this.DataContext = this.venta;
        }