コード例 #1
0
        public static IMaoProbabilidade GetItem(string ds_mao_persistida)
        {
            IMaoProbabilidade acaoProbailidade = null;

            StringBuilder strBuilder = new StringBuilder()
                                       .AppendFormat(MaoProbabilidadeContexto.GetSelectString() +
                                                     " WHERE " +
                                                     "ds_jogo_mao = \'{0}\'" + Environment.NewLine,
                                                     ds_mao_persistida
                                                     );

            DBConnect.AbreConexaoSeNaoEstiverAberta();
            IDbCommand command = DBConnect.Connection.CreateCommand();

            command.CommandText = strBuilder.ToString();

            using (IDataReader dataReader = command.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    acaoProbailidade = MaoProbabilidadeContexto.GetItem(dataReader);
                }
            }

            DBConnect.FecharConexao();

            return(acaoProbailidade);
        }
コード例 #2
0
        public static IList <IMaoProbabilidade> GetHandLike(string maoWhere)
        {
            IList <IMaoProbabilidade> maoProbailidade = new List <IMaoProbabilidade>();

            StringBuilder strBuilder = new StringBuilder()
                                       .AppendFormat(MaoProbabilidadeContexto.GetSelectString() +
                                                     " WHERE " +
                                                     "ds_jogo_mao like \'{0}%\'" + Environment.NewLine,
                                                     maoWhere
                                                     );

            DBConnect.AbreConexaoSeNaoEstiverAberta();
            IDbCommand command = DBConnect.Connection.CreateCommand();

            command.CommandText = strBuilder.ToString();
            int contador = 0;

            using (IDataReader dataReader = command.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    maoProbailidade.Add(MaoProbabilidadeContexto.GetItem(dataReader));
                }
            }

            DBConnect.FecharConexao();

            return(maoProbailidade);
        }
コード例 #3
0
        private static IList <IMaoProbabilidade> GetAllItems(int numItens, int offset, string clausulaWhere = "")
        {
            IList <IMaoProbabilidade> lista         = new List <IMaoProbabilidade>();
            StringBuilder             stringBuilder = new StringBuilder(MaoProbabilidadeContexto.GetSelectString());

            stringBuilder.AppendFormat(clausulaWhere);
            stringBuilder.AppendFormat(" LIMIT {0} OFFSET {1}", numItens, offset);

            IDbCommand command = DBConnect.Connection.CreateCommand();

            command.CommandText = stringBuilder.ToString();

            using (IDataReader dataReader = command.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    lista.Add(MaoProbabilidadeContexto.GetItem(dataReader));
                }
            }

            return(lista);
        }