public List <BlockedInstrumentInfo> CarregarPermissaoAtivo() { try { List <BlockedInstrumentInfo> ret = null; SqlDataAdapter lAdapter; _abrirConexao(_strConnectionStringDefault); DataSet lDataSet = new DataSet(); _sqlCommand = new SqlCommand("prc_lmt_verificar_permissao_ativo", _sqlConn); _sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; lAdapter = new SqlDataAdapter(_sqlCommand); lAdapter.Fill(lDataSet); if (lDataSet.Tables.Count > 0) { if (lDataSet.Tables[0].Rows.Count > 0) { ret = new List <BlockedInstrumentInfo>(); } foreach (DataRow lRow in lDataSet.Tables[0].Rows) { BlockedInstrumentInfo item = new BlockedInstrumentInfo(); char sentido = lRow["sentido"].DBToString()[0]; switch (sentido) { case 'V': item.Sentido = SentidoBloqueioEnum.Venda; break; case 'C': item.Sentido = SentidoBloqueioEnum.Compra; break; default: item.Sentido = SentidoBloqueioEnum.Ambos; break; } item.Instrumento = lRow["ds_item"].DBToString(); ret.Add(item); } } _fecharConexao(); lAdapter.Dispose(); lDataSet.Dispose(); _sqlCommand.Dispose(); return(ret); } catch (Exception ex) { logger.Error("Erro ao obter permissao global dos instrumentos: " + ex.Message, ex); return(null); } }
public List <BlockedInstrumentInfo> CarregarPermissaoAtivoCliente(int account) { try { List <BlockedInstrumentInfo> ret = null; SqlDataAdapter lAdapter; _abrirConexao(_strConnectionStringDefault); DataSet lDataSet = new DataSet(); _sqlCommand = new SqlCommand("prc_lmt_sel_cliente_bloqueio_instrumento", _sqlConn); _sqlCommand.Parameters.Add(new SqlParameter("@id_cliente", account)); _sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; lAdapter = new SqlDataAdapter(_sqlCommand); lAdapter.Fill(lDataSet); if (lDataSet.Tables.Count > 0) { ret = new List <BlockedInstrumentInfo>(); foreach (DataRow lRow in lDataSet.Tables[0].Rows) { BlockedInstrumentInfo item = new BlockedInstrumentInfo(); char sentido = lRow["Direcao"].DBToString()[0]; switch (sentido) { case 'V': item.Sentido = SentidoBloqueioEnum.Venda; break; case 'C': item.Sentido = SentidoBloqueioEnum.Compra; break; default: item.Sentido = SentidoBloqueioEnum.Ambos; break; } item.Instrumento = lRow["cd_ativo"].DBToString(); item.IdCliente = lRow["id_cliente"].DBToInt32(); ret.Add(item); } } _fecharConexao(); lAdapter.Dispose(); lDataSet.Dispose(); _sqlCommand.Dispose(); return(ret); } catch (Exception ex) { logger.Error("Erro ao obter parametros de instrumentos do clientes: " + ex.Message, ex); return(null); } }