// Adiciona um checkout private void btnCheckOut_Click(object sender, EventArgs e) { try { CheckOut checkOut = new CheckOut(); checkOut.QuartoID = int.Parse(QUARTOID); checkOut.ClienteID = int.Parse(txtIDCliente.Text); checkOut.DataSaida = DateTime.Now; checkOut.CheckInID = int.Parse(txtID.Text); Response response = checkOutBLL.Insert(checkOut); MessageBox.Show(response.Message); if (response.Success) { MessageBox.Show($"R${Math.Round(checkOut.Valor, 2)} pagos, obrigado e volte sempre!"); UpdateGridView(); UpdateGridViewItensConsumidos(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Adiciona um cliente private void btnAdicionar_Click(object sender, EventArgs e) { try { Cliente cliente = new Cliente(); cliente.Nome = txtNome.Text; cliente.CPF = txtCPF.Text; cliente.RG = txtRG.Text; cliente.TelefoneFixo = txtTelefoneF.Text; cliente.TelefoneCelular = txtTelefoneC.Text; cliente.Email = txtEmail.Text; Response response = clienteBLL.Insert(cliente); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Adiciona um checkin private void btnCheckIn_Click(object sender, EventArgs e) { try { CheckIn checkIn = new CheckIn(); checkIn.QuartoID = int.Parse(txtQuartoID.Text); checkIn.ClienteID = int.Parse(txtClienteID.Text); checkIn.DataEntrada = DateTime.Now; checkIn.DataSaidaPrevista = dtpDataSaidaPrevista.Value; Response response = checkInBLL.Insert(checkIn); MessageBox.Show(response.Message); if (response.Success) { UpdateGridViewQuartos(); UpdateGridViewCheckIn(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Atualiza o funcionário private void btnAtualizar_Click(object sender, EventArgs e) { try { Funcionario funcionario = new Funcionario(); funcionario.ID = Convert.ToInt32(txtID.Text); funcionario.Nome = txtNome.Text; funcionario.CPF = txtCPF.Text; funcionario.RG = txtRG.Text; funcionario.Email = txtEmail.Text; funcionario.Cargo = (CargosFuncionarios)cbCargo.SelectedIndex; funcionario.Senha = txtSenha.Text; funcionario.Rua = txtRua.Text; funcionario.Bairro = txtBairro.Text; funcionario.NumeroCasa = int.Parse(txtNumeroCasa.Text); funcionario.IsADM = cbAdministrador.Checked; Response response = funcionarioBLL.Update(funcionario); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Atualiza um cliente private void btnAtualizar_Click(object sender, EventArgs e) { try { Cliente cliente = new Cliente(); cliente.ID = int.Parse(txtID.Text); cliente.Nome = txtNome.Text; cliente.CPF = txtCPF.Text; cliente.RG = txtRG.Text; cliente.TelefoneFixo = txtTelefoneF.Text; cliente.TelefoneCelular = txtTelefoneC.Text; cliente.Email = txtEmail.Text; cliente.Ativo = true; //pensar em algo! Response response = clienteBLL.Update(cliente); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Atualiza um fornecedor private void btnAtualizar_Click(object sender, EventArgs e) { try { Fornecedor fornecedor = new Fornecedor(); fornecedor.ID = int.Parse(txtID.Text); fornecedor.RazaoSocial = txtRazaoSocial.Text; fornecedor.Nome = txtNome.Text; fornecedor.CNPJ = txtCNPJ.Text; fornecedor.TelefoneCelular = txtTelefoneC.Text; fornecedor.Email = txtEmail.Text; Response response = fornecedorBLL.Update(fornecedor); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Atualiza um quarto private void btnAtualizar_Click(object sender, EventArgs e) { Quarto quarto = new Quarto(); try { quarto.ID = int.Parse(txtID.Text); quarto.TipoQuarto = (TipoQuartos)cbTipoQuarto.SelectedIndex; quarto.ValorNoite = double.Parse(txtValor.Text); quarto.PessoasMaximas = int.Parse(txtPessoasMax.Text); quarto.Ocupado = false; Response response = quartoBLL.Update(quarto); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Deleta o formulário private void btnDeletar_Click(object sender, EventArgs e) { try { Funcionario funcionario = new Funcionario(); funcionario.ID = int.Parse(txtID.Text); Response response = funcionarioBLL.Delete(funcionario); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Exclui um produto private void btnExcluir_Click(object sender, EventArgs e) { try { Produto produto = new Produto(); produto.ID = int.Parse(txtID.Text); Response response = produtoBLL.Delete(produto); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }
// Adiciona um produto private void btnAdiciona_Click(object sender, EventArgs e) { try { Produto produto = new Produto(); produto.Nome = txtNome.Text; produto.Descricao = txtDescricao.Text; Response response = produtoBLL.Insert(produto); MessageBox.Show(response.Message); if (response.Success) { UpdateGridView(); FerramentasTextBox.LimpaTextBoxes(this); } } catch (FormatException) { MessageBox.Show("Existem valores inválidos!"); } }