Exemplo n.º 1
0
 public Account(string userName, string password, string salt, int roleID, AccountProfile profile)
 {
     UserName = userName;
     Password = password;
     Salt     = salt;
     RoleID   = roleID;
     Profile  = profile;
 }
Exemplo n.º 2
0
 public Account(int accountID, string userName, string password, string salt, int roleID, Role role, int profileID, AccountProfile profile)
 {
     AccountID = accountID;
     UserName  = userName;
     Password  = password;
     Salt      = salt;
     RoleID    = roleID;
     Role      = role;
     ProfileID = profileID;
     Profile   = profile;
 }
Exemplo n.º 3
0
        private EF.Account ConvertToEF(D.Account account, D.AccountProfile profile)
        {
            int roleID = _context.Roles.FirstOrDefault(r => r.Name == account.Role.Name).RoleID;
            List <EF.Beneficiary> efBeneficiaries = new List <EF.Beneficiary>();

            foreach (var beneficiary in profile.Beneficiaries)
            {
                efBeneficiaries.Add(_context.Beneficiaries.FirstOrDefault(b => b.Name == beneficiary.Name));
            }
            EF.AccountProfile efProfile = new EF.AccountProfile(profile.Name, efBeneficiaries);
            return(new EF.Account(account.UserName, GetHash(account.Password, account.Salt), account.Salt, roleID, efProfile));
        }
Exemplo n.º 4
0
        private EF.Account ConvertToEFwithID(D.Account account, D.AccountProfile profile)
        {
            EF.Role role = _context.Roles.FirstOrDefault(r => r.Name == account.Role.Name);
            List <EF.Beneficiary> efBeneficiaries = new List <EF.Beneficiary>();

            foreach (var beneficiary in profile.Beneficiaries)
            {
                efBeneficiaries.Add(_context.Beneficiaries.FirstOrDefault(b => b.Name == beneficiary.Name));
            }
            EF.Account current   = _context.Accounts.FirstOrDefault(a => a.UserName == account.UserName);
            int        profileID = _context.Profiles.FirstOrDefault(a => a.Name == profile.Name).ProfileID;

            EF.AccountProfile efProfile = new EF.AccountProfile(profileID, profile.Name, efBeneficiaries, profile.IsLocal);
            return(new EF.Account(current.AccountID, account.UserName, current.Password, current.Salt, role.RoleID, role, efProfile.ProfileID, efProfile));
        }
Exemplo n.º 5
0
        private D.Account ConvertToDomain(EF.Account efAccount)
        {
            EF.Role              efRole        = _context.Roles.FirstOrDefault(r => r.RoleID == efAccount.RoleID);
            EF.AccountProfile    efProfile     = _context.Profiles.FirstOrDefault(r => r.ProfileID == efAccount.Profile.ProfileID);
            List <D.Beneficiary> beneficiaries = new List <D.Beneficiary>();

            foreach (var beneficiary in efProfile.Beneficiaries)
            {
                beneficiaries.Add(new D.Beneficiary(beneficiary.Name));
            }

            D.Role           role    = new D.Role(efRole.Name, efRole.Permissions);
            D.AccountProfile profile = new D.AccountProfile(efProfile.Name, beneficiaries);

            return(new D.Account(efAccount.UserName, efAccount.Password, efAccount.Salt, role, profile));
        }
Exemplo n.º 6
0
 private AccountProfile ConverToDomain(EF.AccountProfile efProfile)
 {
     return(new AccountProfile(efProfile.Name, ConvertBeneficiaryList(efProfile.Beneficiaries.ToList())));
 }