public void DeletarServicoPrestado(string id) { var comando = Comando.LerComando("DELETE FROM tblfatura_prestadores_servicos WHERE id_fatura = @idfatura"); comando.Parameters.Add(new MySqlParameter("@idfatura", id)); comando.ExecuteNonQuery(); Notificacao.Notificar("Fatura deletada ", ETipoNotificacao.Sucesso); }
public void DeletarPrestador(string id) { var comando = Comando.LerComando("DELETE FROM tblprestadores_servicos WHERE id_prestadores_servico = @id"); comando.Parameters.Add(new MySqlParameter("@id", id)); comando.ExecuteNonQuery(); DAOConexao.FecharConexao(); Notificacao.Notificar("Prestador excluído", ETipoNotificacao.Sucesso); }
private void SalvarNovoPrestador(object sender, RoutedEventArgs e) { try { var prestador = new Prestador(txtPrestador.Text, txtInfoAdicionais.Text); Prestadores.Add(prestador); prestadoresDAO.CriarPrestador(prestador); } catch (Exception err) { Notificacao.Notificar(err.Message, ETipoNotificacao.Erro); } }
public void CriarPrestador(Prestador prestador) { var comando = Comando.LerComando("INSERT INTO tblprestadores_servicos" + "(id_prestadores_servico, servico, infoAdicionais)" + "VALUES(@idGuid, @servico, @infoAdicionais)"); comando.Parameters.Add(new MySqlParameter("@idGuid", prestador.IdPrestador)); comando.Parameters.Add(new MySqlParameter("@servico", prestador.Servico)); comando.Parameters.Add(new MySqlParameter("@infoAdicionais", prestador.InfoAdicionaisPrestador)); comando.ExecuteNonQuery(); DAOConexao.FecharConexao(); Notificacao.Notificar("Prestador adicionado", ETipoNotificacao.Sucesso); }
public static DbCommand LerComando(string sqlComando) { try { var conexao = DAOConexao.ObterConexao(); var comando = DAOConexao.ObterComando(conexao); comando.CommandType = CommandType.Text; comando.CommandText = sqlComando; return(comando); } catch (Exception err) { Notificacao.Notificar(err.Message.ToString(), ETipoNotificacao.Erro); throw; } }
public void AtualizarFaturaServicoPrestado(ServicoPrestado fatura) { var comando = Comando.LerComando("UPDATE tblfatura_prestadores_servicos " + "SET data_chegada = @dataChegada, mes_referencia = @mesRef, " + "valor_fatura = @valorFatura, data_vencimento = @dataVencimento, " + "status = @status, info_fatura_adicionais = @infoAdicionais " + "WHERE id_fatura = @idfatura"); comando.Parameters.Add(new MySqlParameter("@dataChegada", fatura.DataChegada.DataFormatoBD)); comando.Parameters.Add(new MySqlParameter("@mesRef", fatura.MesReferencia)); comando.Parameters.Add(new MySqlParameter("@valorFatura", fatura.ValorFatura)); comando.Parameters.Add(new MySqlParameter("@dataVencimento", fatura.DataVencimento.DataFormatoBD)); comando.Parameters.Add(new MySqlParameter("@status", fatura.Status)); comando.Parameters.Add(new MySqlParameter("@infoAdicionais", fatura.InfoAdicionaisFatura)); comando.Parameters.Add(new MySqlParameter("@idfatura", fatura.IdFatura)); comando.ExecuteNonQuery(); Notificacao.Notificar("Fatura Atualizada ", ETipoNotificacao.Sucesso); }