private void listar(Cliente c, Livro l, Funcionario f, DateTime dt, CheckBox chkHist) { int estadoAVer = (chkHist.IsChecked == true) ? 1: 0; Emprestimo_Helper_CRUD ehc = new Emprestimo_Helper_CRUD(App.ligacaoBD); _contentor = new ObservableCollection <Emprestimo>(ehc.list(c, l, f, dt, estadoAVer)); listaEmprestimos.ItemsSource = _contentor; btnApagar.IsEnabled = false; }
private void BtnApagar_Click(object sender, RoutedEventArgs e) { if (_editEmp != null) { Emprestimo_Helper_CRUD ehc = new Emprestimo_Helper_CRUD(App.ligacaoBD); string status = ehc.apagar(_editEmp); MessageBox.Show("Livro devolvido!"); } listar(null, null, null, DateTime.Today.AddDays(1), chk); }
private void BtnAddEmp_Click(object sender, RoutedEventArgs e) { Cliente c = cmbCliente.SelectedItem as Cliente; Livro l = cmbLivro.SelectedItem as Livro; Funcionario f = cmbFuncionario.SelectedItem as Funcionario; if (dataEmprestimo.SelectedDate != DateTime.Today.AddDays(1) && c.GuidPessoa != "" && l.GuidLivro != "" && f.GuidPessoa != "") { Emprestimo_Helper_CRUD ehc = new Emprestimo_Helper_CRUD(App.ligacaoBD); Emprestimo emp; emp = new Emprestimo(); emp.ClienteEmp = c; emp.FuncionarioEmp = f; emp.LivroEmp = l; try { emp.DataEmp = Convert.ToDateTime(dataEmprestimo.SelectedDate); } catch { emp.DataEmp = Convert.ToDateTime("1900/01/01"); } string statusOp = ehc.atualizar(emp); if (statusOp != "") { MessageBox.Show("Erro: " + statusOp); } else { limpaForm(); } } else { MessageBox.Show("Todos os campos devem ser preenchidos!"); } }