public HttpResponseMessage GetBrokerByAgent(string id)
        {
            if (string.IsNullOrEmpty(id) || !PageHelper.ValidateNumber(id))
            {
                return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));
            }
            var brokerlist = _brokerService.GetBrokerById(Convert.ToInt32(id));
            var model = new BrokerModel
            {
                Headphoto = brokerlist.Headphoto,
                Nickname = brokerlist.Nickname,
                Brokername = brokerlist.Brokername,
                Realname = brokerlist.Realname,
                Sexy = brokerlist.Sexy,
                Totalpoints = brokerlist.Totalpoints,
                Amount = brokerlist.Amount,
                Phone = brokerlist.Phone,
                Qq = brokerlist.Qq,
                Email = brokerlist.Email,
                Sfz = brokerlist.Sfz,
                Regtime1 = brokerlist.Regtime.ToShortDateString(),
                Usertype1 = brokerlist.Usertype.ToString(),
                State = brokerlist.State,
                PartnersName = brokerlist.WeiXinNumber,
                Address = brokerlist.Address

            };
            return PageHelper.toJson(new { List = model });
        }
        public HttpResponseMessage GetBrokerByUserId(string userId)
        {
            int IsInvite = 1; //是否使用邀请码(0使用 1未使用)
            if (string.IsNullOrEmpty(userId) || !PageHelper.ValidateNumber(userId))
            {
                return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));
            }

            var model = _brokerService.GetBrokerByUserId(Convert.ToInt32(userId));
           
            if (model == null) return PageHelper.toJson(PageHelper.ReturnValue(false, "该用户不存在!"));

            #region 判断经纪人是否使用过邀请码 或者参与过活动
            InviteCodeSearchCondition icodeseCon = new InviteCodeSearchCondition
            {
                NumUser = model.Id
            };
            var a = _inviteCodeService.GetInviteCodeByCount(icodeseCon);
            EventOrderSearchCondition eveCon = new EventOrderSearchCondition
            {
                Brokers = model
                
            };
            var b = _eventOrderService.GetEventOrderCount(eveCon);
            if (a > 0 || b > 0 )
            {
                IsInvite = 0; //判断有无使用过邀请码 或者参与过活动 或该活动下架
            }

            #endregion

            var brokerInfo = new BrokerModel
            {
                Id = model.Id,
                Brokername = model.Brokername,
                Realname = model.Realname,
                Nickname = model.Nickname,
                Sexy = model.Sexy,
                Sfz = model.Sfz,
                Email = model.Email,
                Phone = model.Phone,
                Headphoto = model.Headphoto,
                WeiXinNumber = model.WeiXinNumber,
                IsInvite = IsInvite
            };
            return PageHelper.toJson(brokerInfo);
        }
 public HttpResponseMessage GetBroker(string id)
 {
     if (string.IsNullOrEmpty(id) || !PageHelper.ValidateNumber(id))
     {
         return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));
     }
     var brokerlist = _brokerService.GetBrokerById(Convert.ToInt32(id));
     var dd = new BrokerModel
     {
         Address = brokerlist.Address,
         Adduser = brokerlist.Adduser,
         Brokername = brokerlist.Brokername,
         Phone = brokerlist.Phone,
         Realname = brokerlist.Realname,
         Nickname = brokerlist.Nickname,
         Sexy = brokerlist.Sexy,
         Sfz = brokerlist.Sfz,
         Email = brokerlist.Email,
         Headphoto = brokerlist.Headphoto,
         rgtime = brokerlist.Regtime.ToShortDateString()
     };
     return PageHelper.toJson(new { List = dd });
 }