Exemplo n.º 1
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Pagos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.PagoId == Utilidades.ToInt(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 1:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.VentaId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 2:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.UsuarioId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 3:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.Monto == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;
                }
            }
            else
            {
                listado = PagosBLL.GetList(c => true);
            }
            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
Exemplo n.º 2
0
        private void btConsulta_Click(object sender, EventArgs e)
        {
            Expression <Func <Pagos, bool> > filtro = c => true;

            int id;

            switch (FiltroComboBox.SelectedIndex)
            {
            case 0:
                filtro = c => true;
                break;

            case 1:    //Filtrando por ID del Pago.
                id     = Convert.ToInt32(CriterioTextBox.Text);
                filtro = c => c.PagoID == id;
                break;

            case 2:    //Filtrando por Nombre del Productor.
                filtro = c => c.productores.Nombres.Contains(CriterioTextBox.Text);
                break;
            }

            Listado = PagosBLL.GetList(filtro);
            ConsultaDataGridView.DataSource = Listado;
        }
        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.º 4
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var lista = new List <Pagos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //todo
                    lista = PagosBLL.GetList(x => true);
                    break;

                case 1:    //ID
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    lista = PagosBLL.GetList(x => x.PagoId == id);
                    break;

                case 2:    //Fecha
                    DateTime fecha = Convert.ToDateTime(CriterioTextBox.Text);
                    lista = PagosBLL.GetList(x => x.Fecha == fecha);
                    break;
                }
            }
            else
            {
                lista = PagosBLL.GetList(x => true);
            }

            ConsultarDataGrig.ItemsSource = null;
            ConsultarDataGrig.ItemsSource = lista;
        }
Exemplo n.º 5
0
        public void GetListTest()
        {
            List <Pagos> lista = new List <Pagos>();

            lista = PagosBLL.GetList(l => true);
            Assert.IsNotNull(lista);
        }
Exemplo n.º 6
0
        protected void ButtonBuscar_Click1(object sender, EventArgs e)
        {
            PrestamoGridView.DataBind();
            Expression <Func <Pagos, bool> > filtro = x => true;
            PagosBLL facturacion = new PagosBLL();

            int id;

            DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
            DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);

            switch (TipodeFiltro.SelectedIndex)
            {
            case 0:    //ID

                id = Utilities.Utils.ToInt(TextCriterio.Text);
                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => x.PagoID == id && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = c => c.PagoID == id;
                }

                if (PagosBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, " Prestamo ID No Existe", "Fallido", "success");
                    return;
                }

                break;



            case 1:    //Todos

                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => true && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = x => true;
                }

                if (PagosBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, "No existen Dichas Cuentas", "Fallido", "success");
                }
                break;
            }

            PrestamoGridView.DataSource = PagosBLL.GetList(filtro);
            PrestamoGridView.DataBind();
        }
