/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/6/16 12:47:10</remarks>
        public bool Update(LeagueFightmapEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_LeagueFightmap_Update");

            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId);
            database.AddInParameter(commandWrapper, "@LeaguRecordId", DbType.Guid, entity.LeaguRecordId);
            database.AddInParameter(commandWrapper, "@FightMapString", DbType.Binary, entity.FightMapString);
            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.ManagerId = (System.Guid)database.GetParameterValue(commandWrapper, "@ManagerId");

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

            obj.ManagerId      = (System.Guid)reader["ManagerId"];
            obj.LeaguRecordId  = (System.Guid)reader["LeaguRecordId"];
            obj.FightMapString = (System.Byte[])reader["FightMapString"];
            obj.UpdateTime     = (System.DateTime)reader["UpdateTime"];
            obj.RowTime        = (System.DateTime)reader["RowTime"];

            return(obj);
        }
Esempio n. 3
0
        public LeagueFightMapFrame(Guid managerId)
        {
            var fightMap = LeagueFightmapMgr.GetById(managerId);

            if (fightMap == null)
            {
                fightMap = new LeagueFightmapEntity(managerId, Guid.Empty, new byte[0], DateTime.Now, DateTime.Now);
                LeagueFightmapMgr.Insert(fightMap);
            }
            _leagueFightMapEntity = fightMap;
            AnalyseFightMap();
        }
Esempio n. 4
0
 /// <summary>
 /// 获取经理对阵记录
 /// </summary>
 /// <param name="managerId"></param>
 /// <returns></returns>
 public LeagueFightmapEntity GetLeagueManagerRecord(Guid managerId)
 {
     if (_leagueFightMapEntity == null)
     {
         var fightMap = LeagueFightmapMgr.GetById(managerId);
         if (fightMap == null)
         {
             var manager = ManagerCore.Instance.GetManager(managerId);
             if (manager != null)
             {
                 fightMap = new LeagueFightmapEntity(managerId, Guid.Empty, new byte[0], DateTime.Now,
                                                     DateTime.Now);
                 LeagueFightmapMgr.Insert(fightMap);
             }
         }
         _leagueFightMapEntity = fightMap;
     }
     return(_leagueFightMapEntity);
 }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="managerId">managerId</param>
        /// <returns>LeagueFightmapEntity</returns>
        /// <remarks>2016/6/16 12:47:10</remarks>
        public LeagueFightmapEntity GetById(System.Guid managerId)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            LeagueFightmapEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Esempio n. 6
0
        public static bool Update(LeagueFightmapEntity leagueFightmapEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new LeagueFightmapProvider(zoneId);

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