示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BCW.BQC.Model.BQCPay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_BQCPay set ");
            strSql.Append("CID=@CID,");
            strSql.Append("usID=@usID,");
            strSql.Append("Vote=@Vote,");
            strSql.Append("VoteNum=@VoteNum,");
            strSql.Append("OverRide=@OverRide,");
            strSql.Append("PayCent=@PayCent,");
            strSql.Append("PayCents=@PayCents,");
            strSql.Append("State=@State,");
            strSql.Append("WinCent=@WinCent,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("IsPrize=@IsPrize,");
            strSql.Append("IsSpier=@IsSpier,");
            strSql.Append("change=@change");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CID",      SqlDbType.Int,       4),
                new SqlParameter("@usID",     SqlDbType.Int,       4),
                new SqlParameter("@Vote",     SqlDbType.NVarChar),
                new SqlParameter("@VoteNum",  SqlDbType.Int,       4),
                new SqlParameter("@OverRide", SqlDbType.Int,       4),
                new SqlParameter("@PayCent",  SqlDbType.Int,       4),
                new SqlParameter("@PayCents", SqlDbType.BigInt,    8),
                new SqlParameter("@State",    SqlDbType.Int,       4),
                new SqlParameter("@WinCent",  SqlDbType.BigInt,    8),
                new SqlParameter("@AddTime",  SqlDbType.DateTime),
                new SqlParameter("@IsPrize",  SqlDbType.Int,       4),
                new SqlParameter("@IsSpier",  SqlDbType.Int,       4),
                new SqlParameter("@id",       SqlDbType.Int,       4),
                new SqlParameter("@change",   SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.CID;
            parameters[1].Value  = model.usID;
            parameters[2].Value  = model.Vote;
            parameters[3].Value  = model.VoteNum;
            parameters[4].Value  = model.OverRide;
            parameters[5].Value  = model.PayCent;
            parameters[6].Value  = model.PayCents;
            parameters[7].Value  = model.State;
            parameters[8].Value  = model.WinCent;
            parameters[9].Value  = model.AddTime;
            parameters[10].Value = model.IsPrize;
            parameters[11].Value = model.IsSpier;
            parameters[12].Value = model.id;
            parameters[13].Value = model.change;

            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BCW.BQC.Model.BQCPay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_BQCPay(");
            strSql.Append("CID,usID,Vote,VoteNum,OverRide,PayCent,PayCents,State,WinCent,AddTime,IsPrize,IsSpier,change)");
            strSql.Append(" values (");
            strSql.Append("@CID,@usID,@Vote,@VoteNum,@OverRide,@PayCent,@PayCents,@State,@WinCent,@AddTime,@IsPrize,@IsSpier,@change)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CID",      SqlDbType.Int,       4),
                new SqlParameter("@usID",     SqlDbType.Int,       4),
                new SqlParameter("@Vote",     SqlDbType.NVarChar),
                new SqlParameter("@VoteNum",  SqlDbType.Int,       4),
                new SqlParameter("@OverRide", SqlDbType.Int,       4),
                new SqlParameter("@PayCent",  SqlDbType.Int,       4),
                new SqlParameter("@PayCents", SqlDbType.BigInt,    8),
                new SqlParameter("@State",    SqlDbType.Int,       4),
                new SqlParameter("@WinCent",  SqlDbType.BigInt,    8),
                new SqlParameter("@AddTime",  SqlDbType.DateTime),
                new SqlParameter("@IsPrize",  SqlDbType.Int,       4),
                new SqlParameter("@IsSpier",  SqlDbType.Int,       4),
                new SqlParameter("@change",   SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.CID;
            parameters[1].Value  = model.usID;
            parameters[2].Value  = model.Vote;
            parameters[3].Value  = model.VoteNum;
            parameters[4].Value  = model.OverRide;
            parameters[5].Value  = model.PayCent;
            parameters[6].Value  = model.PayCents;
            parameters[7].Value  = model.State;
            parameters[8].Value  = model.WinCent;
            parameters[9].Value  = model.AddTime;
            parameters[10].Value = model.IsPrize;
            parameters[11].Value = model.IsSpier;
            parameters[12].Value = model.change;

            object obj = SqlHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#3
0
        /// <summary>
        /// 取得排行记录
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">分页大小</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <returns>IList HcPay</returns>
        public IList <BCW.BQC.Model.BQCPay> GetBQCPaysTop(int p_pageIndex, int p_pageSize, string strWhere, out int p_recordCount)
        {
            IList <BCW.BQC.Model.BQCPay> listSFPayTop = new List <BCW.BQC.Model.BQCPay>();

            // 计算记录数
            string countString = "SELECT COUNT(DISTINCT usID) FROM tb_BQCPay where " + strWhere + "";

            p_recordCount = Convert.ToInt32(SqlHelper.GetSingle(countString));
            if (p_recordCount > 50)
            {
                p_recordCount = 50;
            }

            if (p_recordCount > 0)
            {
                int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
            }
            else
            {
                return(listSFPayTop);
            }
            // 取出相关记录
            string queryString = "";

            queryString = "SELECT Top 50 usID,sum(WinCent-PayCents) as WinCents FROM tb_BQCPay where " + strWhere + " group by usID Order by sum(WinCent-PayCents) desc";
            using (SqlDataReader reader = SqlHelper.ExecuteReader(queryString))
            {
                int stratIndex = (p_pageIndex - 1) * p_pageSize;
                int endIndex   = p_pageIndex * p_pageSize;
                int k          = 0;

                while (reader.Read())
                {
                    if (k >= stratIndex && k < endIndex)
                    {
                        BCW.BQC.Model.BQCPay objHcPay = new BCW.BQC.Model.BQCPay();
                        objHcPay.usID    = reader.GetInt32(0);
                        objHcPay.WinCent = reader.GetInt64(1);
                        listSFPayTop.Add(objHcPay);
                    }
                    if (k == endIndex)
                    {
                        break;
                    }
                    k++;
                }
            }
            return(listSFPayTop);
        }
示例#4
0
        /// <summary>
        /// 取得每页记录
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">分页大小</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <returns>IList BQCPay</returns>
        public IList <BCW.BQC.Model.BQCPay> GetBQCPays1(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.BQC.Model.BQCPay> listBQCPays = new List <BCW.BQC.Model.BQCPay>();
            string sTable     = "tb_BQCPay";
            string sPkey      = "id";
            string sField     = "CID,usID,Vote,VoteNum,OverRide,PayCent,PayCents,State,WinCent,AddTime,IsPrize,IsSpier,id,change,IsPrize2,Prize2Num";
            string sCondition = strWhere;
            string sOrder     = strOrder;
            int    iSCounts   = 0;

            using (SqlDataReader reader = SqlHelper.RunProcedureMe(sTable, sPkey, sField, p_pageIndex, p_pageSize, sCondition, sOrder, iSCounts, out p_recordCount))
            {
                //计算总页数
                if (p_recordCount > 0)
                {
                    int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
                }
                else
                {
                    return(listBQCPays);
                }
                while (reader.Read())
                {
                    BCW.BQC.Model.BQCPay objBQCPay = new BCW.BQC.Model.BQCPay();
                    objBQCPay.CID       = reader.GetInt32(0);
                    objBQCPay.usID      = reader.GetInt32(1);
                    objBQCPay.Vote      = reader.GetString(2);
                    objBQCPay.VoteNum   = reader.GetInt32(3);
                    objBQCPay.OverRide  = reader.GetInt32(4);
                    objBQCPay.PayCent   = reader.GetInt32(5);
                    objBQCPay.PayCents  = reader.GetInt64(6);
                    objBQCPay.State     = reader.GetInt32(7);
                    objBQCPay.WinCent   = reader.GetInt64(8);
                    objBQCPay.AddTime   = reader.GetDateTime(9);
                    objBQCPay.IsPrize   = reader.GetInt32(10);
                    objBQCPay.IsSpier   = reader.GetInt32(11);
                    objBQCPay.id        = reader.GetInt32(12);
                    objBQCPay.change    = reader.GetInt32(13);
                    objBQCPay.IsPrize2  = reader.GetInt32(14);
                    objBQCPay.Prize2Num = reader.GetInt32(15);
                    listBQCPays.Add(objBQCPay);
                }
            }
            return(listBQCPays);
        }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.BQC.Model.BQCPay GetBQCPay(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CID,usID,Vote,VoteNum,OverRide,PayCent,PayCents,State,WinCent,AddTime,IsPrize,IsSpier,id,change,IsPrize2,Prize2Num from tb_BQCPay ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            BCW.BQC.Model.BQCPay model = new BCW.BQC.Model.BQCPay();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.CID       = reader.GetInt32(0);
                    model.usID      = reader.GetInt32(1);
                    model.Vote      = reader.GetString(2);
                    model.VoteNum   = reader.GetInt32(3);
                    model.OverRide  = reader.GetInt32(4);
                    model.PayCent   = reader.GetInt32(5);
                    model.PayCents  = reader.GetInt64(6);
                    model.State     = reader.GetInt32(7);
                    model.WinCent   = reader.GetInt64(8);
                    model.AddTime   = reader.GetDateTime(9);
                    model.IsPrize   = reader.GetInt32(10);
                    model.IsSpier   = reader.GetInt32(11);
                    model.id        = reader.GetInt32(12);
                    model.change    = reader.GetInt32(13);
                    model.IsPrize2  = reader.GetInt32(14);
                    model.Prize2Num = reader.GetInt32(15);
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }