public bool InserirMvtoBvsp(OperatingLimitInfo opLimit) { try { _abrirConexao(_strConnectionStringDefault); _sqlCommand = new SqlCommand("prc_lmt_insere_cliente_parametro_valor", _sqlConn); _sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; _sqlCommand.Parameters.Add(new SqlParameter("@id_cliente_parametro", opLimit.CodigoParametroCliente)); _sqlCommand.Parameters.Add(new SqlParameter("@ValorMovimento", opLimit.ValorMovimento)); _sqlCommand.Parameters.Add(new SqlParameter("@ValorAlocado", opLimit.ValorAlocado)); _sqlCommand.Parameters.Add(new SqlParameter("@ValorDisponivel", opLimit.ValorDisponivel)); _sqlCommand.Parameters.Add(new SqlParameter("@Descricao", "ATUALIZACAO LIMITE OPERACIONAL")); _sqlCommand.Parameters.Add(new SqlParameter("@StNatureza", opLimit.StNatureza)); int rows = _sqlCommand.ExecuteNonQuery(); _fecharConexao(); if (rows > 0) { return(true); } return(false); } catch (Exception ex) { logger.Error("Problemas na atualizacao de movimentacao de limite Bovespa: " + ex.Message, ex); return(false); } }
public bool InserirMvtoBovespa(OperatingLimitInfo item) { try { loggerCliente.InfoFormat("CodigoCliente: [{0}] TipoLimite: [{1}] PrecoBase: [{2}] ValorAlocado: [{3}] ValorDisponivel: [{4}] ValorTotal: [{5}]", item.CodigoCliente, item.TipoLimite, item.PrecoBase, item.ValorAlocado, item.ValorDisponivel, item.ValotTotal); return(true); } catch { return(false); } }
public List <OperatingLimitInfo> CarregarLimiteOperacional(int account) { try { List <OperatingLimitInfo> ret = null; SqlDataAdapter lAdapter; _abrirConexao(_strConnectionStringDefault); DataSet lDataSet = new DataSet(); _sqlCommand = new SqlCommand("prc_lmt_obter_relacao_limites", _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) { if (lDataSet.Tables[0].Rows.Count > 0) { ret = new List <OperatingLimitInfo>(); } foreach (DataRow lRow in lDataSet.Tables[0].Rows) { OperatingLimitInfo item = new OperatingLimitInfo(); item.CodigoCliente = account; item.CodigoParametroCliente = lRow["id_cliente_parametro"].DBToInt32(); item.DataValidade = lRow["dt_validade"].DBToDateTime(); item.TipoLimite = (TipoLimiteEnum)(lRow["id_parametro"].DBToInt32()); item.ValotTotal = lRow["vl_parametro"].DBToDecimal(); item.ValorAlocado = lRow["vl_alocado"].DBToDecimal(); item.ValorDisponivel = (item.ValotTotal - item.ValorAlocado); ret.Add(item); } } _fecharConexao(); lAdapter.Dispose(); lDataSet.Dispose(); _sqlCommand.Dispose(); return(ret); } catch (Exception ex) { logger.Error("Erro ao obter limite operacional do cliente: " + ex.Message, ex); return(null); } }
public bool AtualizarMvtoBvsp(OperatingLimitInfo opLimit) { try { _abrirConexao(_strConnectionStringDefault); _sqlCommand = new SqlCommand("prc_lmt_atualiza_posicao_limite_oms", _sqlConn); _sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; _sqlCommand.Parameters.Add(new SqlParameter("@id_cliente_parametro", opLimit.CodigoParametroCliente)); _sqlCommand.Parameters.Add(new SqlParameter("@ValorAlocado", opLimit.ValorAlocado)); int rows = _sqlCommand.ExecuteNonQuery(); _fecharConexao(); if (rows > 0) { return(true); } return(false); } catch (Exception ex) { logger.Error("Problemas na atualizacao de movimentacao de limite Bovespa: " + ex.Message, ex); return(false); } }