private void BtnRegistrar(object sender, RoutedEventArgs e) { int IdLote = 0; try { IdLote = Convert.ToInt32(NumeroLote.Text); if (LoteDAO.ValidarSaidaLote(IdLote)) { Lote Lote = new Lote(); Lote = LoteDAO.BuscarLote(IdLote); LoteController.CadastrarSaidaDeLote(Lote); MessageBox.Show("Lote retirado com sucesso!", "Registrar saída de lote"); } else { MessageBox.Show("Por favor informe um número de lote que esteja em estoque.", "Registrar saída de lote"); } } catch (Exception) { MessageBox.Show("Por favor informe um número válido", "Registrar saída de lote"); } }
public static bool CadastrarSaidaDeLote(Lote lote) { try { if (LoteDAO.ValidarSaidaLote(lote.Id)) { HistoricoDAO.GerarHistoricoSaidaLote(lote); return(true); } else { return(false); } } catch (Exception) { return(false); } }