Beispiel #1
0
        /// <summary>
        /// 得到总收集币
        /// </summary>
        public BCW.bydr.Model.CmgToplist GetCmgTopAllcolletGold(int usID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select AllcolletGold from tb_CmgToplist ");
            strSql.Append(" where usID=@usID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@usID", SqlDbType.Int, 4)
            };
            parameters[0].Value = usID;
            BCW.bydr.Model.CmgToplist model = new BCW.bydr.Model.CmgToplist();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.AllcolletGold = reader.GetInt64(0);
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BCW.bydr.Model.CmgToplist model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_CmgToplist set ");
            strSql.Append("AllcolletGold=@AllcolletGold,");
            strSql.Append("McolletGold=@McolletGold,");
            strSql.Append("DcolletGold=@DcolletGold,");
            strSql.Append("YcolletGold=@YcolletGold,");
            strSql.Append("usID=@usID,");
            strSql.Append("stype=@stype,");
            strSql.Append("Time=@Time,");
            strSql.Append("sid=@sid,");
            strSql.Append("updatetime=@updatetime,");
            strSql.Append("vit=@vit,");
            strSql.Append("Signtime=@Signtime");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",            SqlDbType.Int,       4),
                new SqlParameter("@AllcolletGold", SqlDbType.BigInt,    8),
                new SqlParameter("@McolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@DcolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@YcolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@usID",          SqlDbType.Int,       4),
                new SqlParameter("@stype",         SqlDbType.Int,       4),
                new SqlParameter("@Time",          SqlDbType.DateTime),
                new SqlParameter("@sid",           SqlDbType.Int,       4),
                new SqlParameter("@updatetime",    SqlDbType.DateTime),
                new SqlParameter("@vit",           SqlDbType.Int,       4),
                new SqlParameter("@Signtime",      SqlDbType.DateTime)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.AllcolletGold;
            parameters[2].Value  = model.McolletGold;
            parameters[3].Value  = model.DcolletGold;
            parameters[4].Value  = model.YcolletGold;
            parameters[5].Value  = model.usID;
            parameters[6].Value  = model.stype;
            parameters[7].Value  = model.Time;
            parameters[8].Value  = model.sid;
            parameters[9].Value  = model.updatetime;
            parameters[10].Value = model.vit;
            parameters[11].Value = model.Signtime;

            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BCW.bydr.Model.CmgToplist model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_CmgToplist(");
            strSql.Append("AllcolletGold,McolletGold,DcolletGold,YcolletGold,usID,stype,Time,sid,updatetime,vit,Signtime)");
            strSql.Append(" values (");
            strSql.Append("@AllcolletGold,@McolletGold,@DcolletGold,@YcolletGold,@usID,@stype,@Time,@sid,@updatetime,@vit,@Signtime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AllcolletGold", SqlDbType.BigInt,    8),
                new SqlParameter("@McolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@DcolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@YcolletGold",   SqlDbType.BigInt,    8),
                new SqlParameter("@usID",          SqlDbType.Int,       4),
                new SqlParameter("@stype",         SqlDbType.Int,       4),
                new SqlParameter("@Time",          SqlDbType.DateTime),
                new SqlParameter("@sid",           SqlDbType.Int,       4),
                new SqlParameter("@updatetime",    SqlDbType.DateTime),
                new SqlParameter("@vit",           SqlDbType.Int,       4),
                new SqlParameter("@Signtime",      SqlDbType.DateTime)
            };
            parameters[0].Value  = model.AllcolletGold;
            parameters[1].Value  = model.McolletGold;
            parameters[2].Value  = model.DcolletGold;
            parameters[3].Value  = model.YcolletGold;
            parameters[4].Value  = model.usID;
            parameters[5].Value  = model.stype;
            parameters[6].Value  = model.Time;
            parameters[7].Value  = model.sid;
            parameters[8].Value  = model.updatetime;
            parameters[9].Value  = model.vit;
            parameters[10].Value = model.Signtime;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #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 CmgToplist</returns>
        public IList <BCW.bydr.Model.CmgToplist> GetCmgToplists1(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.bydr.Model.CmgToplist> listCmgToplists = new List <BCW.bydr.Model.CmgToplist>();
            string sTable     = "tb_CmgToplist";
            string sPkey      = "id";
            string sField     = "ID,AllcolletGold,McolletGold,DcolletGold,YcolletGold,usID,stype,Time,sid,updatetime,vit,Signtime";
            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(listCmgToplists);
                }
                while (reader.Read())
                {
                    BCW.bydr.Model.CmgToplist objCmgToplist = new BCW.bydr.Model.CmgToplist();
                    objCmgToplist.ID            = reader.GetInt32(0);
                    objCmgToplist.AllcolletGold = reader.GetInt64(1);
                    objCmgToplist.McolletGold   = reader.GetInt64(2);
                    objCmgToplist.DcolletGold   = reader.GetInt64(3);
                    objCmgToplist.YcolletGold   = reader.GetInt64(4);
                    objCmgToplist.usID          = reader.GetInt32(5);
                    objCmgToplist.stype         = reader.GetInt32(6);
                    objCmgToplist.Time          = reader.GetDateTime(7);
                    objCmgToplist.sid           = reader.GetInt32(8);
                    objCmgToplist.updatetime    = reader.GetDateTime(9);
                    objCmgToplist.vit           = reader.GetInt32(10);
                    objCmgToplist.Signtime      = reader.GetDateTime(11);
                    listCmgToplists.Add(objCmgToplist);
                }
            }
            return(listCmgToplists);
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.bydr.Model.CmgToplist GetCmgToplistusID(int usID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,AllcolletGold,McolletGold,DcolletGold,YcolletGold,usID,stype,Time, sid ,updatetime,vit,Signtime from tb_CmgToplist ");
            strSql.Append(" where usID=@usID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@usID", SqlDbType.Int, 4)
            };
            parameters[0].Value = usID;

            BCW.bydr.Model.CmgToplist model = new BCW.bydr.Model.CmgToplist();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.ID            = reader.GetInt32(0);
                    model.AllcolletGold = reader.GetInt64(1);
                    model.McolletGold   = reader.GetInt64(2);
                    model.DcolletGold   = reader.GetInt64(3);
                    model.YcolletGold   = reader.GetInt64(4);
                    model.usID          = reader.GetInt32(5);
                    model.stype         = reader.GetInt32(6);
                    model.Time          = reader.GetDateTime(7);
                    model.sid           = reader.GetInt32(8);
                    model.updatetime    = reader.GetDateTime(9);
                    model.vit           = reader.GetInt32(10);
                    model.Signtime      = reader.GetDateTime(11);
                    return(model);
                }
                else
                {
                    model.vit = 0;
                    return(model);
                }
            }
        }