Exemplo n.º 1
0
        public void GetListTest()
        {
            var lista = new List <Compras>();

            lista = ComprasBLL.GetList(p => true);
            Assert.IsNotNull(lista);
        }
        public void GetListTest()
        {
            bool paso  = false;
            var  lista = ComprasBLL.GetList(x => true);

            if (lista != null)
            {
                paso = true;
            }
            else
            {
                Assert.Fail();
            }

            Assert.AreEqual(paso, true);
        }
Exemplo n.º 3
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Compras>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltrarComboBox.SelectedIndex)
                {
                case 0:
                    listado = ComprasBLL.GetList(o => true);
                    break;

                case 1:
                    int id;
                    id      = int.Parse(CriterioTextBox.Text);
                    listado = ComprasBLL.GetList(o => o.CompraId == id);
                    break;

                case 2:
                    int idS;
                    idS     = int.Parse(CriterioTextBox.Text);
                    listado = ComprasBLL.GetList(o => o.SuplidorId == idS);
                    break;

                case 3:
                    DateTime fecha = Convert.ToDateTime(CriterioTextBox.Text);
                    listado = ComprasBLL.GetList(x => x.FechaDeCompra.Date >= fecha.Date && x.FechaDeCompra.Date <= fecha.Date);
                    break;

                case 4:
                    int idU;
                    idU     = int.Parse(CriterioTextBox.Text);
                    listado = ComprasBLL.GetList(x => x.UsuariosId == idU);
                    break;
                }
            }
            else if (FiltrarComboBox.SelectedIndex == 3)
            {
                listado = ComprasBLL.GetList(x => x.FechaDeCompra.Date >= DesdeDateTimePicker.SelectedDate && x.FechaDeCompra.Date <= HastaDateTimePicker.SelectedDate);
            }
            else
            {
                listado = ComprasBLL.GetList(p => true);
            }
            ConsultarDataGrid.ItemsSource = null;
            ConsultarDataGrid.ItemsSource = listado;
        }
Exemplo n.º 4
0
        private void BuscarVentasButton_Click(object sender, EventArgs e)
        {
            Expression <Func <Compras, bool> > filtro = a => true;

            switch (FiltrarComboBox.SelectedIndex)
            {
            case 0:    //Fecha
                filtro = a => a.Fecha >= FechaCompras1DateTimePicker.Value.Date && a.Fecha <= FechaCompras2DateTimePicker.Value.Date;
                break;

            case 1:    //Total
                filtro = a => a.TotalAPagar.Equals(CriterioTextBox.Text);
                break;
            }

            Listaventas = ComprasBLL.GetList(filtro);
            ConsultaDataGridView.DataSource = Listaventas;
        }
Exemplo n.º 5
0
        private void Buscar()
        {
            var    listado  = new List <Compras>();
            string criterio = CriterioTextBox.Text.Trim();

            if (CriterioTextBox.Text.Trim().Length > 0 || FiltroCombobox.SelectedIndex == 4)
            {
                switch (FiltroCombobox.SelectedIndex)
                {
                case 0:
                    listado = ComprasBLL.GetList(f => true);
                    break;

                case 1:
                    listado = ComprasBLL.GetList(p => p.CompraId == Convert.ToInt32(CriterioTextBox.Text));
                    break;

                case 2:
                    listado = ComprasBLL.GetList(p => p.ProveedorId == Convert.ToInt32(CriterioTextBox.Text));
                    break;

                case 3:
                    listado = ComprasBLL.GetList(p => p.UsuarioId == Convert.ToInt32(CriterioTextBox.Text));
                    break;

                case 4:
                    DateTime hasta = (DateTime)HastaPicker.SelectedDate;
                    DateTime desde = (DateTime)DesdePicker.SelectedDate;
                    listado = ComprasBLL.GetList(p => p.Fecha >= desde && p.Fecha <= hasta);
                    break;
                }
            }
            else
            {
                listado = ComprasBLL.GetList(f => true);
            }
            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
Exemplo n.º 6
0
        private void Consultar_button_Click_1(object sender, EventArgs e)
        {
            Compras c = new Compras();

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

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

                case 2:    //ProveedorId
                    int IdProveedor = 0;
                    if (int.TryParse(Criterio_textBox.Text, out IdProveedor))
                    {
                        IdProveedor  = Convert.ToInt32(Criterio_textBox.Text);
                        listaCompras = ComprasBLL.GetList(p => p.ProveedorId == IdProveedor);
                    }
                    else
                    {
                        MessageBox.Show("No Puedes Hacer Esto");
                    }
                    break;

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

                case 4:    //Itbis
                    int Itbis = 0;
                    if (int.TryParse(Criterio_textBox.Text, out Itbis))
                    {
                        Itbis        = Convert.ToInt32(Criterio_textBox.Text);
                        listaCompras = ComprasBLL.GetList(p => p.Itbis == Itbis);
                    }
                    else
                    {
                        MessageBox.Show("No Puedes Hacer Esto");
                    }
                    break;
                }
            }
            else
            {
                listaCompras = ComprasBLL.GetList(p => true);
            }

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

            Consulta_dataGridView.DataSource = null;
            Consulta_dataGridView.DataSource = listaCompras;
        }
Exemplo n.º 7
0
 public void GetListTest()
 {
     Assert.IsNotNull(ComprasBLL.GetList(t => true));
 }
Exemplo n.º 8
0
        private void Buscar_Click(object sender, RoutedEventArgs e)
        {
            var Listado = new List <Compras>();

            if (CriterioTexBox.Text.Trim().Length > 0)
            {
                switch (FiltroComBox.SelectedIndex)
                {
                case 0:
                    //todo: poner esto en los Id de las consulatas
                    if (!Regex.IsMatch(CriterioTexBox.Text, "^[0-9]+$"))
                    {
                        MessageBox.Show("Se esperaba un Id no una cadena de texto", "Campo Criterio",
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    Listado = ComprasBLL.GetList(c => c.CompraId == int.Parse(CriterioTexBox.Text));
                    break;

                case 1:
                    try
                    {
                        Listado = ComprasBLL.GetList(c => c.Monto == double.Parse(CriterioTexBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 2:
                    try
                    {
                        if (DesdeDataPicker.SelectedDate != null)
                        {
                            Listado = ComprasBLL.GetList(c => c.Fecha.Date >= DesdeDataPicker.SelectedDate);
                        }

                        if (HastaDatePicker.SelectedDate != null)
                        {
                            Listado = ComprasBLL.GetList(c => c.Fecha.Date <= HastaDatePicker.SelectedDate);
                        }

                        Listado = ComprasBLL.GetList(C => C.Fecha == DesdeDataPicker.SelectedDate.Value);
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 3:
                    try
                    {
                        Listado = ComprasBLL.GetList(c => c.SuplidorId == int.Parse(CriterioTexBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un Critero valido");
                    }
                    break;
                }

                if (DesdeDataPicker.SelectedDate != null && HastaDatePicker.SelectedDate != null)
                {
                    Listado = Listado.Where(c => c.Fecha.Date >= DesdeDataPicker.SelectedDate.Value && c.Fecha.Date <= HastaDatePicker.SelectedDate.Value).ToList();
                }
            }


            else
            {
                Listado = ComprasBLL.GetList(c => true);
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = Listado;
        }
 public void GetListTest()
 {
     Assert.IsTrue(ComprasBLL.GetList(c => c.CompraId == 1) != null);
 }