public bool AlterarChamado(Chamado chamado) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterChamado"; conexao.Comando.Parameters.AddWithValue("@Funcao", 2); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@dataSolicitada", chamado.dataSolicitada == DateTime.MinValue ? null : chamado.dataSolicitada.ToString("u").Replace("Z", "")); conexao.Comando.Parameters.AddWithValue("@dataInicio", chamado.dataInicio == DateTime.MinValue ? null : chamado.dataInicio.ToString("u").Replace("Z", "")); conexao.Comando.Parameters.AddWithValue("@dataTermino", chamado.dataTermino == DateTime.MinValue ? null : chamado.dataTermino.ToString("u").Replace("Z", "")); conexao.Comando.Parameters.AddWithValue("@usuarioSolicitante", chamado.usuarioSolicitante.idUsuario); conexao.Comando.Parameters.AddWithValue("@usuarioAtendimento", chamado.usuarioAtendimento.idUsuario == 0 ? null : chamado.usuarioAtendimento.idUsuario.ToString()); conexao.Comando.Parameters.AddWithValue("@idNivel", chamado.Nivel.idNivel); conexao.Comando.Parameters.AddWithValue("@idTipo", chamado.Tipo.idTipo); conexao.Comando.Parameters.AddWithValue("@idStatus", chamado.Status.idStatus); conexao.Comando.Parameters.AddWithValue("@descricaoSolicitacao", chamado.descricaoSolicitacao == "" ? null : chamado.descricaoSolicitacao); conexao.Comando.Parameters.AddWithValue("@descricaoResolucao", chamado.descricaoResolucao == "" ? null : chamado.descricaoResolucao); conexao.Comando.Parameters.AddWithValue("@idChamado", chamado.idChamado); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool DeletarNivel(Nivel nivel) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterNivel "; conexao.Comando.Parameters.AddWithValue("@Funcao", 3); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@idNivel", nivel.idNivel); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool CadastrarPerfil(Perfil perfil) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterPerfil "; conexao.Comando.Parameters.AddWithValue("@Funcao", 1); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@nomePerfil", perfil.nomePerfil); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool DesativarUsuario(Usuario usuario) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterUsuario"; conexao.Comando.Parameters.AddWithValue("@Funcao", 3); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@idUsuario", usuario.idUsuario); conexao.Comando.Parameters.AddWithValue("@FlAtivo", false); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool CadastrarStatus(Status status) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterStatus "; conexao.Comando.Parameters.AddWithValue("@Funcao", 1); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@nomeStatus", status.nomeStatus); conexao.Comando.Parameters.AddWithValue("@Finalizador", status.finalizador); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool AlterarTipo(Tipo tipo) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterTipo"; conexao.Comando.Parameters.AddWithValue("@Funcao", 2); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@nomeTipo", tipo.nomeTipo); conexao.Comando.Parameters.AddWithValue("@idTipo", tipo.idTipo); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }
public bool CadastrarUsuario(Usuario usuario) { using (ConexaoBD conexao = new ConexaoBD(this.strConexao)) { conexao.Comando.CommandText = "dbo.pr_ManterUsuario"; conexao.Comando.Parameters.AddWithValue("@Funcao", 1); conexao.Comando.CommandType = System.Data.CommandType.StoredProcedure; conexao.Comando.Parameters.AddWithValue("@nomeUsuario", usuario.nomeUsuario); conexao.Comando.Parameters.AddWithValue("@loginUsuario", usuario.loginUsuario); conexao.Comando.Parameters.AddWithValue("@senhaUsuario", usuario.senhaUsuario); conexao.Comando.Parameters.AddWithValue("@idPerfil", usuario.Perfil.idPerfil); if (conexao.ExecuteNonQuery() == 1) { return(true); } else { return(false); } } }