Exemplo n.º 7
0
        private void Consultabutton_Click(object sender, EventArgs e)
        {
            if (SetError(2))
            {
                MessageBox.Show("Debe introducir porque filtro va a consultar", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            int id;

            switch (TipocomboBox.SelectedIndex)
            {
            //ID
            case 0:
                LimpiarError();
                if (SetError(1))
                {
                    MessageBox.Show("Introduce un numero");
                    return;
                }
                id      = int.Parse(CriteriotextBox.Text);
                filtrar = t => t.PagoID == id && (t.Fecha.Day >= DesdedateTimePicker.Value.Day) && (t.Fecha.Month >= DesdedateTimePicker.Value.Month) && (t.Fecha.Year >= DesdedateTimePicker.Value.Year) &&
                          (t.Fecha.Day <= HastadateTimePicker.Value.Day) && (t.Fecha.Month <= HastadateTimePicker.Value.Month) && (t.Fecha.Year <= HastadateTimePicker.Value.Year);
                break;

            //Listar Todo
            case 1:

                filtrar = t => true;
                break;
            }

            pagos = PagosBLL.GetList(filtrar);

            ConsultadataGridView.DataSource = pagos;

            if (FechaCheckBox.Checked == true)
            {
                pagos = PagosBLL.GetList(filtrar).Where(x => x.Fecha.Date >= DesdedateTimePicker.Value.Date && x.Fecha.Date <= HastadateTimePicker.Value.Date).ToList();
                ConsultadataGridView.DataSource = null;
                ConsultadataGridView.DataSource = pagos;
            }
            else
            {
                pagos = PagosBLL.GetList(filtrar);
                ConsultadataGridView.DataSource = null;
                ConsultadataGridView.DataSource = pagos;
            }
        }
        public byte[] Reporte(List <Pagos> lista)
        {
            if (lista.Count < 1)
            {
                listaPagos = PagosBLL.GetList(c => true);
            }
            else
            {
                listaPagos = lista;
            }

            document = new Document(PageSize.Letter, 25f, 25f, 20f, 20f);
            pdfTable = new PdfPTable(columnas);

            pdfTable.WidthPercentage     = 100;
            pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;

            fontStyle = FontFactory.GetFont("Calibri", 8f, 1);

            PdfWriter.GetInstance(document, memoryStream);
            document.Open();

            float[] anchoColumnas = new float[columnas];

            anchoColumnas[0] = 100; //Esta sera la fila 1 pagoId
            anchoColumnas[1] = 100; //Esta sera la fila 2 fecha
            anchoColumnas[2] = 100; //Esta sera la fila 3 clienteId
            anchoColumnas[3] = 180; //Esta sera la fila 3 nombreCliente
            anchoColumnas[4] = 115; //Esta sera la fila 4 total
            anchoColumnas[5] = 100; //Esta sera la fila 5 fechaCreacion
            anchoColumnas[6] = 100; //Esta sera la fila 6 fechaModificacion
            anchoColumnas[7] = 100; //Esta sera la fila 7 usuarioId

            pdfTable.SetWidths(anchoColumnas);

            this.ReportHeader();
            this.ReportBody();

            pdfTable.HeaderRows = 1;
            document.Add(pdfTable);
            document.Close();

            return(memoryStream.ToArray());
        }
        private void calcularVenta()
        {
            decimal total    = 0.0m;
            decimal balance  = 0.0m;
            decimal cantidad = 0.0m;

            foreach (var item in contenedor.listaVentas)
            {
                item.Total = item.Cantidad * item.Importe;
                total     += item.Total;
                balance   += item.Total;
                cantidad  += item.Cantidad;
            }

            if (contenedor.ventas.VentaId > 0)
            {
                if (PagosBLL.ExistePago())
                {
                    List <Pagos> pagos = PagosBLL.GetList(p => true);

                    foreach (var item in pagos)
                    {
                        if (item.PagoDetalle[0].VentaId == contenedor.ventas.VentaId)
                        {
                            balance -= item.Total;
                        }
                    }
                }
            }

            Contratos contrato = ContratosBLL.Buscar(Convert.ToInt32(ContratoIdComboBox.SelectedItem));

            BalanceLabel.Content           = Convert.ToString(balance);
            TotalLabel.Content             = Convert.ToString(total);
            CantidadPendienteLabel.Content = Convert.ToString(contrato.Cantidad - cantidad);
        }
Exemplo n.º 10
0
        private void Consultar_button_Click(object sender, EventArgs e)
        {
            Pagos c = new Pagos();

            if (Criterio_textBox.Text.Trim().Length > 0)
            {
                switch (Filtro_comboBox.SelectedIndex)
                {
                case 0:    //Todo
                    listaPagos = PagosBLL.GetList(p => true);
                    break;

                case 1:    //Id
                    int id = 0;
                    if (int.TryParse(Criterio_textBox.Text, out id))
                    {
                        id         = Convert.ToInt32(Criterio_textBox.Text);
                        listaPagos = PagosBLL.GetList(p => p.PagoId == id);
                    }
                    else
                    {
                        MessageBox.Show("No Puedes Hacer Esto");
                    }
                    break;

                case 2:    //Balance
                    decimal balance = 0;
                    if (decimal.TryParse(Criterio_textBox.Text, out balance))
                    {
                        balance    = Convert.ToInt32(Criterio_textBox.Text);
                        listaPagos = PagosBLL.GetList(p => p.PagoTotal == balance);
                    }
                    else
                    {
                        MessageBox.Show("No Puedes Hacer Esto");
                    }
                    break;

                case 3:    //UsuarioId
                    int usuarioId = 0;
                    if (int.TryParse(Criterio_textBox.Text, out usuarioId))
                    {
                        usuarioId  = Convert.ToInt32(Criterio_textBox.Text);
                        listaPagos = PagosBLL.GetList(p => p.UsuarioId == usuarioId);
                    }
                    else
                    {
                        MessageBox.Show("No Puedes Hacer Esto");
                    }
                    break;
                }
            }
            else
            {
                listaPagos = PagosBLL.GetList(p => true);
            }

            if (FiltroFecha_checkBox.Checked == true)
            {
                listaPagos = listaPagos.Where(p => p.Fecha.Date >= Desde_dateTimePicker.Value.Date && p.Fecha.Date <= Hasta_dateTimePicker.Value.Date).ToList();
            }

            Consulta_dataGridView.DataSource = null;
            Consulta_dataGridView.DataSource = listaPagos;
        }
Exemplo n.º 11
0
        public void GetListTest()
        {
            List <Pagos> listaPago = PagosBLL.GetList(p => true);

            Assert.IsNotNull(listaPago);
        }
Exemplo n.º 12
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var Listado = new List <Pagos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //Todo
                    Listado = PagosBLL.GetList(p => true);
                    break;

                case 1:    //PagoId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = PagosBLL.GetList(p => p.PagoId == id);
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 2:    //ClienteId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = PagosBLL.GetList(p => p.ClienteId == id);
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 3:    //Total
                    try
                    {
                        decimal total = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = PagosBLL.GetList(p => p.Total == total);
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un total valido");
                    }
                    break;

                case 4:    //UsuarioId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = PagosBLL.GetList(p => p.UsuarioId == id);
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;
                }
                if (DesdeDatePicker.SelectedDate != null && HastaDatePicker.SelectedDate != null)
                {
                    Listado = Listado.Where(p => p.Fecha.Date >= DesdeDatePicker.SelectedDate.Value && p.Fecha.Date <= HastaDatePicker.SelectedDate.Value).ToList();
                }
            }
            else
            {
                Listado = PagosBLL.GetList(p => true);
            }

            List <PagosGrid> pagosGrids = new List <PagosGrid>();

            foreach (var item in Listado)
            {
                pagosGrids.Add(new PagosGrid(item.PagoId, item.Fecha, item.ClienteId, item.Total, item.FechaCreacion, item.FechaModificacion, item.UsuarioId));
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = pagosGrids;
        }
