예제 #1
0
        private string GetSlug(PublishGroup publishGroup)
        {
            if (publishGroup.Slug.IsNotNullOrWhiteSpace())
            {
                return(publishGroup.Slug);
            }

            var slug = publishGroup.Title.RemoveAllNonAlphaNumericCharacters().ToLower();

            RockContext         rockContext         = new RockContext();
            PublishGroupService publishGroupService = new PublishGroupService(rockContext);
            var takenSlug = publishGroupService.Queryable()
                            .Where(pg => pg.Slug == slug && pg.GroupId != publishGroup.Group.Id).FirstOrDefault();

            var i = 0;

            while (takenSlug != null)
            {
                i++;
                var testSlug = slug + i.ToString();
                takenSlug = publishGroupService.Queryable().Where(pg => pg.Slug == testSlug).FirstOrDefault();
            }

            if (i != 0)
            {
                slug += i.ToString();
            }

            return(slug);
        }
예제 #2
0
        private void BindGrid()
        {
            RockContext         rockContext         = new RockContext();
            PublishGroupService publishGroupService = new PublishGroupService(rockContext);

            var qry = publishGroupService.Queryable();

            if (pContactPerson.SelectedValue.HasValue)
            {
                var contactPersonId = pContactPerson.SelectedValue.Value;
                qry = qry.Where(p => p.ContactPersonAlias.PersonId == contactPersonId);
            }

            if (cblStatus.SelectedValues.Count != 0)
            {
                var selectedItems = cblStatus.SelectedValues.Select(i => ( PublishGroupStatus )i.AsInteger());
                qry = qry.Where(p => selectedItems.Contains(p.PublishGroupStatus));
            }

            gGroups.DataSource = qry
                                 .OrderBy(p => p.PublishGroupStatus)
                                 .ThenByDescending(p => p.StartDateTime)
                                 .ToList();
            gGroups.DataBind();
        }
예제 #3
0
        /// <summary>Gets the publish group.</summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="publishGroupService">The publish group service.</param>
        /// <returns></returns>
        private PublishGroup GetPublishGroup(RockContext rockContext = null, PublishGroupService publishGroupService = null)
        {
            rockContext         = rockContext ?? new RockContext();
            publishGroupService = publishGroupService ?? new PublishGroupService(rockContext);
            if (PageParameter(PageParameterKeys.PublishGroupId).IsNotNullOrWhiteSpace())
            {
                var publishGroup = publishGroupService.Get(PageParameter(PageParameterKeys.PublishGroupId).AsInteger());
                if (publishGroup != null)
                {
                    return(publishGroup);
                }
            }

            if (PageParameter(PageParameterKeys.GroupId).IsNotNullOrWhiteSpace())
            {
                int          groupId      = PageParameter(PageParameterKeys.GroupId).AsInteger();
                GroupService groupService = new GroupService(rockContext);
                var          group        = groupService.Get(groupId);
                if (group != null)
                {
                    var publishGroup = publishGroupService.Queryable()
                                       .Where(pg => pg.GroupId == groupId)
                                       .ToList()
                                       .LastOrDefault();

                    if (publishGroup != null)
                    {
                        return(publishGroup);
                    }

                    publishGroup = new PublishGroup
                    {
                        PublishGroupStatus      = PublishGroupStatus.PendingApproval,
                        RegistrationRequirement = RegistrationRequirement.NoRegistration,
                        ChildcareOptions        = ChildcareOptions.NoChildcare,
                        Group                            = group,
                        RequestorAliasId                 = CurrentPersonAliasId.Value,
                        ConfirmationBody                 = GetAttributeValue(AttributeKeys.DefaultEmail),
                        RegistrationDescription          = GetAttributeValue(AttributeKeys.RegistrationDetails),
                        ChildcareRegistrationDescription = GetAttributeValue(AttributeKeys.ChildcareRegistrationDetails)
                    };

                    if (group.Schedule != null)
                    {
                        publishGroup.WeeklyDayOfWeek = group.Schedule.WeeklyDayOfWeek;
                        publishGroup.WeeklyTimeOfDay = group.Schedule.WeeklyTimeOfDay;
                    }

                    if (group.GroupLocations.Any())
                    {
                        publishGroup.MeetingLocation = group.GroupLocations.FirstOrDefault().Location.Name;
                    }

                    return(publishGroup);
                }
            }
            return(null);
        }
