public override void CreatePersonSite(string personId, string siteId, bool?isAdministrator, bool?isManager,
                                              bool?isAssigned, bool isDefault)
        {
            // Create a new record in the PersonSite table.
            using (var transaction = new TransactionScope(_configuration))
            {
                var psDS = new PersonSiteDataStore(transaction);
                var ps   = new PersonSite();
                var pDS  = new PersonDataStore(transaction);
                ps.Person = pDS.FindByKey(personId);
                var sDS = new SiteDataStore(transaction);
                ps.Site = sDS.FindByKey(siteId);
                if (isAdministrator != null)
                {
                    ps.IsAdministrator = (bool)isAdministrator;
                }
                if (isManager != null)
                {
                    ps.IsManager = (bool)isManager;
                }
                if (isAssigned != null)
                {
                    ps.IsAssigned = (bool)isAssigned;
                }
                ps.IsDefault = isDefault;
                psDS.Insert(ps);

                transaction.Commit();
            }
        }
Example #2
0
        public static void UpdatePersonSite(PersonSite personSite)
        {
            if (personSite == null)
            {
                throw new ArgumentNullException("personSite");
            }

            Provider.UpdatePersonSite(personSite);
        }
 public override void UpdatePersonSite(PersonSite personSite)
 {
     using (var transaction = new TransactionScope(_configuration))
     {
         var prDS = new PersonSiteDataStore(transaction);
         prDS.Update(personSite);
         transaction.Commit();
     }
 }
 public override Site GetDefaultSiteByPerson(Person person)
 {
     using (TransactionScope transaction = new TransactionScope(_configuration))
     {
         PersonSiteDataStore ppDS        = new PersonSiteDataStore(transaction);
         IList <PersonSite>  pps         = ppDS.FindSitesByPerson(person.Id, true);
         PersonSite          defaultSite = pps.FirstOrDefault(x => x.IsDefault);
         if (defaultSite != null)
         {
             return(defaultSite.Site);
         }
         else
         {
             return(null);
         }
     }
 }
Example #5
0
 public abstract void UpdatePersonSite(PersonSite personSite);