/// <summary> /// Builds the common fields. /// </summary> /// <param name="member">The group.</param> /// <param name="parameters">The parameters.</param> /// <returns>A string containing the XAML that represents the common Group fields.</returns> private string BuildCommonFields(GroupMember member, Dictionary <string, string> parameters) { var sb = new StringBuilder(); sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Name", member.Person.FullName)); if (AllowRoleChange) { var items = GroupTypeCache.Get(member.Group.GroupTypeId) .Roles .Select(a => new KeyValuePair <string, string>(a.Id.ToString(), a.Name)); sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetDropDownFieldXaml("role", "Role", member.GroupRoleId.ToString(), true, items))); parameters.Add("role", "SelectedValue"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Role", member.GroupRole.Name)); } if (AllowMemberStatusChange) { var items = Enum.GetNames(typeof(GroupMemberStatus)) .Select(a => new KeyValuePair <string, string>(a, a)); sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetDropDownFieldXaml("memberstatus", "Member Status", member.GroupMemberStatus.ToString(), true, items))); parameters.Add("memberstatus", "SelectedValue"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Member Status", member.GroupMemberStatus.ToString())); } if (AllowNoteEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetTextEditFieldXaml("note", "Note", member.Note, false, true))); parameters.Add("note", "Text"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Note", member.Note)); } return(sb.ToString()); }
/// <summary> /// Builds the common fields. /// </summary> /// <param name="group">The group.</param> /// <param name="parameters">The parameters.</param> /// <returns>A string containing the XAML that represents the common Group fields.</returns> private string BuildCommonFields(Group group, Dictionary <string, string> parameters) { var sb = new StringBuilder(); if (ShowGroupName) { if (EnableGroupNameEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:TextBox x:Name=\"name\" Label=\"Name\" IsRequired=\"true\" Text=\"{group.Name.EncodeXml( true )}\" />")); parameters.Add("name", "Text"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Name", group.Name)); } } if (ShowDescription) { if (EnableDescriptionEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:TextBox x:Name=\"description\" Label=\"Description\" IsRequired=\"false\" Text=\"{group.Description.EncodeXml( true )}\" />")); parameters.Add("description", "Text"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Description", group.Name)); } } if (ShowCampus) { if (EnableCampusEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:CampusPicker x:Name=\"campus\" Label=\"Campus\" IsRequired=\"{group.GroupType.GroupsRequireCampus}\" SelectedValue=\"{group.Campus?.Guid.ToStringSafe()}\" />")); parameters.Add("campus", "SelectedValue"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Campus", group.Campus.Name)); } } if (ShowGroupCapacity && group.GroupType.GroupCapacityRule != GroupCapacityRule.None) { if (EnableGroupCapacityEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:NumberBox x:Name=\"capacity\" Label=\"Capacity\" IsRequired=\"false\" Text=\"{group.GroupCapacity}\" />")); parameters.Add("capacity", "Text"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Group Capacity", group.Name)); } } if (ShowActiveStatus) { if (EnableActiveStatusEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:CheckBox x:Name=\"active\" Label=\"Is Active\" IsRequired=\"false\" IsChecked=\"{group.IsActive}\" />", false)); parameters.Add("active", "IsChecked"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Is Active", group.IsActive ? "Yes" : "No")); } } if (ShowPublicStatus) { if (EnablePublicStatusEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml($"<Rock:CheckBox x:Name=\"public\" Label=\"Is Public\" IsRequired=\"false\" IsChecked=\"{group.IsPublic}\" />", false)); parameters.Add("public", "IsChecked"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Is Public", group.IsPublic ? "Yes" : "No")); } } return(sb.ToString()); }