public static CPEnum.MsgTypeEnum ConvertMsgTypeEnum(int n) { CPEnum.MsgTypeEnum type = CPEnum.MsgTypeEnum.Task; foreach (int nIndex in Enum.GetValues(typeof(CPEnum.MsgTypeEnum))) { if (nIndex.Equals(n)) { type = (CPEnum.MsgTypeEnum)Enum.Parse(typeof(CPEnum.MsgTypeEnum), n.ToString()); break; } } return(type); }
public List <CPMsgEntity> GetMsg(int ReciveUserId, CPEnum.MsgTypeEnum msgType, int MsgCount) { //MsgCount 《=0,则获取所有的,否则获取指定 的条数 ISpecification <CPMsgEntity> specification; specification = new ExpressionSpecification <CPMsgEntity>(t => t.ReciveUserId.Equals(ReciveUserId) && t.MsgType.Equals((int)msgType)); List <CPMsgEntity> pCol = null; if (MsgCount <= 0) { pCol = this._CPMsgRep.GetByCondition(specification).ToList(); } else { pCol = this._CPMsgRep.GetByCondition(specification).Take(MsgCount).ToList(); } return(pCol); }