Ejemplo n.º 1
0
        public object getMemberExpenseDetail(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg       = string.Empty;
                string mobileToken  = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string icCardId     = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
                string flowType     = dicParas.ContainsKey("flowType") ? dicParas["flowType"].ToString() : string.Empty;
                string sDate        = dicParas.ContainsKey("sDate") ? dicParas["sDate"].ToString() : string.Empty;
                string eDate        = dicParas.ContainsKey("eDate") ? dicParas["eDate"].ToString() : string.Empty;
                string strPageIndex = dicParas.ContainsKey("pageIndex") ? dicParas["pageIndex"].ToString() : string.Empty;
                string strpageSize  = dicParas.ContainsKey("pageSize") ? dicParas["pageSize"].ToString() : string.Empty;

                int pageIndex = 1, pageSize = 10;

                if (!string.IsNullOrWhiteSpace(strPageIndex) && strPageIndex.IsInt())
                {
                    pageIndex = Convert.ToInt32(strPageIndex);
                }

                if (!string.IsNullOrWhiteSpace(strpageSize) && strpageSize.IsInt())
                {
                    pageSize = Convert.ToInt32(strpageSize);
                }

                if (mobileToken == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
                }
                Base_MerchInfo merch = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
                }

                t_member member = MemberBusiness.GetMerchModel(icCardId);
                if (member.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号错误"));
                }

                DataTable table = AccountBusiness.GetMemberExpenseDetail(merch.ID, icCardId, flowType, sDate, eDate, pageIndex, pageSize);

                if (table.Rows.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
                }

                var list = Utils.GetModelList <MemberExpenseDetailModel>(table).ToList();
                return(ResponseModelFactory <List <MemberExpenseDetailModel> > .CreateModel(isSignKeyReturn, list));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
        //新增临时裁判
        public bool InsertTempReferee(TempRefereeRequest request, int memberId, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request.ContactMobile.IsEmpty())
                {
                    msg = "联系号码不能为空";
                    return(flag);
                }

                if (request.Name.IsEmpty())
                {
                    msg = "姓名不能为空";
                    return(flag);
                }
                t_event t_event = _dbContext.Get <t_event>(request.EventId);
                if (t_event == null)
                {
                    msg = "赛事信息有误";
                    return(flag);
                }
                try
                {
                    _dbContext.BeginTransaction();
                    string   code   = _dataRepository.MemberRepo.RenderCode("nsda");
                    t_member member = new t_member
                    {
                        code            = code,
                        account         = request.Name,
                        pwd             = request.ContactMobile,
                        memberStatus    = MemberStatusEm.已认证,
                        memberType      = MemberTypeEm.临时裁判,
                        isExtendCoach   = false,
                        isExtendPlayer  = false,
                        isExtendReferee = false
                    };
                    int memberInsertId = _dbContext.Insert(member).ToObjInt();
                    _dbContext.Insert(new t_member_referee
                    {
                        pinyinsurname          = request.Name,
                        completename           = request.Name,
                        code                   = code,
                        completepinyin         = request.Name,
                        contactaddress         = request.Name,
                        contactmobile          = request.ContactMobile,
                        emergencycontact       = request.Name,
                        emergencycontactmobile = request.ContactMobile,
                        gender                 = GenderEm.未知,
                        memberId               = memberInsertId,
                        pinyinname             = request.Name
                    });
                    //积分表
                    _dbContext.Insert(new t_member_points
                    {
                        memberId      = memberInsertId,
                        playerPoints  = 0,
                        coachPoints   = 0,
                        refereePoints = 0
                    });
                    //临时会员表
                    _dbContext.Insert(new t_member_temp
                    {
                        code          = member.code,
                        contactmobile = request.ContactMobile,
                        name          = string.Empty,
                        eventId       = request.EventId,
                        memberId      = memberInsertId,
                        tempStatus    = TempStatusEm.待绑定,
                        tempType      = TempTypeEm.临时裁判
                    });
                    //报名表
                    _dbContext.Insert(new t_event_referee_signup
                    {
                        isTemp              = true,
                        eventId             = request.EventId,
                        memberId            = memberInsertId,
                        refereeSignUpStatus = RefereeSignUpStatusEm.已录取,
                        isFlag              = false
                    });
                    if (t_event.eventStatus == EventStatusEm.比赛中)
                    {
                        var eventdate = _dbContext.Select <t_event_matchdate>(c => c.eventId == t_event.id);
                        foreach (var itemdate in eventdate)
                        {
                            _dbContext.Insert(new t_event_sign
                            {
                                eventGroupId    = 0,
                                eventId         = request.EventId,
                                eventSignType   = EventSignTypeEm.裁判,
                                eventSignStatus = EventSignStatusEm.待签到,
                                signdate        = itemdate.eventMatchDate,
                                memberId        = memberInsertId,
                                isStop          = false
                            });
                        }
                    }

                    _dbContext.CommitChanges();
                    flag = true;
                }
                catch (Exception ex)
                {
                    flag = false;
                    msg  = "服务异常";
                    _dbContext.Rollback();
                    LogUtils.LogError("MemberTempService.InsertTempRefereeTran", ex);
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("MemberTempService.InsertTempReferee", ex);
            }
            return(flag);
        }
