/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/7/12 20:13:34</remarks>
        public bool Update(NbManagervippackageEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_NbManagervippackage_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId);
            database.AddInParameter(commandWrapper, "@PackageLevel", DbType.Int32, entity.PackageLevel);
            database.AddInParameter(commandWrapper, "@IsGet", DbType.Int32, entity.IsGet);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.Date, entity.RowTime);


            int results = 0;

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

            entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx");

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

            obj.Idx          = (System.Int32)reader["Idx"];
            obj.ManagerId    = (System.Guid)reader["ManagerId"];
            obj.PackageLevel = (System.Int32)reader["PackageLevel"];
            obj.IsGet        = (System.Int32)reader["IsGet"];
            obj.RowTime      = (System.DateTime)reader["RowTime"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>NbManagervippackageEntity</returns>
        /// <remarks>2016/7/12 20:13:34</remarks>
        public NbManagervippackageEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx);


            NbManagervippackageEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        /// <summary>
        /// GetRecord
        /// </summary>
        /// <param name="managerId">managerId</param>
        /// <param name="packageLevel">packageLevel</param>
        /// <returns>NbManagervippackageEntity</returns>
        /// <remarks>2016/7/12 20:13:34</remarks>
        public NbManagervippackageEntity GetRecord(System.Guid managerId, System.Int32 packageLevel)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId);
            database.AddInParameter(commandWrapper, "@PackageLevel", DbType.Int32, packageLevel);


            NbManagervippackageEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        public static bool Insert(NbManagervippackageEntity nbManagervippackageEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new NbManagervippackageProvider(zoneId);

            return(provider.Insert(nbManagervippackageEntity, trans));
        }