Exemple #1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/8/11 10:19:00</remarks>
        public bool Update(ArenaTeammemberEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ArenaTeammember_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId);
            database.AddInParameter(commandWrapper, "@ArenaType", DbType.Int32, entity.ArenaType);
            database.AddInParameter(commandWrapper, "@TeammemberString", DbType.Binary, entity.TeammemberString);
            database.AddInParameter(commandWrapper, "@SkillString", DbType.AnsiString, entity.SkillString);
            database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, 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));
        }
Exemple #2
0
        /// <summary>
        /// 将IDataReader的当前记录读取到ArenaTeammemberEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ArenaTeammemberEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ArenaTeammemberEntity();

            obj.Idx              = (System.Int32)reader["Idx"];
            obj.ManagerId        = (System.Guid)reader["ManagerId"];
            obj.ArenaType        = (System.Int32)reader["ArenaType"];
            obj.TeammemberString = (System.Byte[])reader["TeammemberString"];
            obj.SkillString      = (System.String)reader["SkillString"];
            obj.UpdateTime       = (System.DateTime)reader["UpdateTime"];
            obj.RowTime          = (System.DateTime)reader["RowTime"];

            return(obj);
        }
Exemple #3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ArenaTeammemberEntity</returns>
        /// <remarks>2016/8/11 10:19:00</remarks>
        public ArenaTeammemberEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ArenaTeammemberEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Exemple #4
0
        /// <summary>
        /// 创建对象
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="arenaType"></param>
        /// <param name="zoneName"></param>
        public ArenaTeammemberFrame(Guid managerId, EnumArenaType arenaType, string zoneName = "")
        {
            var teammpmberInfo = ArenaTeammemberMgr.GetByManagerId(managerId, (int)arenaType, zoneName);

            _zoneId = zoneName;
            if (teammpmberInfo == null)
            {
                teammpmberInfo                  = new ArenaTeammemberEntity();
                teammpmberInfo.ManagerId        = managerId;
                teammpmberInfo.ArenaType        = (int)arenaType;
                teammpmberInfo.SkillString      = ",,,,,,";
                teammpmberInfo.TeammemberString = new byte[0];
                teammpmberInfo.RowTime          = DateTime.Now;
                isInsert = true;
            }
            _arenaTeammemberEntity = teammpmberInfo;
            Analyse();
            ArenaType = arenaType;
            ManagerId = managerId;
            ZoneName  = zoneName;
        }
        public static bool Update(ArenaTeammemberEntity arenaTeammemberEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ArenaTeammemberProvider(zoneId);

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