public ContentResult editprize(EventPrizeRequest request)
        {
            request.MemberId = UserContext.WebUserContext.Id;
            string msg  = string.Empty;
            var    flag = _eventPrizeService.Edit(request, out msg);

            return(Result <string>(flag, msg));
        }
Beispiel #2
0
        //编辑奖项
        public bool Edit(EventPrizeRequest request, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request.Name.IsEmpty())
                {
                    msg = "奖项名称不能为空";
                    return(flag);
                }
                if (request.Num.IsEmpty())
                {
                    msg = "获奖队伍/会员编号不能为空";
                    return(flag);
                }
                if (request.PrizeType == Model.enums.PrizeTypeEm.个人)
                {
                    //查询会员编号是否正确
                }
                else
                {
                    //查询队伍编码是否正确
                }
                var eventPrize = _dbContext.Get <t_event_prize>(request.Id);
                if (eventPrize != null)
                {
                    eventPrize.remark     = request.Remark;
                    eventPrize.name       = request.Name;
                    eventPrize.prizeType  = request.PrizeType;
                    eventPrize.num        = request.Num;
                    eventPrize.updatetime = DateTime.Now;
                    _dbContext.Update(eventPrize);
                    flag = true;
                }
                else
                {
                    msg = "未找到奖项信息";
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("EventPrizeService.Edit", ex);
            }
            return(flag);
        }
Beispiel #3
0
        //新增奖项
        public bool Insert(EventPrizeRequest request, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request.Name.IsEmpty())
                {
                    msg = "奖项名称不能为空";
                    return(flag);
                }
                if (request.Num.IsEmpty())
                {
                    msg = "获奖队伍/会员编号不能为空";
                    return(flag);
                }
                if (request.PrizeType == Model.enums.PrizeTypeEm.个人)
                {
                    //查询会员编号是否正确
                }
                else
                {
                    //查询队伍编码是否正确
                }
                _dbContext.Insert(new t_event_prize
                {
                    eventGroupId = request.EventGroupId,
                    eventId      = request.EventId,
                    name         = request.Name,
                    num          = request.Num,
                    prizeType    = request.PrizeType,
                    remark       = request.Remark
                });
                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("EventPrizeService.Insert", ex);
            }
            return(flag);
        }