/// <summary> /// 获取红包 /// </summary> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.UserRedEnvelopeDTO GetRedEnvelopeExt(Guid redEnvelopeId) { try { Jinher.AMP.BTP.Deploy.CustomDTO.UserRedEnvelopeDTO userRedEnvelopeDTO = new UserRedEnvelopeDTO(); var query = UserRedEnvelope.ObjectSet().Where(q => q.Id == redEnvelopeId).FirstOrDefault(); if (query != null) { userRedEnvelopeDTO.Id = query.Id; userRedEnvelopeDTO.AppId = query.AppId; userRedEnvelopeDTO.Content = query.Content; userRedEnvelopeDTO.Description = query.Description; userRedEnvelopeDTO.DueDate = query.DueDate; userRedEnvelopeDTO.GoldCount = query.GoldCount; userRedEnvelopeDTO.SubTime = query.SubTime; userRedEnvelopeDTO.ModifiedOn = query.ModifiedOn; userRedEnvelopeDTO.State = query.State; userRedEnvelopeDTO.UserId = query.UserId; userRedEnvelopeDTO.RedEnvelopeType = query.RedEnvelopeType; } return(userRedEnvelopeDTO); } catch (Exception ex) { LogHelper.Error(string.Format("获取我的红包UserRedEnvelopeSV-GetRedEnvelopeExt,参数redEnvelopeId:{0}", redEnvelopeId), ex); return(null); } }
/// <summary> /// 获取我的红包 /// </summary> /// <param name="userId"></param> /// <returns></returns> public List <Jinher.AMP.BTP.Deploy.CustomDTO.UserRedEnvelopeDTO> GetMyOrgRedEnvelopeExt(Guid userId, int type, int pageIndex, int pageSize) { pageSize = pageSize == 0 ? 10 : pageSize; List <Jinher.AMP.BTP.Deploy.CustomDTO.UserRedEnvelopeDTO> userRedEnvelopeDTOList = new List <UserRedEnvelopeDTO>(); try { List <Guid> orgIdList = Jinher.AMP.BTP.TPS.EBCSV.Instance.GetOrgIdsByUserIdAndCode(userId, "ReceiveRed"); var qaueryList = UserRedEnvelope.ObjectSet().Where(q => orgIdList.Contains(q.UserId) && q.RedEnvelopeType == type).OrderByDescending(q => q.SubTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); foreach (var item in qaueryList) { Jinher.AMP.BTP.Deploy.CustomDTO.UserRedEnvelopeDTO userRedEnvelopeDTO = new UserRedEnvelopeDTO(); userRedEnvelopeDTO.Id = item.Id; userRedEnvelopeDTO.AppId = item.AppId; userRedEnvelopeDTO.Content = item.Content; userRedEnvelopeDTO.Description = item.Description; userRedEnvelopeDTO.DueDate = item.DueDate; userRedEnvelopeDTO.GoldCount = item.GoldCount; userRedEnvelopeDTO.SubTime = item.SubTime; userRedEnvelopeDTO.ModifiedOn = item.ModifiedOn; userRedEnvelopeDTO.State = item.State; userRedEnvelopeDTO.UserId = item.UserId; userRedEnvelopeDTO.RedEnvelopeType = item.RedEnvelopeType; userRedEnvelopeDTOList.Add(userRedEnvelopeDTO); } return(userRedEnvelopeDTOList); } catch (Exception ex) { LogHelper.Error(string.Format("获取我的组织红包UserRedEnvelopeSV-GetMyRedEnvelopeExt,userId:{0},type:{1},pageIndex:{2},pageSize:{3},", userId, type, pageIndex, pageSize), ex); return(null); } }