コード例 #1
0
ファイル: cCobros.xaml.cs プロジェクト: lgil22/ProyectoFinal
        /*   private void DetalleDataGridcobro_AutoGeneratedColumns(object sender, EventArgs e)
         * {
         *     foreach (DataGridColumn item in DataGridCobroConsultas.Columns)
         *     {
         *         chk = new CheckBox();
         *         checkBoxList.Add(chk);
         *         wrapColumns.Children.Add(chk);
         *         chk.Width = 100;
         *         chk.Height = 22;
         *         chk.Content = item.Header;
         *         chk.IsChecked = true;
         *         chk.Checked += new RoutedEventHandler(chk_Checked);
         *         chk.Unchecked += new RoutedEventHandler(chk_Unchecked);
         *     }
         * }
         * void chk_Unchecked(object sender, RoutedEventArgs e) /// metodo para ocultar las columnas
         * {
         *     List<string> chkUnchekList = new List<string>();
         *     chkUnchekList.Clear();
         *
         *     foreach (CheckBox item in checkBoxList)
         *     {
         *         if (item.IsChecked == false)
         *         {
         *             chkUnchekList.Add(item.Content.ToString());
         *         }
         *     }
         *
         *     foreach (DataGridColumn item in DataGridCobroConsultas.Columns)
         *     {
         *         if (chkUnchekList.Contains(item.Header.ToString()))
         *         {
         *             DataGridCobroConsultas.Columns.Remove(item);
         *             break;
         *         }
         *     }
         * }
         *
         * void chk_Checked(object sender, RoutedEventArgs e) // metodo para mostrar las columnas
         * {
         *     DataGridCobroConsultas.AutoGeneratedColumns -= new EventHandler(DetalleDataGridcobro_AutoGeneratedColumns);
         *
         *     List<string> chkCheckList = new List<string>();
         *     chkCheckList.Clear();
         *
         *     foreach (CheckBox item in checkBoxList)
         *     {
         *         if (item.IsChecked == false)
         *         {
         *             chkCheckList.Add(item.Content.ToString());
         *         }
         *     }
         *
         *     DataGridCobroConsultas.ItemsSource = null;
         *     DataGridCobroConsultas.ItemsSource = ocultardetalle;
         *
         *     foreach (string item in chkCheckList)
         *     {
         *         foreach (DataGridColumn column in DataGridCobroConsultas.Columns)
         *         {
         *             if (column.Header.ToString() == item)
         *             {
         *                 DataGridCobroConsultas.Columns.Remove(column);
         *                 break;
         *             }
         *         }
         *     }
         * }*/

        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Cobros>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:     //Todo
                    listado = CobrosBLL.GetList(o => true);
                    break;

                case 1:     //Cobro Id
                    int id;
                    id      = int.Parse(CriterioTextBox.Text);
                    listado = CobrosBLL.GetList(o => o.CobroId == id);
                    break;

                case 2:     // Cliente Id
                    int clienteId;
                    clienteId = int.Parse(CriterioTextBox.Text);
                    listado   = CobrosBLL.GetList(o => o.ClienteId == clienteId);
                    break;

                case 3:     //Cantidad
                    int cant;
                    cant    = int.Parse(CriterioTextBox.Text);
                    listado = CobrosBLL.GetList(o => o.Cantidad == cant);
                    break;

                case 4:     //Precio
                    int Prec;
                    Prec    = int.Parse(CriterioTextBox.Text);
                    listado = CobrosBLL.GetList(o => o.Precio == Prec);
                    break;

                case 5:     //monto
                    float monto;
                    monto   = float.Parse(CriterioTextBox.Text);
                    listado = CobrosBLL.GetList(o => o.Monto == monto);
                    break;
                }
            }
            else if (FiltroComboBox.SelectedIndex == 6)
            {
                listado = CobrosBLL.GetList(c => c.Fecha.Date >= DesdeDatePicker.SelectedDate && c.Fecha.Date <= HastaDatePicker.SelectedDate);
            }
            else
            {
                listado = CobrosBLL.GetList(p => true);
            }
            DataGridCobroConsultas.ItemsSource = null;
            DataGridCobroConsultas.ItemsSource = listado;
        }
コード例 #2
0
        public void GetListTest()
        {
            bool paso = false;

            List <Cobros> lista = CobrosBLL.GetList(l => true);

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

            Assert.AreEqual(paso, true);
        }