Esempio n. 1
0
        public static Response Execute(string request)
        {
            var req = JsonConvert.DeserializeObject <Request <GetGameListFilter> >(request);
            var cmd = CommandHelper.CreateProcedure <Game>(text: "sp_GetGameTVList");

            cmd.Params.Add(CommandHelper.CreateParam("@clubId", req.Filter.ClubId));
            cmd.Params.Add(CommandHelper.CreateParam("@cityId", req.Filter.CityId));
            cmd.Params.Add(CommandHelper.CreateParam("@gameName", req.Filter.GameName));
            cmd.Params.Add(CommandHelper.CreateParam("@isOnlySelf", req.Filter.IsOnlySelf));
            cmd.Params.Add(CommandHelper.CreateParam("@state", req.Filter.State));
            cmd.CreateParamPager(req.Filter);
            cmd.CreateParamUser("001001");//写死超级管理员

            var result = DbContext.GetInstance().Execute(cmd);

            result.SetRowCount();
            if (result.Entities.IsNotNullOrEmpty())
            {
                foreach (Game obj in result.Entities)
                {
                    GameHelper.SetGameTeamList(obj);
                }
            }

            return(result);
        }
Esempio n. 2
0
        public Response Execute(User currentUser, string request)
        {
            var req = JsonConvert.DeserializeObject <Request <Game> >(request);
            var cmd = CommandHelper.CreateProcedure <Game>(text: "sp_GetGame");

            cmd.Params.Add(CommandHelper.CreateParam("@userId", currentUser.Id));
            cmd.Params.Add(CommandHelper.CreateParam("@gameId", req.Filter.Id));

            var result = DbContext.GetInstance().Execute(cmd);

            if (result.Entities.IsNotNullOrEmpty())
            {
                var game = result.FirstEntity <Game>();
                SetHeadAndFiles(game);
                GameHelper.SetGameTeamList(game);
                game.SocketIpAndPort = UserHelper.GetConfig().IntranetSocketIpAndPort;//返回局域网内的地址
                game.IsInLive        = LiveHelper.Instance.IsInLive(game.Id);
                game.IsAudit         = game.AuditId == null || !game.AuditId.Contains(currentUser.Id) ? false : true;
                game.IsManage        = game.ManageId == null || !game.ManageId.Contains(currentUser.Id) ? false : true;
                game.AuditName       = UserHelper.GetMultiUserName(game.AuditId); //返回名称
                game.ManageName      = UserHelper.GetMultiUserName(game.ManageId);
                game.WinGameArr      = new int[] { 2, 3, 4 };                     //小局胜局数
            }

            return(result);
        }
Esempio n. 3
0
        public Response Execute(string request)
        {
            var req = JsonConvert.DeserializeObject <Request <Game> >(request);
            var cmd = CommandHelper.CreateProcedure <Game>(text: "sp_GetGame");

            cmd.Params.Add(CommandHelper.CreateParam("@userId", "tourist"));
            cmd.Params.Add(CommandHelper.CreateParam("@gameId", req.Filter.Id));

            var result = DbContext.GetInstance().Execute(cmd);

            if (result.Entities.IsNotNullOrEmpty())
            {
                var game = result.FirstEntity <Game>();
                GetGame.SetHeadAndFiles(game);
                GameHelper.SetGameTeamList(game);
                game.SocketIpAndPort = UserHelper.GetConfig().IntranetSocketIpAndPort;//返回局域网内的地址
            }

            return(result);
        }