/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/8/15 14:43:38</remarks>
        public bool Update(ConfigArenanpclinkEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigArenanpclink_Update");

            database.AddInParameter(commandWrapper, "@NpcId", DbType.Guid, entity.NpcId);
            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, entity.GroupId);
            database.AddInParameter(commandWrapper, "@Kpi", DbType.Int32, entity.Kpi);
            database.AddInParameter(commandWrapper, "@DanGrading", DbType.Int32, entity.DanGrading);


            int results = 0;

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

            entity.NpcId = (System.Guid)database.GetParameterValue(commandWrapper, "@NpcId");

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

            obj.NpcId      = (System.Guid)reader["NpcId"];
            obj.Idx        = (System.Int32)reader["Idx"];
            obj.GroupId    = (System.Int32)reader["GroupId"];
            obj.Kpi        = (System.Int32)reader["Kpi"];
            obj.DanGrading = (System.Int32)reader["DanGrading"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="npcId">npcId</param>
        /// <returns>ConfigArenanpclinkEntity</returns>
        /// <remarks>2016/8/15 14:43:38</remarks>
        public ConfigArenanpclinkEntity GetById(System.Guid npcId)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

            database.AddInParameter(commandWrapper, "@NpcId", DbType.Guid, npcId);


            ConfigArenanpclinkEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/8/15 14:43:38</remarks>
 public bool Update(ConfigArenanpclinkEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/8/15 14:43:38</remarks>
 public bool Insert(ConfigArenanpclinkEntity entity)
 {
     return(Insert(entity, null));
 }
Ejemplo n.º 6
0
        public static bool Update(ConfigArenanpclinkEntity configArenanpclinkEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigArenanpclinkProvider(zoneId);

            return(provider.Update(configArenanpclinkEntity, trans));
        }