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; } } }
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)); }
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 }); }
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; }
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; }
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; } } }
public static Member CreateRoot( Guid memberId, string userName, PersonalInformation personalInformation, Rank rank) { return new Member(memberId, userName, personalInformation, rank); }
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; }