public HistAtualizReg RegistroAniel(String senha_master, int id_licenca_cliente) { if (!Senha_master_valida(senha_master)) { throw new Exception("Autenticacao invalida. "); } DAOHistAtualizReg histAtualizRegDAO = new DAOHistAtualizReg(); DAOLicenca_cliente licenca_clienteDAO = new DAOLicenca_cliente(); DAOCliente clienteDAO = new DAOCliente(); HistAtualizReg result = histAtualizRegDAO.buscarAtualizLicenca(id_licenca_cliente); licenca_clienteDAO.buscarID(result.Licenca_cliente); clienteDAO.buscarID(result.Licenca_cliente.Cliente); return(result); }
public HistAtualizReg buscarAtualizLicenca(int id_licenca_cliente) { SigletonConexaoFB.carregaStrcnx(); HistAtualizReg resultado = new HistAtualizReg(); FbCommand command = new FbCommand(); FbDataReader reader; try { command.Connection = SigletonConexaoFB.getConexao(); command.CommandText = "SELECT ID,ID_LICENCA_CLIENTE,DATA_ENVIO,QTDE_LICENCA,LIBERADO_ATE,VERSAO_ANIEL " + "FROM TB_ATUALIZ_REG_ANIEL WHERE ID_LICENCA_CLIENTE=" + id_licenca_cliente.ToString() + " AND LIBERADO_CLIENTE='" + 'S' + "'"; command.Connection.Open(); reader = command.ExecuteReader(); if (reader.Read()) { resultado.Id = int.Parse(reader["ID"].ToString()); resultado.Licenca_cliente.Id = int.Parse(reader["ID_LICENCA_CLIENTE"].ToString()); resultado.Data_envio = DateTime.Parse(reader["DATA_ENVIO"].ToString()); resultado.Qtde_licenca = int.Parse(reader["QTDE_LICENCA"].ToString()); resultado.Liberado_ate = DateTime.Parse(reader["LIBERADO_ATE"].ToString()); resultado.Versao_aniel = reader["VERSAO_ANIEL"].ToString(); } reader.Close(); } catch (Exception ex) { throw new Exception("Erro ao carregar dados do registro do Aniel: " + ex.Message); } finally { command.Connection.Close(); } return(resultado); }