Exemple #1
0
        public void CheckUserMemberCard(int memberLevelId, long userId)
        {
            MemberCard userValidMemberCard = GetValidMemberCardOfUser(userId);

            if (userValidMemberCard != null && userValidMemberCard.Level.Id == memberLevelId)
            {
                throw new UserFriendlyException("you has been current member");
            }
        }
Exemple #2
0
        public MemberCard CreateMemberCard(MemberCardPackage memberCardPackage, long userId)
        {
            CheckUserMemberCard(memberCardPackage.MemberLevel.Id, userId);
            MemberCard memberCard = new MemberCard()
            {
                Level     = memberCardPackage.MemberLevel,
                No        = MemberCard.CreateNo(),
                UserId    = userId,
                Expiry    = memberCardPackage.Expiry,
                LimitTime = Clock.Now.AddDays(memberCardPackage.Expiry)
            };

            Repository.Insert(memberCard);
            return(memberCard);
        }