Esempio n. 1
0
        public ContentResult listevent(EventQueryRequest request)
        {
            request.MemberId = UserContext.WebUserContext.Id;
            var data = _eventService.EventList(request);
            var res  = new ResultDto <EventResponse>
            {
                page    = request.PageIndex,
                total   = request.Total,
                records = request.Records,
                rows    = data
            };

            return(Content(res.Serialize()));
        }
Esempio n. 2
0
        //赛事管理员赛事列表
        public List <EventResponse> EventList(EventQueryRequest request)
        {
            List <EventResponse> list = new List <EventResponse>();

            try
            {
                StringBuilder join = new StringBuilder();
                if (request.EventType != null && request.EventType > 0)
                {
                    join.Append(" and eventtype=@EventType");
                }

                if (request.KeyValue.IsNotEmpty())
                {
                    request.KeyValue = $"%{request.KeyValue}%";
                    join.Append(" and (code like @KeyValue or name like @KeyValue)");
                }
                var sql = $@"select * from t_event where isdelete=0 and memberId=@MemberId {join.ToString()} order by id desc ";

                int totalCount = 0;
                list = _dbContext.Page <EventResponse>(sql, out totalCount, request.PageIndex, request.PageSize, request);
                if (list != null && list.Count > 0)
                {
                    foreach (var item in list)
                    {
                        //计算报名人数或者队伍
                        if (item.EventStatus != EventStatusEm.审核中 && item.EventStatus != EventStatusEm.拒绝)
                        {
                            item.SignUpCount = _dbContext.ExecuteScalar($"select count(distinct(groupnum)) from t_event_player_signup where isdelete=0 and signUpStatus in ({ParamsConfig._signup_in}) and eventId={item.Id}").ToObjInt();
                        }
                    }
                }
                request.Records = totalCount;
            }
            catch (Exception ex)
            {
                LogUtils.LogError("EventService.EventList", ex);
            }
            return(list);
        }