Ejemplo n.º 1
0
        private static DataModels.Member.Member CreateMemberAccountForNonDerbyFolks(ref ManagementContext dc, Guid userId, string email)
        {
            // Creates the member record (also adds the user to the league specified if one was found)
            Member member = new DataModels.Member.Member();
            try
            {
                member.MemberId = Guid.NewGuid();
                member.AspNetUserId = userId;
                member.ContactCard = new DataModels.ContactCard.ContactCard();
                member.IsVerified = false;
                member.IsNotConnectedToDerby = true;

                if (!String.IsNullOrEmpty(email))
                {
                    member.ContactCard.Emails.Add(new RDN.Library.DataModels.ContactCard.Email { EmailAddress = email, IsDefault = true });

                }

                dc.Members.Add(member);
                int c = dc.SaveChanges();
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return member;
        }
Ejemplo n.º 2
0
        private static DataModels.Member.Member CreateMemberAccount(ref ManagementContext dc, ref DataModels.League.League league, Guid userId, string firstname, string derbyName, int gender, int positionType, string lastName, string playerNumber, string email, string phoneNumber)
        {
            // Creates the member record (also adds the user to the league specified if one was found)
            Member member = new DataModels.Member.Member();
            try
            {
                member.MemberId = Guid.NewGuid();
                member.AspNetUserId = userId;
                member.Firstname = firstname;
                member.Lastname = lastName;
                member.PlayerNumber = playerNumber;
                member.DerbyName = derbyName;
                member.Gender = gender;
                member.PositionType = positionType;
                member.ContactCard = new DataModels.ContactCard.ContactCard();
                member.IsVerified = false;

                if (league != null)
                {
                    LeagueMember lm = new LeagueMember();
                    lm.Member = member;
                    lm.League = league;
                    lm.MembershipDate = DateTime.UtcNow;
                    member.Leagues.Add(lm);
                    member.League = league;
                    member.CurrentLeagueId = league.LeagueId;
                }

                if (!String.IsNullOrEmpty(email))
                {
                    member.ContactCard.Emails.Add(new RDN.Library.DataModels.ContactCard.Email { EmailAddress = email, IsDefault = true });

                }
                if (!String.IsNullOrEmpty(phoneNumber))
                {
                    int phoneType = Convert.ToInt32(CommunicationTypeEnum.PhoneNumber);
                    member.ContactCard.Communications.Add(new Communication
                    {
                        Data = phoneNumber,
                        IsDefault = true,
                        //CommunicationType = dc.CommunicationType.Where(x => x.CommunicationTypeId == phoneType).FirstOrDefault()
                        CommunicationTypeEnum = (byte)CommunicationTypeEnum.PhoneNumber
                    });
                }

                member = dc.Members.Add(member);
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return member;
        }