Ejemplo n.º 3
0
        //新增临时选手
        public bool InsertTempPlayer(List <TempPlayerRequest> request, int memberId, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request == null || request.Count == 0)
                {
                    msg = "请先录入数据";
                    return(flag);
                }
                TempPlayerRequest tempplayer = request.FirstOrDefault();
                t_event           t_event    = _dbContext.Get <t_event>(tempplayer.EventId);
                if (t_event == null)
                {
                    msg = "赛事信息有误";
                    return(flag);
                }
                if (t_event.eventStatus != EventStatusEm.比赛中)
                {
                    msg = "只有赛事当天才能添加临时选手";
                    return(flag);
                }
                t_event_group t_group = _dbContext.Get <t_event_group>(tempplayer.EventGroupId);
                if (t_group == null)
                {
                    msg = "赛事组别信息有误";
                    return(flag);
                }
                if (t_group.teamnumber != request.Count)
                {
                    msg = "队伍人数有误";
                    return(flag);
                }
                foreach (var item in request)
                {
                    if (item.Name.IsEmpty())
                    {
                        msg = "姓名不能为空";
                        break;
                    }
                    if (item.ContactMobile.IsEmpty())
                    {
                        msg = "联系方式不能为空";
                        break;
                    }
                    if (item.SchoolId <= 0)
                    {
                        msg = "教育经历不能为空";
                        break;
                    }
                }
                if (msg.IsNotEmpty())
                {
                    return(flag);
                }
                var eventdate = _dbContext.Select <t_event_matchdate>(c => c.eventId == tempplayer.EventId);
                try
                {
                    _dbContext.BeginTransaction();
                    string groupnum = _dataRepository.SignUpPlayerRepo.RenderCode(tempplayer.EventId);
                    foreach (var item in request)
                    {
                        //创建账号
                        string   code   = _dataRepository.MemberRepo.RenderCode("nsda");
                        t_member member = new t_member
                        {
                            code            = code,
                            account         = item.Name,
                            pwd             = item.ContactMobile,
                            memberStatus    = MemberStatusEm.待认证,
                            memberType      = MemberTypeEm.临时选手,
                            isExtendCoach   = false,
                            isExtendPlayer  = false,
                            isExtendReferee = false
                        };
                        int memberInsertId = _dbContext.Insert(member).ToObjInt();
                        _dbContext.Insert(new t_member_player
                        {
                            memberId               = memberInsertId,
                            code                   = code,
                            card                   = item.Name,
                            cardType               = CardTypeEm.身份证,
                            completename           = item.Name,
                            completepinyin         = item.Name,
                            name                   = item.Name,
                            contactaddress         = item.Name,
                            contactmobile          = item.ContactMobile,
                            emergencycontact       = item.Name,
                            emergencycontactmobile = item.ContactMobile,
                            gender                 = GenderEm.未知,
                            pinyinname             = item.Name,
                            pinyinsurname          = item.Name,
                            surname                = item.Name
                        });
                        _dbContext.Insert(new t_member_points
                        {
                            memberId      = memberInsertId,
                            playerPoints  = 0,
                            coachPoints   = 0,
                            refereePoints = 0
                        });
                        _dbContext.Insert(new t_member_temp
                        {
                            code          = groupnum,
                            contactmobile = item.ContactMobile,
                            name          = item.Name,
                            eventId       = item.EventId,
                            memberId      = memberInsertId,
                            tempStatus    = TempStatusEm.待绑定,
                            tempType      = TempTypeEm.临时选手
                        });
                        //报名表
                        _dbContext.Insert(new t_event_player_signup
                        {
                            groupnum     = groupnum,
                            eventId      = item.EventId,
                            eventGroupId = item.EventGroupId,
                            isTemp       = true,
                            memberId     = memberInsertId,
                            signfee      = t_event.signfee,
                            signUpStatus = SignUpStatusEm.报名成功,
                            signUpType   = SignUpTypeEm.临时添加
                        });
                        _dbContext.Insert(new t_player_edu
                        {
                            startdate = DateTime.Now.AddYears(-1).ToString("yyyy-MM"),
                            enddate   = "",
                            memberId  = memberInsertId,
                            schoolId  = item.SchoolId
                        });

                        //生成签到表
                        foreach (var itemdate in eventdate)
                        {
                            _dbContext.Insert(new t_event_sign
                            {
                                eventGroupId    = tempplayer.EventGroupId,
                                eventId         = tempplayer.EventId,
                                eventSignType   = EventSignTypeEm.手,
                                eventSignStatus = EventSignStatusEm.待签到,
                                signdate        = itemdate.eventMatchDate,
                                memberId        = memberInsertId,
                                isStop          = false
                            });
                        }
                    }
                    _dbContext.CommitChanges();
                    flag = true;
                }
                catch (Exception ex)
                {
                    flag = false;
                    msg  = "服务异常";
                    _dbContext.Rollback();
                    LogUtils.LogError("MemberTempService.InsertTempPlayerTran", ex);
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("MemberTempService.InsertTempPlayer", ex);
            }
            return(flag);
        }