Пример #1
0
        public ContentResult listevent(PlayerOrRefereeEventQueryRequest request)
        {
            var data = _eventService.PlayerOrRefereeEvent(request);
            var res  = new ResultDto <PlayerOrRefereeEventResponse>
            {
                page    = request.PageIndex,
                total   = request.Total,
                records = request.Records,
                rows    = data
            };

            return(Content(res.Serialize()));
        }
Пример #2
0
        //选手 裁判查询赛事列表
        public List <PlayerOrRefereeEventResponse> PlayerOrRefereeEvent(PlayerOrRefereeEventQueryRequest request)
        {
            List <PlayerOrRefereeEventResponse> list = new List <PlayerOrRefereeEventResponse>();

            try
            {
                StringBuilder join = new StringBuilder();
                if (request.ProvinceId.HasValue && request.ProvinceId > 0)
                {
                    join.Append(" and a.provinceId=@ProvinceId ");
                }
                if (request.CityId.HasValue && request.CityId > 0)
                {
                    join.Append(" and a.cityId=@CityId ");
                }
                if (request.EventLevel.HasValue && request.EventLevel > 0)
                {
                    join.Append(" and a.eventLevel=@EventLevel ");
                }
                if (request.StartDate.HasValue)
                {
                    DateTime dt = Convert.ToDateTime(request.StartDate);
                    join.Append($" and a.starteventdate >='{Utility.FirstDayOfMonth(dt).ToShortDateString()}' and a.starteventdate<='{Utility.LastDayOfMonth(dt).ToShortDateString()}'");
                }
                var sql        = $@"select a.id EventId,a.code EventCode, a.name EventName,a.eventType EventType, a.eventLevel EventLevel,
                             a.signfee SignFee, a.eventStatus EventStatus,a.starteventdate StartEventDate, a.endsigndate EndSignDate,
                             b.name ProvinceName,c.name CityName
                             from t_event a 
                             left join t_sys_province b on a.provinceId=b.id
                             left join t_sys_city     c on a.cityId=c.id
                             where a.isdelete=0 and a.eventStatus in ({ParamsConfig._eventstatus}) {join.ToString()} order by a.createtime desc";
                int totalCount = 0;
                list = _dbContext.Page <PlayerOrRefereeEventResponse>(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.Visiable = 1;
                            continue;
                        }

                        if (item.EventStatus == EventStatusEm.停止报名)
                        {
                            item.Visiable = 2;
                            continue;
                        }
                        if (DateTime.Now > item.EndSignDate)
                        {
                            item.Visiable = 2;
                            continue;
                        }
                        item.Visiable = 3;
                    }
                }
                request.Records = totalCount;
            }
            catch (Exception ex)
            {
                LogUtils.LogError("EventService.PlayerOrRefereeEvent", ex);
            }
            return(list);
        }