Пример #1
0
      public IQueryable<EventOrderEntity> GetEventOrderByCondition(EventOrderSearchCondition condition)
      {
          var query = _eventorderRepository.Table;
          try
          {
              if (condition.AddtimeBegin.HasValue)
              {
                  query = query.Where(q => q.Addtime >= condition.AddtimeBegin.Value);
              }
              if (condition.AddtimeEnd.HasValue)
              {
                  query = query.Where(q => q.Addtime < condition.AddtimeEnd.Value);
              }
              if (!string.IsNullOrEmpty(condition.AcDetail))
              {
                  query = query.Where(q => q.AcDetail.Contains(condition.AcDetail));
              }
              if (condition.MoneyCount.HasValue)
              {
                  query = query.Where(q => q.MoneyCount == condition.MoneyCount.Value);
              }
              
              return query;
          }
          catch (Exception e)
          {
              _log.Error(e, "数据库操作出错");
              return null;
          }
 
      }
Пример #2
0
        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);
        }
Пример #3
0
 public int GetEventOrderCount(EventOrderSearchCondition condition)
 {
     var query = _eventorderRepository.Table;
     try
     {
         if (condition.AddtimeBegin.HasValue)
         {
             query = query.Where(q => q.Addtime >= condition.AddtimeBegin.Value);
         }
         if (condition.AddtimeEnd.HasValue)
         {
             query = query.Where(q => q.Addtime < condition.AddtimeEnd.Value);
         }
         if (!string.IsNullOrEmpty(condition.AcDetail))
         {
             query = query.Where(q => q.AcDetail.Contains(condition.AcDetail));
         }
         if (condition.MoneyCount.HasValue)
         {
             query = query.Where(q => q.MoneyCount == condition.MoneyCount.Value);
         }
         if (condition.Brokers.Id > 0)
         {
             query = query.Where(q => q.Broker.Id == condition.Brokers.Id);
         }
         return query.Count();
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return -1;
     }
 }