示例#1
0
        public int RemoveAward(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(-1);
            }

            foreach (var userId in _awardsDao.GetAward(id).OwnerList)
            {
                objectBll.RemoveDependUserAndAwards(userId, id);
            }

            if (_awardsDao.RemoveAward(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
示例#2
0
        public int ChangeAward(Award award, IBll objectBll)
        {
            var oldAward = objectBll.Awards.GetAward(award.Id);

            foreach (var item in oldAward.OwnerList)
            {
                objectBll.RemoveDependUserAndAwards(item, award.Id);
            }

            ChangeAward(award);

            foreach (var item in award.OwnerList)
            {
                var user = objectBll.Users.GetUser(item);
                user.AwardList.Add(award.Id);
                objectBll.Users.ChangeUser(user);
                objectBll.AddDependUserAndAwards(item, award.Id);
            }

            return(1);
        }
示例#3
0
        public int RemoveUser(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(-1);
            }

            foreach (var awardId in _usersDao.GetUser(id).AwardList)
            {
                objectBll.RemoveDependUserAndAwards(id, awardId);
            }

            if (_usersDao.RemoveUser(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }