Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BCW.SFC.Model.SfJackpot model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_SfJackpot set ");
            strSql.Append("usID=@usID,");
            strSql.Append("Prize=@Prize,");
            strSql.Append("WinPrize=@WinPrize,");
            strSql.Append("other=@other, ");
            strSql.Append("allmoney=@allmoney, ");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("CID=@CID");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",       SqlDbType.Int,        4),
                new SqlParameter("@usID",     SqlDbType.Int,        4),
                new SqlParameter("@Prize",    SqlDbType.BigInt,     8),
                new SqlParameter("@WinPrize", SqlDbType.BigInt,     8),
                new SqlParameter("@other",    SqlDbType.NVarChar,  50),
                new SqlParameter("@allmoney", SqlDbType.BigInt,     8),
                new SqlParameter("AddTime",   SqlDbType.DateTime),
                new SqlParameter("@CID",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.usID;
            parameters[2].Value = model.Prize;
            parameters[3].Value = model.WinPrize;
            parameters[4].Value = model.other;
            parameters[5].Value = model.allmoney;
            parameters[6].Value = model.AddTime;
            parameters[7].Value = model.CID;
            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.SFC.Model.SfJackpot GetSfJackpot(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,usID,Prize,WinPrize,other,allmoney,AddTime,CID from tb_SfJackpot ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            BCW.SFC.Model.SfJackpot model = new BCW.SFC.Model.SfJackpot();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.id       = reader.GetInt32(0);
                    model.usID     = reader.GetInt32(1);
                    model.Prize    = reader.GetInt64(2);
                    model.WinPrize = reader.GetInt64(3);
                    model.other    = reader.GetString(4);
                    model.allmoney = reader.GetInt64(5);
                    model.AddTime  = reader.GetDateTime(6);
                    model.CID      = reader.GetInt32(7);
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BCW.SFC.Model.SfJackpot model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_SfJackpot(");
            strSql.Append("usID,Prize,WinPrize,other,allmoney,AddTime,CID)");
            strSql.Append(" values (");
            strSql.Append("@usID,@Prize,@WinPrize,@other,@allmoney,@AddTime,@CID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@usID",     SqlDbType.Int,        4),
                new SqlParameter("@Prize",    SqlDbType.BigInt,     8),
                new SqlParameter("@WinPrize", SqlDbType.BigInt,     8),
                new SqlParameter("@other",    SqlDbType.NVarChar,  50),
                new SqlParameter("@allmoney", SqlDbType.BigInt,     8),
                new SqlParameter("AddTime",   SqlDbType.DateTime),
                new SqlParameter("@CID",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.usID;
            parameters[1].Value = model.Prize;
            parameters[2].Value = model.WinPrize;
            parameters[3].Value = model.other;
            parameters[4].Value = model.allmoney;
            parameters[5].Value = model.AddTime;
            parameters[6].Value = model.CID;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 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 SfJackpot</returns>
        public IList <BCW.SFC.Model.SfJackpot> GetSfJackpots(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.SFC.Model.SfJackpot> listSfJackpots = new List <BCW.SFC.Model.SfJackpot>();
            string sTable     = "tb_SfJackpot";
            string sPkey      = "id";
            string sField     = "id,usID,Prize,WinPrize,other,allmoney,AddTime,CID";
            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(listSfJackpots);
                }
                while (reader.Read())
                {
                    BCW.SFC.Model.SfJackpot objSfJackpot = new BCW.SFC.Model.SfJackpot();
                    objSfJackpot.id       = reader.GetInt32(0);
                    objSfJackpot.usID     = reader.GetInt32(1);
                    objSfJackpot.Prize    = reader.GetInt64(2);
                    objSfJackpot.WinPrize = reader.GetInt64(3);
                    objSfJackpot.other    = reader.GetString(4);
                    objSfJackpot.allmoney = reader.GetInt64(5);
                    objSfJackpot.AddTime  = reader.GetDateTime(6);
                    objSfJackpot.CID      = reader.GetInt32(7);
                    listSfJackpots.Add(objSfJackpot);
                }
            }
            return(listSfJackpots);
        }