/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/6/7 12:10:56</remarks>
        public bool Update(StatisticInfoEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_StatisticInfo_Update");

            database.AddInParameter(commandWrapper, "@ZoneId", DbType.Int32, entity.ZoneId);
            database.AddInParameter(commandWrapper, "@TotalUser", DbType.Int32, entity.TotalUser);
            database.AddInParameter(commandWrapper, "@TotalManager", DbType.Int32, entity.TotalManager);
            database.AddInParameter(commandWrapper, "@TotalPay", DbType.Int64, entity.TotalPay);
            database.AddInParameter(commandWrapper, "@PointRemain", DbType.Int64, entity.PointRemain);
            database.AddInParameter(commandWrapper, "@Pcu", DbType.Int32, entity.Pcu);
            database.AddInParameter(commandWrapper, "@Acu", DbType.Int32, entity.Acu);
            database.AddInParameter(commandWrapper, "@OnlineMinutes", DbType.Int64, entity.OnlineMinutes);
            database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }


            return(Convert.ToBoolean(results));
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到StatisticInfoEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public StatisticInfoEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new StatisticInfoEntity();

            obj.ZoneId        = (System.Int32)reader["ZoneId"];
            obj.TotalUser     = (System.Int32)reader["TotalUser"];
            obj.TotalManager  = (System.Int32)reader["TotalManager"];
            obj.TotalPay      = (System.Int64)reader["TotalPay"];
            obj.PointRemain   = (System.Int64)reader["PointRemain"];
            obj.Pcu           = (System.Int32)reader["Pcu"];
            obj.Acu           = (System.Int32)reader["Acu"];
            obj.OnlineMinutes = (System.Int64)reader["OnlineMinutes"];
            obj.UpdateTime    = (System.DateTime)reader["UpdateTime"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="zoneId">zoneId</param>
        /// <returns>StatisticInfoEntity</returns>
        /// <remarks>2016/6/7 12:10:56</remarks>
        public StatisticInfoEntity GetById(System.Int32 zoneId)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_StatisticInfo_GetById");

            database.AddInParameter(commandWrapper, "@ZoneId", DbType.Int32, zoneId);


            StatisticInfoEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
示例#4
0
        public static bool Update(StatisticInfoEntity statisticInfoEntity, DbTransaction trans = null)
        {
            var provider = new StatisticInfoProvider();

            return(provider.Update(statisticInfoEntity, trans));
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/6/7 12:10:56</remarks>
 public bool Update(StatisticInfoEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/6/7 12:10:56</remarks>
 public bool Insert(StatisticInfoEntity entity)
 {
     return(Insert(entity, null));
 }