Exemplo n.º 13
0
        private void BuscarSelecCombo()
        {
            Listas = null;

            if (FiltrarDropDownList.SelectedIndex == 0)
            {
                Listas = BLL.PagosBLL.GetListTodo();
            }
            else if (FiltrarDropDownList.SelectedIndex == 1)
            {
                if (BuscarTextBox.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(BuscarTextBox.Text);
                    Listas = PagosBLL.GetList(p => p.PagoId == Busqueda);
                    ConsultaClienteGridView.DataSource = Listas;
                    ConsultaClienteGridView.DataBind();
                }
            }
            else if (FiltrarDropDownList.SelectedIndex == 2)
            {
                if (BuscarTextBox.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(BuscarTextBox.Text);
                    Listas = PagosBLL.GetList(p => p.VendedorId == Busqueda);
                    ConsultaClienteGridView.DataSource = Listas;
                    ConsultaClienteGridView.DataBind();
                }
            }
            else if (FiltrarDropDownList.SelectedIndex == 3)
            {
                if (DesdeTextBox.Text != "" && HastaTextBox.Text != "")
                {
                    DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
                    DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);
                    if (desde <= hasta)
                    {
                        Listas = BLL.PagosBLL.GetList(p => p.Fecha >= desde && p.Fecha <= hasta);
                    }
                    else
                    {
                        base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Orden Cronologico mal seleccionado, la primera fecha debe ser menor que la segunda.');</script>");
                        Listas = null;
                    }
                }
                else
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes insertar la fecha');</script>");
                    Listas = null;
                }
            }
            ConsultaClienteGridView.DataSource = Listas;
            ConsultaClienteGridView.DataBind();
        }
        public void GetListTest()
        {
            List <Pagos> listado = PagosBLL.GetList(p => true);

            Assert.IsTrue(listado != null);
        }
Exemplo n.º 15
0
 public void GetListTest()
 {
     Assert.IsNotNull(PagosBLL.GetList(t => true));
 }