Пример #1
0
 public void PerformBeforeStoreUpdate()
 {
     if (ReferenceToInformation == null)
     {
         ReferenceToInformation = ReferenceToInformation.CreateDefault();
     }
     ReferenceToInformation.Title = this.Location.LocationName;
     ReferenceToInformation.URL   = DefaultViewSupport.GetDefaultViewURL(this);
     if (String.IsNullOrEmpty(Location.Latitude.TextValue))
     {
         Location.Latitude.TextValue = "0";
     }
     if (String.IsNullOrEmpty(Location.Longitude.TextValue))
     {
         Location.Longitude.TextValue = "0";
     }
 }
Пример #2
0
        public static void ExecuteMethod_UpdateAccountContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, GroupSummaryContainer groupSummaryContainer, TBRAccountRoot accountRoot, AccountContainer accountContainer)
        {
            string currRootId             = groupRoot.Group.ID;
            string currReferenceUrlPrefix = String.Format("/auth/grp/{0}/", currRootId);
            var    currRoles = accountContainer.AccountModule.Roles;

            currRoles.MemberInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));
            currRoles.ModeratorInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));


            foreach (var acctRole in accountRoot.Account.GroupRoleCollection.CollectionContent.Where(role => role.GroupID == currRootId))
            {
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              currRootId);
                reference.Title = currGroup.GroupName + " - " + acctRole.GroupRole;
                switch (acctRole.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    currRoles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    currRoles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            currRoles.ModeratorInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            currRoles.MemberInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            // TODO: Update account summary
            //accountContainer.AccountSummary.GroupSummary
        }
Пример #3
0
        public void StoreAccountToRoot()
        {
            TBRAccountRoot accountRoot = TBRAccountRoot.RetrieveFromDefaultLocation(this.ID);

            accountRoot.Account = this;
            StorageSupport.StoreInformation(accountRoot);
            return;

            AccountContainer accountContainer = AccountContainer.RetrieveFromOwnerContent(this, "default");

            if (accountContainer == null)
            {
                accountContainer = AccountContainer.CreateDefault();
                accountContainer.SetLocationAsOwnerContent(this, "default");
            }
            accountContainer.AccountModule.Security.LoginInfoCollection = this.Logins;
            foreach (var loginItem in this.Logins.CollectionContent)
            {
                string       loginRootID = TBLoginInfo.GetLoginIDFromLoginURL(loginItem.OpenIDUrl);
                TBRLoginRoot loginRoot   = TBRLoginRoot.RetrieveFromDefaultLocation(loginRootID);
                loginRoot.Account = this;
                StorageSupport.StoreInformation(loginRoot);
                // TODO: Remove invalid group role logins at this stage
                foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent.Where(grpRole => TBCollaboratorRole.IsRoleStatusValidMember(grpRole.RoleStatus)))
                {
                    string            loginGroupID   = TBRLoginGroupRoot.GetLoginGroupID(groupRoleItem.GroupID, loginRootID);
                    TBRLoginGroupRoot loginGroupRoot = TBRLoginGroupRoot.RetrieveFromDefaultLocation(loginGroupID);
                    if (loginGroupRoot == null)
                    {
                        loginGroupRoot    = TBRLoginGroupRoot.CreateDefault();
                        loginGroupRoot.ID = loginGroupID;
                        loginGroupRoot.UpdateRelativeLocationFromID();
                    }
                    loginGroupRoot.GroupID = groupRoleItem.GroupID;
                    loginGroupRoot.Role    = groupRoleItem.GroupRole;
                    StorageSupport.StoreInformation(loginGroupRoot);
                }
            }
            //accountContainer.AccountModule.Security.EmailCollection = this.Emails;
            foreach (var emailItem in this.Emails.CollectionContent)
            {
                string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(emailItem.EmailAddress);
                TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
                if (emailRoot == null)
                {
                    emailRoot    = TBREmailRoot.CreateDefault();
                    emailRoot.ID = emailRootID;
                    emailRoot.UpdateRelativeLocationFromID();
                }
                emailRoot.Account = this;
                StorageSupport.StoreInformation(emailRoot);
            }
            var roles = accountContainer.AccountModule.Roles;

            roles.MemberInGroups.CollectionContent.Clear();
            roles.ModeratorInGroups.CollectionContent.Clear();
            foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent)
            {
                var groupRoot = TBRGroupRoot.RetrieveFromDefaultLocation(groupRoleItem.GroupID);
                if (groupRoot == null)
                {
                    continue;
                }
                var grp = groupRoot.Group;
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              groupRoot.ID);
                reference.Title = grp.Title + " - " + groupRoleItem.GroupRole;
                switch (groupRoleItem.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    roles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    roles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            StorageSupport.StoreInformation(accountContainer);
        }