示例#1
0
        public Member RegisterRoot(string userName, PersonalInformation personalInformation)
        {
            using (var transaction = new TransactionScope())
            {
                try
                {
                    Rank initialRank = this.uow.RankRepository.GetInitialRank();

                    var member = Member.CreateRoot(
                        Guid.NewGuid(),
                        userName,
                        personalInformation,
                        initialRank);

                    this.uow.MemberRepository.Add(member);
                    this.uow.Commit();

                    transaction.Complete();

                    return member;
                }
                catch (Exception ex)
                {
                    transaction.Dispose();
                    throw ex;
                }
            }
        }
示例#2
0
文件: Member.cs 项目: Daskul/BIG
        private Member(
            Guid memberId,
            string username, 
            PersonalInformation personalInfo,
            Rank rank)
            : base()
        {
            this.Id = memberId;
            this.Username = username;
            this.PersonalInformation = personalInfo;
            this.RegistrationDate = DateTime.Now;
            this.Rank = rank;

            // default as Root of Chain
            this.UplineId = null;
            this.Position = Position.Root;

            this.RaiseEvent(new MemberRegistered(
                this.Id,
                this.Username,
                this.RegistrationDate,
                this.UplineId,
                this.Position,
                this.PersonalInformation,
                this.Rank.Id));
        }
示例#3
0
        public ActionResult Register(RegisterMemberModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var personalInformation = new PersonalInformation(
                new EmiratesId(model.EmiratesId),
                new FullName(model.FirstName, model.LastName),
                model.Gender,
                new Email(model.Email),
                new Mobile(model.Mobile),
                new Address(model.City, model.Country, model.Line1, model.Line2),
                model.DateOfBirth);

            Member member = this.membershipService
                .RegisterDownLine(
                    model.Username,
                    model.Position,
                    new AccountNo(model.UplineAccountNo),
                    personalInformation);

            return RedirectToRoute("admin.members.member", new { username = member.Username });
        }
示例#4
0
文件: MemberModel.cs 项目: Daskul/BIG
 public MemberModel(
     Guid id,
     AccountNo accountNo,
     string username,
     DateTime registrationDate,
     Rank rank,
     PersonalInformation personalInformation)
 {
     this.Id = id;
     this.AccountNo = accountNo;
     this.Username = username;
     this.RegistrationDate = registrationDate;
     this.Rank = rank;
     this.PersonalInformation = personalInformation;
 }
示例#5
0
 public MemberRegistered(
     Guid memberId,
     string username,
     DateTime registrationDate,
     Guid? uplineId,
     Position position,
     PersonalInformation personalInformation,
     Guid rankId)
 {
     this.MemberId = memberId;
     this.UplineId = uplineId;
     this.Position = position;
     this.Username = username;
     this.RegistrationDate = registrationDate;
     this.PersonalInformation = personalInformation;
     this.RankId = rankId;
 }
示例#6
0
        public Member RegisterDownLine(
            string userName, 
            Position position, 
            AccountNo uplineAccountNo,
            PersonalInformation personalInformation)
        {
            using (var transaction = new TransactionScope())
            {
                try
                {
                    Member upline = this.uow.MemberRepository.FindByAccountNo(uplineAccountNo);
                    if (upline == null)
                    {
                        throw new ArgumentException(
                            String.Format(
                                "Can't create downline to a non-existing upline `{0}`",
                                uplineAccountNo.Number));
                    }

                    Rank initialRank = this.uow.RankRepository.GetInitialRank();

                    var member = Member.CreateDownLine(
                        Guid.NewGuid(),
                        userName,
                        personalInformation,
                        initialRank,
                        upline.Id,
                        position);

                    this.uow.MemberRepository.Add(member);
                    this.uow.Commit();

                    transaction.Complete();

                    return member;
                }
                catch (Exception ex)
                {
                    transaction.Dispose();
                    throw ex;
                }
            }
        }
示例#7
0
文件: Member.cs 项目: Daskul/BIG
 public static Member CreateRoot(
     Guid memberId, 
     string userName, 
     PersonalInformation personalInformation, 
     Rank rank)
 {
     return new Member(memberId, userName, personalInformation, rank);
 }
示例#8
0
文件: Member.cs 项目: Daskul/BIG
        public static Member CreateDownLine(
            Guid memberId, 
            string userName, 
            PersonalInformation personalInformation,
            Rank rank,
            Guid uplineId,
            Position position)
        {
            Member member = new Member(memberId, userName, personalInformation, rank);
            member.RegisterDownLineOf(uplineId, position);

            return member;
        }