private void listar(CheckBox chkAtivos)
        {
            int estadoAVer = (chkAtivos.IsChecked == true) ? 1 : 0;
            Funcionario_Helper_CRUD fhc = new Funcionario_Helper_CRUD(App.ligacaoBD);

            _contentor = new ObservableCollection <Funcionario>(fhc.list(estadoAVer));
            listaFuncionarios.ItemsSource = _contentor;
            btnApagar.IsEnabled           = false;
            btnEditar.IsEnabled           = false;
        }
Exemplo n.º 2
0
        private void preencherComboLst()
        {
            //Combobox Livros
            Livro_Helper_CRUD lhc = new Livro_Helper_CRUD(App.ligacaoBD);
            List <Livro>      lstL;

            if (cmbLivroLst.ItemsSource != null)
            {
                cmbLivroLst.ItemsSource = null;
            }
            if (cmbLivroLst.Items.Count > 0)
            {
                cmbLivroLst.Items.Clear();
            }
            lstL = lhc.list(0);

            if (lstL.Count > 0)
            {
                cmbLivroLst.ItemsSource = lstL;
            }
            else
            {
                Livro L = new Livro();
                L.Nome = "Sem Livros Emprestados";
                cmbLivroLst.Items.Add(L);
            }
            cmbLivroLst.SelectedIndex = 0;

            //Combobox Clientes
            Cliente_Helper_CRUD chc = new Cliente_Helper_CRUD(App.ligacaoBD);

            if (cmbClienteLst.ItemsSource != null)
            {
                cmbClienteLst.ItemsSource = null;
            }
            if (cmbClienteLst.Items.Count > 0)
            {
                cmbClienteLst.Items.Clear();
            }
            List <Cliente> lstC = chc.list(1);

            if (lstC.Count > 0)
            {
                cmbClienteLst.ItemsSource = lstC;
            }
            else
            {
                Cliente C = new Cliente();
                C.Nome = "Sem Clientes";
                cmbClienteLst.Items.Add(C);
            }
            cmbClienteLst.SelectedIndex = 0;

            //Combobox Funcionarios
            Funcionario_Helper_CRUD fhc = new Funcionario_Helper_CRUD(App.ligacaoBD);

            if (cmbFuncionarioLst.ItemsSource != null)
            {
                cmbFuncionarioLst.ItemsSource = null;
            }
            if (cmbFuncionarioLst.Items.Count > 0)
            {
                cmbFuncionarioLst.Items.Clear();
            }
            List <Funcionario> lstF = fhc.list(1);

            if (lstF.Count > 0)
            {
                cmbFuncionarioLst.ItemsSource = lstF;
            }
            else
            {
                Funcionario F = new Funcionario();
                F.Nome = "Sem Funcionários";
                cmbFuncionarioLst.Items.Add(F);
            }
            cmbFuncionarioLst.SelectedIndex = 0;
        }