Ejemplo n.º 1
0
        /// <summary>
        /// 保存游戏的时间节点
        /// </summary>
        public void SaveMarkTime(string gameCode, long time, MarkType type, byte mark)
        {
            GameSetting game = GameAgent.Instance().GetGameSetting(gameCode);

            if (game == null)
            {
                return;
            }
            using (DbExecutor db = NewExecutor(IsolationLevel.ReadUncommitted))
            {
                if (db.Exists <GameMark>(t => t.GameID == game.ID && t.Type == type && t.Mark == mark))
                {
                    db.Update <GameMark, long>(t => t.Time, time,
                                               t => t.GameID == game.ID && t.Type == type && t.Mark == mark);
                }
                else
                {
                    db.Insert(new GameMark()
                    {
                        GameID = game.ID,
                        Type   = type,
                        Mark   = mark,
                        Time   = time
                    });
                }
                db.Commit();
            }
        }
Ejemplo n.º 2
0
        public void SaveMarkTime(OrderTaskModel task, long time, byte mark = 0)
        {
            int?gameId = GameAgent.Instance().GetGameSetting(task)?.ID;

            if (gameId == null)
            {
                return;
            }
            using (DbExecutor db = NewExecutor(IsolationLevel.ReadUncommitted))
            {
                if (db.Exists <GameMark>(t => t.GameID == gameId.Value && t.Mark == mark && t.Type == task.Type))
                {
                    db.Update <GameMark, long>(t => t.Time, time, t => t.GameID == gameId.Value && t.Mark == mark && t.Type == task.Type);
                }
                else
                {
                    new GameMark()
                    {
                        GameID = gameId.Value,
                        Mark   = mark,
                        Type   = task.Type,
                        Time   = time
                    }.Add(db);
                }
                db.Commit();
            }
        }
Ejemplo n.º 3
0
        public long GetMarkTime(OrderTaskModel task, byte mark = 0)
        {
            int?gameId = GameAgent.Instance().GetGameSetting(task)?.ID;

            if (gameId == null)
            {
                return(0);
            }
            return(this.ReadDB.ReadInfo <GameMark, long>(t => t.Time, t => t.GameID == gameId.Value && t.Mark == mark && t.Type == task.Type));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取游戏的时间节点
        /// </summary>
        public long GetMarkTime(string gameCode, MarkType markType, byte mark)
        {
            GameSetting game = GameAgent.Instance().GetGameSetting(gameCode);

            if (game == null)
            {
                return(0);
            }

            long Time = this.ReadDB.ReadInfo <GameMark, long>(t => t.Time,
                                                              t => t.GameID == game.ID && t.Mark == mark && t.Type == markType);

            return(Time);
        }