예제 #4
0
        private void BindGrid()
        {
            RockContext         rockContext         = new RockContext();
            PublishGroupService publishGroupService = new PublishGroupService(rockContext);

            gGroups.DataSource = publishGroupService.Queryable()
                                 .OrderBy(p => p.PublishGroupStatus)
                                 .ThenByDescending(p => p.StartDateTime)
                                 .ToList();
            gGroups.DataBind();
        }
        private PublishGroup GetPublishGroup(RockContext rockContext = null, PublishGroupService publishGroupService = null)
        {
            rockContext         = rockContext ?? new RockContext();
            publishGroupService = publishGroupService ?? new PublishGroupService(rockContext);
            if (PageParameter("PublishGroupId").IsNotNullOrWhiteSpace())
            {
                var publishGroup = publishGroupService.Get(PageParameter("PublishGroupId").AsInteger());
                if (publishGroup != null)
                {
                    return(publishGroup);
                }
            }

            if (PageParameter("GroupId").IsNotNullOrWhiteSpace())
            {
                int          groupId      = PageParameter("GroupId").AsInteger();
                GroupService groupService = new GroupService(rockContext);
                var          group        = groupService.Get(groupId);
                if (group != null)
                {
                    var publishGroup = publishGroupService.Queryable()
                                       .Where(pg => pg.GroupId == groupId)
                                       .ToList()
                                       .LastOrDefault();

                    if (publishGroup != null)
                    {
                        return(publishGroup);
                    }

                    publishGroup = new PublishGroup
                    {
                        PublishGroupStatus = PublishGroupStatus.Pending,
                        Group            = group,
                        RequestorAliasId = CurrentPersonAliasId.Value
                    };

                    if (group.Schedule != null)
                    {
                        publishGroup.WeeklyDayOfWeek = group.Schedule.WeeklyDayOfWeek;
                        publishGroup.WeeklyTimeOfDay = group.Schedule.WeeklyTimeOfDay;
                    }

                    if (group.GroupLocations.Any())
                    {
                        publishGroup.MeetingLocation = group.GroupLocations.FirstOrDefault().Location.Name;
                    }

                    return(publishGroup);
                }
            }
            return(null);
        }
예제 #6
0
        protected void tbSlug_TextChanged(object sender, EventArgs e)
        {
            var publishGroup = GetPublishGroup();
            var slug         = tbSlug.Text.ToLower().RemoveAllNonAlphaNumericCharacters();

            tbSlug.Text = slug;
            PublishGroupService publishGroupService = new PublishGroupService(new RockContext());
            var isDuplicateSlug = publishGroupService.Queryable()
                                  .Where(pg => pg.Slug == slug && pg.Id != publishGroup.Id && pg.GroupId != publishGroup.Group.Id)
                                  .Any();

            if (isDuplicateSlug)
            {
                lSlug.Visible  = false;
                nbSlug.Visible = true;
            }
            else
            {
                nbSlug.Visible = false;
                lSlug.Visible  = true;
                lSlug.Text     = GetAttributeValue(AttributeKeys.GroupRegistrationUrl) + slug;
            }
        }
