public override bool IsPersonInPersonTypeAdmin(Person person)
        {
            using (var transaction = new TransactionScope(_configuration))
            {
                var        ds = new PersonTypeDataStore(transaction);
                PersonType adminPersonType = ds.FindByName(BusiBlocksConstants.AdministratorsGroup);

                if (adminPersonType == null)
                {
                    return(false);
                }

                var pds = new PersonPersonTypeDataStore(transaction);
                IList <PersonPersonType> personTypes = pds.FindByPersonAndPersonType(person.Id, adminPersonType.Id);

                if (personTypes.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
 public override PersonType GetPersonTypeByName(string personTypeName)
 {
     using (var transaction = new TransactionScope(_configuration))
     {
         var ptDS = new PersonTypeDataStore(transaction);
         return(ptDS.FindByName(personTypeName));
     }
 }
        private IList <string> GetAdminIds()
        {
            // First get all the system admin ids.
            using (var transaction = new TransactionScope(_configuration))
            {
                var        ds2 = new PersonTypeDataStore(transaction);
                PersonType sysAdminPersonType = ds2.FindByName(BusiBlocksConstants.AdministratorsGroup);

                var ds1 = new PersonPersonTypeDataStore(transaction);
                IList <PersonPersonType> sysAdmins   = ds1.FindPersonByPersonType(sysAdminPersonType.Id);
                IList <string>           sysAdminIds = sysAdmins.Select(x => x.Person.Id).ToList <string>();
                return(sysAdminIds);
            }
        }
 public override bool PersonTypeExists(string personTypeName)
 {
     using (var transaction = new TransactionScope(_configuration))
     {
         var ptDS = new PersonTypeDataStore(transaction);
         if (ptDS.FindByName(personTypeName) != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }