/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/5/18 18:32:27</remarks>
        public bool Update(DicFormationpointEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicFormationpoint_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@PlayerPoint", DbType.AnsiString, entity.PlayerPoint);
            database.AddInParameter(commandWrapper, "@BallParkPoint", DbType.AnsiString, entity.BallParkPoint);
            database.AddInParameter(commandWrapper, "@Buff", DbType.Int32, entity.Buff);


            int results = 0;

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


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

            obj.Idx           = (System.Int32)reader["Idx"];
            obj.PlayerPoint   = (System.String)reader["PlayerPoint"];
            obj.BallParkPoint = (System.String)reader["BallParkPoint"];
            obj.Buff          = (System.Int32)reader["Buff"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>DicFormationpointEntity</returns>
        /// <remarks>2016/5/18 18:32:27</remarks>
        public DicFormationpointEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            DicFormationpointEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Exemplo n.º 4
0
        public static bool Update(DicFormationpointEntity dicFormationpointEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new DicFormationpointProvider(zoneId);

            return(provider.Update(dicFormationpointEntity, trans));
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/5/18 18:32:27</remarks>
 public bool Update(DicFormationpointEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/5/18 18:32:27</remarks>
 public bool Insert(DicFormationpointEntity entity)
 {
     return(Insert(entity, null));
 }