Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool InserirMovimentoLimiteInstrumentoBMF(LimiteClienteInstrumentoBMF info)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GradualOMS"].ConnectionString);

            try
            {
                conn.Open();

                gComando             = new SqlCommand("prc_ins_limite_bmf_instrumento", conn);
                gComando.CommandType = System.Data.CommandType.StoredProcedure;


                gComando.Parameters.Add(new SqlParameter("@idClienteParametroInstrumento", info.idClienteParametroInstrumento));
                gComando.Parameters.Add(new SqlParameter("@idClienteParametroBMF", info.idClienteParametroBMF));
                gComando.Parameters.Add(new SqlParameter("@instrumento", info.instrumento));
                gComando.Parameters.Add(new SqlParameter("@qtTotalContratoPai", info.qtTotalContratoPai));
                gComando.Parameters.Add(new SqlParameter("@qtTotalInstrumento", info.qtTotalInstrumento));
                gComando.Parameters.Add(new SqlParameter("@qtDisponivel", info.qtDispInstrumento));

                gComando.ExecuteNonQuery();

                logger.Info("Movimento de limite de instrumento BMF inserido no banco de dados ");
            }
            catch (SqlException sqlex)
            {
                PrintSqlException(sqlex);
                return(false);
            }
            catch (Exception ex)
            {
                logger.Error("InserirMovimentoLimite() Erro:    " + ex.Message, ex);
                return(false);
            }
            finally
            {
                gComando.Dispose();
                gComando = null;
                FecharConexao(conn);
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Instrumento BMF
        /// </summary>
        /// <param name="movto"></param>
        /// <returns></returns>
        public bool InserirMovimentoLimiteInstrumentoBMF(LimiteClienteInstrumentoBMF info)
        {
            try
            {
                loggerCliente.InfoFormat("IdClienteParametroInstrumento[{0}] IdClienteParametroBMF[{1}] Instrumento[{2}] " +
                                         "QtTotalContratoPai[{3}] QtTotalInstrumento[{4}] QtDisponivel[{5}]",
                                         info.idClienteParametroInstrumento, info.idClienteParametroInstrumento, info.instrumento,
                                         info.qtTotalContratoPai, info.qtTotalInstrumento, info.qtDispInstrumento);

                /*
                 * gComando.Parameters.Add(new SqlParameter("@idClienteParametroInstrumento", info.idClienteParametroInstrumento));
                 * gComando.Parameters.Add(new SqlParameter("@idClienteParametroBMF", info.idClienteParametroBMF));
                 * gComando.Parameters.Add(new SqlParameter("@instrumento", info.instrumento));
                 * gComando.Parameters.Add(new SqlParameter("@qtTotalContratoPai", info.qtTotalContratoPai));
                 * gComando.Parameters.Add(new SqlParameter("@qtTotalInstrumento", info.qtTotalInstrumento));
                 * gComando.Parameters.Add(new SqlParameter("@qtDisponivel", info.qtDispInstrumento));
                 */
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #3
0
        public List <LimiteClienteInstrumentoBMF> CarregarLimiteInstrumentosBMF(int account = 0)
        {
            List <LimiteClienteInstrumentoBMF> ret = new List <LimiteClienteInstrumentoBMF>();
            SqlDataAdapter lAdapter;

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GradualOMS"].ConnectionString);

            conn.Open();

            DataSet lDataSet = new DataSet();

            if (0 == account)
            {
                gComando             = new SqlCommand("prc_fixsrv_carregar_limite_clientes_bmf_instrumento", conn);
                gComando.CommandType = System.Data.CommandType.StoredProcedure;
            }
            else
            {
                gComando             = new SqlCommand("prc_fixsrv_carregar_limite_clientes_bmf_instrumento_account", conn);
                gComando.CommandType = System.Data.CommandType.StoredProcedure;
                gComando.Parameters.Add(new SqlParameter("@Account", account));
            }



            lAdapter = new SqlDataAdapter(gComando);

            lAdapter.Fill(lDataSet);

            foreach (DataRow lRow in lDataSet.Tables[0].Rows)
            {
                //DataRow lRow = lDataSet.Tables[0].Rows[0];

                LimiteClienteInstrumentoBMF info = new LimiteClienteInstrumentoBMF();

                info.idClienteParametroInstrumento = lRow["idClienteParametroInstrumento"].DBToInt32();
                info.idClienteParametroBMF         = lRow["idClienteParametroBMF"].DBToInt32();
                info.account           = lRow["account"].DBToInt32();
                info.contrato          = lRow["contrato"].DBToString();
                info.instrumento       = lRow["instrumento"].DBToString();
                info.sentido           = lRow["sentido"].DBToString().ToUpper();
                info.qtDispInstrumento = lRow["qtDispInstrumento"].DBToInt32();
                //info.qtPrealocado = lRow["qtPrealocado"].DBToInt32();
                info.qtTotalContratoPai    = lRow["qtTotalContratoPai"].DBToInt32();
                info.qtTotalInstrumento    = lRow["qtTotalInstrumento"].DBToInt32();
                info.stAtivo               = lRow["stAtivo"].DBToString().ToUpper().Equals("S");
                info.stRenovacaoAutomatica = lRow["stRenovacaoAutomatica"].DBToString().ToUpper().Equals("S");
                info.dtMovimento           = lRow["dtMovimento"].DBToDateTime();
                info.dtValidade            = lRow["dtValidade"].DBToDateTime();

                info.qtPrealocado = 0;
                if (info.dtValidade < DateTime.Now)
                {
                    info.qtTotalContratoPai = 0;
                    info.qtTotalInstrumento = 0;
                    info.qtDispContrato     = 0;
                    info.qtDispInstrumento  = 0;
                }

                ret.Add(info);
            }

            FecharConexao(conn);

            return(ret);
        }