예제 #7
0
        protected void BindData()
        {
            List <int> campusIds  = cblCampus.Items.OfType <ListItem>().Where(l => l.Selected).Select(a => a.Value.AsInteger()).ToList();
            List <int> categories = cblCategory.Items.OfType <ListItem>().Where(l => l.Selected).Select(a => a.Value.AsInteger()).ToList();

            // Initialize services
            var rockContext           = new RockContext();
            var publishGroupService   = new PublishGroupService(rockContext);
            var attributeService      = new AttributeService(rockContext);
            var attributeValueService = new AttributeValueService(rockContext);

            //Get the entity types
            var publishGroupEntityTypeId = EntityTypeCache.Get(typeof(PublishGroup)).Id;
            var groupEntityTypeId        = EntityTypeCache.Get(typeof(Group)).Id;

            //Attribute Queryables
            var publishGroupAttributeQry = attributeService.Queryable()
                                           .Where(a => a.EntityTypeId == publishGroupEntityTypeId)
                                           .Select(a => a.Id);

            var groupAttributeQry = attributeService.Queryable()
                                    .Where(a => a.EntityTypeId == groupEntityTypeId)
                                    .Select(a => a.Id);

            //Attribute Value Queryables
            var publishGroupAttributeValueQry = attributeValueService.Queryable()
                                                .Where(av => publishGroupAttributeQry.Contains(av.AttributeId));

            var groupAttributeValueQry = attributeValueService.Queryable()
                                         .Where(av => groupAttributeQry.Contains(av.AttributeId));


            var qry = publishGroupService
                      .Queryable("Group")
                      .Where(pg => !pg.IsHidden)                                                                             //Is not hidden from list
                      .Where(pg => pg.PublishGroupStatus == PublishGroupStatus.Approved)                                     //Approved
                      .Where(pg => pg.StartDateTime <= Rock.RockDateTime.Today && pg.EndDateTime >= Rock.RockDateTime.Today) //Active
                      .Where(pg => pg.Group.GroupType.GroupCapacityRule == GroupCapacityRule.None ||
                             pg.Group.GroupCapacity == null || pg.Group.GroupCapacity == 0 ||
                             pg.Group.Members.Count() < pg.Group.GroupCapacity);      // Not full


            // Filter by campus
            if (campusIds.Any())
            {
                qry = qry
                      .Where(pg =>
                             !pg.Group.CampusId.HasValue || // All
                             campusIds.Contains(pg.Group.CampusId.Value));
            }

            // Filter by Category
            if (categories.Any())
            {
                qry = qry
                      .Where(pg => pg.AudienceValues
                             .Any(dv => categories.Contains(dv.Id)));
            }

            //Group join in attributes
            var mixedQry = qry
                           .GroupJoin(publishGroupAttributeValueQry,
                                      pg => pg.Id,
                                      av => av.EntityId,
                                      (pg, av) => new { pg, av })
                           .GroupJoin(groupAttributeValueQry,
                                      pg => pg.pg.GroupId,
                                      av => av.EntityId,
                                      (pg, av) => new { PublishGroup = pg.pg, PublishGroupAttributes = pg.av, GroupAttributes = av });

            //Add in the attributes in the proper format
            var publishGroups = new List <PublishGroup>();

            foreach (var item in mixedQry.ToList())
            {
                var publishGroup = item.PublishGroup;
                publishGroup.AttributeValues = item.PublishGroupAttributes.ToDictionary(av => av.AttributeKey, av => new AttributeValueCache(av));
                publishGroup.Attributes      = item.PublishGroupAttributes.ToDictionary(av => av.AttributeKey, av => AttributeCache.Get(av.AttributeId));
                if (publishGroup.Group == null)
                {
                    continue;
                }
                publishGroup.Group.AttributeValues = item.GroupAttributes.ToDictionary(av => av.AttributeKey, av => new AttributeValueCache(av));
                publishGroup.Group.Attributes      = item.GroupAttributes.ToDictionary(av => av.AttributeKey, av => AttributeCache.Get(av.AttributeId));
                publishGroups.Add(publishGroup);
            }

            // Output mergefields.
            var mergeFields = LavaHelper.GetCommonMergeFields(this.RockPage, this.CurrentPerson);

            mergeFields.Add("PublishGroups", publishGroups);

            lOutput.Text = GetAttributeValue("LavaTemplate").ResolveMergeFields(mergeFields);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            RockContext         rockContext         = new RockContext();
            PublishGroupService publishGroupService = new PublishGroupService(rockContext);

            publishGroup = GetPublishGroup(rockContext, publishGroupService);

            if (publishGroup.PublishGroupStatus == PublishGroupStatus.Approved)
            {
                var tempGroup = publishGroup.Group;
                publishGroup       = ( PublishGroup )publishGroup.Clone();
                publishGroup.Guid  = Guid.NewGuid();
                publishGroup.Id    = 0;
                publishGroup.Group = tempGroup;
                publishGroupService.Add(publishGroup);
            }

            publishGroup.ImageId                   = iGroupImage.BinaryFileId;
            publishGroup.PublishGroupStatus        = PublishGroupStatus.Pending;
            publishGroup.Description               = tbDescription.Text;
            publishGroup.EndDateTime               = drPublishDates.UpperValue.Value;
            publishGroup.StartDateTime             = drPublishDates.LowerValue.Value;
            publishGroup.WeeklyDayOfWeek           = ddlDayOfWeek.SelectedValueAsEnumOrNull <DayOfWeek>();
            publishGroup.WeeklyTimeOfDay           = tTimeOfDay.SelectedTime;
            publishGroup.StartDate                 = dpStartDate.SelectedDate;
            publishGroup.MeetingLocation           = tbLocationName.Text;
            publishGroup.RequiresRegistration      = cbRequiresRegistration.Checked;
            publishGroup.RegistrationLink          = cbRequiresRegistration.Checked ? tbRegistrationLink.Text : "";
            publishGroup.AllowSpouseRegistration   = cbAllowSpouseRegistration.Checked;
            publishGroup.ChildcareAvailable        = cbChildcareAvailable.Checked;
            publishGroup.ChildcareRegistrationLink = cbChildcareAvailable.Checked ? tbChildcareRegistrationLink.Text : "";
            publishGroup.AudienceValues            = GetSelectedAudiences(rockContext);
            publishGroup.ContactPersonAliasId      = pContactPerson.PersonAliasId.Value;
            publishGroup.RequestorAliasId          = CurrentPersonAliasId.Value;
            publishGroup.ContactEmail              = tbContactEmail.Text;
            publishGroup.ContactPhoneNumber        = tbContactPhoneNumber.Text;
            publishGroup.ConfirmationFromName      = tbConfirmationFromName.Text;
            publishGroup.ConfirmationEmail         = tbConfirmationFromEmail.Text;
            publishGroup.ConfirmationSubject       = tbConfirmationSubject.Text;
            publishGroup.ConfirmationBody          = ceConfirmationBody.Text;

            if (publishGroup.Id == 0)
            {
                publishGroupService.Add(publishGroup);
            }

            if (IsUserAuthorized(Rock.Security.Authorization.EDIT))
            {
                publishGroup.PublishGroupStatus = PublishGroupStatus.Approved;
                publishGroup.Group.IsActive     = true;
                publishGroup.Group.IsPublic     = true;
                //remove all other publish groups for this computer
                publishGroupService.DeleteRange(publishGroupService.Queryable().Where(pg => pg.GroupId == publishGroup.GroupId && pg.Id != publishGroup.Id));
            }
            ;

            //Set the binary file to not be temporary
            if (publishGroup.ImageId.HasValue)
            {
                BinaryFileService binaryFileService = new BinaryFileService(rockContext);
                var binaryFile = binaryFileService.Get(publishGroup.ImageId.Value);
                if (binaryFile != null)
                {
                    binaryFile.IsTemporary = false;
                }
            }

            rockContext.SaveChanges();

            publishGroup.LoadAttributes(rockContext);

            if (publishGroup.Attributes.Any())
            {
                Rock.Attribute.Helper.GetEditValues(phAttributeEdits, publishGroup);
                publishGroup.SaveAttributeValues(rockContext);
            }

            if (IsUserAuthorized(Rock.Security.Authorization.EDIT))
            {
                publishGroup.LaunchWorkflow(GetAttributeValue("CompleteWorkflow").AsGuidOrNull());
            }
            else
            {
                publishGroup.LaunchWorkflow(GetAttributeValue("RequestWorkflow").AsGuidOrNull());
            }
            NavigateToParentPage();
        }
        /// <summary>
        /// Checks the settings.  If false is returned, it's expected that the caller will make
        /// the nbNotice visible to inform the user of the "settings" error.
        /// </summary>
        /// <returns>true if settings are valid; false otherwise</returns>
        private bool CheckSettings()
        {
            _rockContext = _rockContext ?? new RockContext();


            _autoFill = GetAttributeValue("AutoFillForm").AsBoolean();

            string registerButtonText = GetAttributeValue("RegisterButtonAltText");

            if (string.IsNullOrWhiteSpace(registerButtonText))
            {
                registerButtonText = "Register";
            }
            btnRegister.Text = registerButtonText;

            var publishGroupService = new PublishGroupService(_rockContext);

            if (_publishGroup == null)
            {
                var publishGroupGuid = PageParameter("PublishGroup").AsGuidOrNull();
                if (publishGroupGuid.HasValue)
                {
                    _publishGroup = publishGroupService.Get(publishGroupGuid.Value);
                }
                else
                {
                    var slug = PageParameter("PublishGroup").ToLower();
                    _publishGroup = publishGroupService.Queryable().Where(pg => pg.Slug == slug).FirstOrDefault();
                }
            }

            if (_publishGroup == null || _publishGroup.PublishGroupStatus != PublishGroupStatus.Approved)
            {
                nbNotice.Heading = "Unknown Group";
                nbNotice.Text    = "<p>This page requires a valid group identifying parameter and there was not one provided.</p>";
                nbNotice.Visible = true;
                return(false);
            }

            if (_publishGroup.RegistrationLink.IsNotNullOrWhiteSpace())
            {
                Response.Redirect(_publishGroup.RegistrationLink, false);
                Context.ApplicationInstance.CompleteRequest();
                return(false);
            }

            _showSpouse       = _publishGroup.AllowSpouseRegistration;
            _defaultGroupRole = _publishGroup.Group.GroupType.DefaultGroupRole;


            _dvcConnectionStatus = DefinedValueCache.Get(GetAttributeValue("ConnectionStatus").AsGuid());
            if (_dvcConnectionStatus == null)
            {
                nbNotice.Heading = "Invalid Connection Status";
                nbNotice.Text    = "<p>The selected Connection Status setting does not exist.</p>";
                return(false);
            }

            _dvcRecordStatus = DefinedValueCache.Get(GetAttributeValue("RecordStatus").AsGuid());
            if (_dvcRecordStatus == null)
            {
                nbNotice.Heading = "Invalid Record Status";
                nbNotice.Text    = "<p>The selected Record Status setting does not exist.</p>";
                return(false);
            }

            _married         = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.PERSON_MARITAL_STATUS_MARRIED.AsGuid());
            _homeAddressType = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME.AsGuid());
            _familyType      = GroupTypeCache.Get(Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid());
            _adultRole       = _familyType.Roles.FirstOrDefault(r => r.Guid.Equals(Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT.AsGuid()));

            if (_married == null || _homeAddressType == null || _familyType == null || _adultRole == null)
            {
                nbNotice.Heading = "Missing System Value";
                nbNotice.Text    = "<p>There is a missing or invalid system value. Check the settings for Marital Status of 'Married', Location Type of 'Home', Group Type of 'Family', and Family Group Role of 'Adult'.</p>";
                return(false);
            }

            return(true);
        }
