Example #1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2014/10/29 14:16:38</remarks>
        public bool Update(ConfigRevelationnpclinkEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigRevelationnpclink_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@StageId", DbType.Int32, entity.StageId);
            database.AddInParameter(commandWrapper, "@SmallClearanceId", DbType.Int32, entity.SmallClearanceId);
            database.AddInParameter(commandWrapper, "@NpcId", DbType.Guid, entity.NpcId);


            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));
        }
Example #2
0
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigRevelationnpclinkEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigRevelationnpclinkEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigRevelationnpclinkEntity();

            obj.Idx              = (System.Int32)reader["Idx"];
            obj.StageId          = (System.Int32)reader["StageId"];
            obj.SmallClearanceId = (System.Int32)reader["SmallClearanceId"];
            obj.NpcId            = (System.Guid)reader["NpcId"];

            return(obj);
        }
Example #3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigRevelationnpclinkEntity</returns>
        /// <remarks>2014/10/29 14:16:38</remarks>
        public ConfigRevelationnpclinkEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigRevelationnpclinkEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Example #4
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2014/10/29 14:16:38</remarks>
 public bool Update(ConfigRevelationnpclinkEntity entity)
 {
     return(Update(entity, null));
 }
Example #5
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2014/10/29 14:16:38</remarks>
 public bool Insert(ConfigRevelationnpclinkEntity entity)
 {
     return(Insert(entity, null));
 }
Example #6
0
        public static bool Update(ConfigRevelationnpclinkEntity configRevelationnpclinkEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigRevelationnpclinkProvider(zoneId);

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