예제 #10
0
        /// <summary>Saves the specified publish group status.</summary>
        /// <param name="publishGroupStatus">The publish group status.</param>
        private void Save(PublishGroupStatus publishGroupStatus)
        {
            RockContext         rockContext         = new RockContext();
            PublishGroupService publishGroupService = new PublishGroupService(rockContext);
            PublishGroup        publishGroup        = GetPublishGroup(rockContext, publishGroupService);

            var slug = tbSlug.Text.ToLower().RemoveAllNonAlphaNumericCharacters();

            tbSlug.Text = slug;

            //Test for already taken Slugs
            var isDuplicateSlug = publishGroupService.Queryable()
                                  .Where(pg => pg.Slug == slug && pg.Id != publishGroup.Id && pg.GroupId != publishGroup.Group.Id)
                                  .Any();

            if (isDuplicateSlug)
            {
                nbSlug.Visible = true;
                return;
            }
            else
            {
                nbSlug.Visible    = false;
                publishGroup.Slug = slug;
            }


            bool isApprover = false;

            if (IsUserAuthorized(Rock.Security.Authorization.EDIT))
            {
                isApprover = true;
            }

            if (isApprover)
            {
                publishGroupStatus = ddlStatus.SelectedValueAsEnum <PublishGroupStatus>();
            }
            else if (publishGroupStatus != PublishGroupStatus.Draft)
            {
                if (ddlRegistration.SelectedValue == "4" ||
                    (ddlChildcareOptions.SelectedValue == "2" && ddlChildcareNeedRegistration.SelectedValue == "2"))     //Childcare required && Registration needed.
                {
                    publishGroupStatus = PublishGroupStatus.PendingIT;
                }
            }

            if (publishGroup.PublishGroupStatus == PublishGroupStatus.Approved)
            {
                var tempGroup = publishGroup.Group;
                publishGroup       = ( PublishGroup )publishGroup.Clone();
                publishGroup.Guid  = Guid.NewGuid();
                publishGroup.Id    = 0;
                publishGroup.Group = tempGroup;
                publishGroupService.Add(publishGroup);
            }

            publishGroup.Name                             = tbName.Text;
            publishGroup.ImageId                          = iGroupImage.BinaryFileId;
            publishGroup.PublishGroupStatus               = publishGroupStatus;
            publishGroup.Description                      = tbDescription.Text;
            publishGroup.EndDateTime                      = drPublishDates.UpperValue.Value;
            publishGroup.StartDateTime                    = drPublishDates.LowerValue.Value;
            publishGroup.WeeklyDayOfWeek                  = ddlDayOfWeek.SelectedValueAsEnumOrNull <DayOfWeek>();
            publishGroup.WeeklyTimeOfDay                  = tTimeOfDay.SelectedTime;
            publishGroup.CustomSchedule                   = tbCustomSchedule.Text;
            publishGroup.StartDate                        = dpStartDate.SelectedDate;
            publishGroup.MeetingLocation                  = tbLocationName.Text;
            publishGroup.IsHidden                         = cbIsHidden.Checked;
            publishGroup.RegistrationRequirement          = ( RegistrationRequirement )ddlRegistration.SelectedValue.AsInteger();
            publishGroup.RequiresRegistration             = ddlRegistration.SelectedValue.AsInteger() > 0; //This is obsolete but left in for backward compatability
            publishGroup.RegistrationLink                 = publishGroup.RegistrationRequirement == RegistrationRequirement.CustomRegistration ? tbRegistrationLink.Text : "";
            publishGroup.RegistrationDescription          = tbRegistrationDetails.Text;
            publishGroup.ChildcareRegistrationDescription = ddlChildcareNeedRegistration.SelectedValue == "2" ? tbChildcareRegistrationDetails.Text : "";
            publishGroup.AllowSpouseRegistration          = cbAllowSpouseRegistration.Checked;
            publishGroup.ChildcareOptions                 = ( ChildcareOptions )ddlChildcareOptions.SelectedValue.AsInteger();
            publishGroup.ChildcareAvailable               = ddlChildcareOptions.SelectedValue.AsInteger() > 0;
            publishGroup.ChildcareRegistrationLink        = publishGroup.ChildcareAvailable ? tbChildcareRegistrationLink.Text : "";
            publishGroup.AudienceValues                   = GetSelectedAudiences(rockContext);
            publishGroup.ContactPersonAliasId             = pContactPerson.PersonAliasId.Value;
            publishGroup.RequestorAliasId                 = CurrentPersonAliasId.Value;
            publishGroup.ContactEmail                     = tbContactEmail.Text;
            publishGroup.ContactPhoneNumber               = tbContactPhoneNumber.Text;
            publishGroup.ConfirmationFromName             = tbConfirmationFromName.Text;
            publishGroup.ConfirmationEmail                = tbConfirmationFromEmail.Text;
            publishGroup.ConfirmationSubject              = tbConfirmationSubject.Text;
            publishGroup.ConfirmationBody                 = ceConfirmationBody.Text;

            if (publishGroup.Id == 0)
            {
                publishGroupService.Add(publishGroup);
            }

            if (isApprover && publishGroupStatus == PublishGroupStatus.Approved)
            {
                publishGroup.Group.IsActive = true;
                publishGroup.Group.IsPublic = true;
                //remove all other publish groups for this computer
                publishGroupService.DeleteRange(publishGroupService.Queryable().Where(pg => pg.GroupId == publishGroup.GroupId && pg.Id != publishGroup.Id));
            }
            ;

            //Set the binary file to not be temporary
            if (publishGroup.ImageId.HasValue)
            {
                BinaryFileService binaryFileService = new BinaryFileService(rockContext);
                var binaryFile = binaryFileService.Get(publishGroup.ImageId.Value);
                if (binaryFile != null)
                {
                    binaryFile.IsTemporary = false;
                }
            }

            rockContext.SaveChanges();

            publishGroup.LoadAttributes(rockContext);

            if (publishGroup.Attributes.Any())
            {
                Rock.Attribute.Helper.GetEditValues(phAttributeEdits, publishGroup);
                publishGroup.SaveAttributeValues(rockContext);
            }

            if (publishGroup.PublishGroupStatus != PublishGroupStatus.Draft)
            {
                publishGroup.LaunchWorkflow(GetAttributeValue(AttributeKeys.Workflow).AsGuidOrNull());
            }

            NavigateToParentPage(new Dictionary <string, string> {
                { "GroupId", publishGroup.GroupId.ToString() }
            });
        }