/// <summary> /// Shows the edit details. /// </summary> /// <param name="marketingCampaign">The marketing campaign.</param> private void ShowEditDetails(MarketingCampaign marketingCampaign) { if (marketingCampaign.Id > 0) { lActionTitle.Text = ActionTitle.Edit(MarketingCampaign.FriendlyTypeName).FormatAsHtmlTitle(); } else { lActionTitle.Text = ActionTitle.Add(MarketingCampaign.FriendlyTypeName).FormatAsHtmlTitle(); } SetEditMode(true); tbTitle.Text = marketingCampaign.Title; tbContactEmail.Text = marketingCampaign.ContactEmail; tbContactFullName.Text = marketingCampaign.ContactFullName; tbContactPhoneNumber.Text = marketingCampaign.ContactPhoneNumber; LoadDropDowns(); ppContactPerson.SetValue(marketingCampaign.ContactPerson); ddlEventGroup.SetValue(marketingCampaign.EventGroupId); cpCampuses.SelectedCampusIds = marketingCampaign.MarketingCampaignCampuses.Select(a => a.CampusId).ToList(); MarketingCampaignAudiencesState = new ViewStateList <MarketingCampaignAudience>(); foreach (var item in marketingCampaign.MarketingCampaignAudiences.ToList()) { MarketingCampaignAudiencesState.Add(new MarketingCampaignAudience { Id = item.Id, IsPrimary = item.IsPrimary, AudienceTypeValueId = item.AudienceTypeValueId }); } BindMarketingCampaignAudiencesGrid(); }
/// <summary> /// Saves the state of the workflow activity controls to view. /// </summary> private void SaveWorkflowActivityControlsToViewState() { WorkflowActivityTypesState = new ViewStateList <WorkflowActivityType>(); int order = 0; foreach (var activityEditor in phActivities.Controls.OfType <WorkflowActivityTypeEditor>()) { WorkflowActivityType workflowActivityType = activityEditor.GetWorkflowActivityType(); workflowActivityType.Order = order++; WorkflowActivityTypesState.Add(workflowActivityType); } }
/// <summary> /// Shows the edit details. /// </summary> /// <param name="marketingCampaign">The marketing campaign.</param> private void ShowEditDetails( MarketingCampaign marketingCampaign ) { if ( marketingCampaign.Id > 0 ) { lActionTitle.Text = ActionTitle.Edit( MarketingCampaign.FriendlyTypeName ).FormatAsHtmlTitle(); } else { lActionTitle.Text = ActionTitle.Add( MarketingCampaign.FriendlyTypeName ).FormatAsHtmlTitle(); } SetEditMode( true ); tbTitle.Text = marketingCampaign.Title; tbContactEmail.Text = marketingCampaign.ContactEmail; tbContactFullName.Text = marketingCampaign.ContactFullName; tbContactPhoneNumber.Text = marketingCampaign.ContactPhoneNumber; LoadDropDowns(); ppContactPerson.SetValue( marketingCampaign.ContactPerson ); ddlEventGroup.SetValue( marketingCampaign.EventGroupId ); cpCampuses.SelectedCampusIds = marketingCampaign.MarketingCampaignCampuses.Select( a => a.CampusId ).ToList(); MarketingCampaignAudiencesState = new ViewStateList<MarketingCampaignAudience>(); foreach ( var item in marketingCampaign.MarketingCampaignAudiences.ToList() ) { MarketingCampaignAudiencesState.Add( new MarketingCampaignAudience { Id = item.Id, IsPrimary = item.IsPrimary, AudienceTypeValueId = item.AudienceTypeValueId } ); } BindMarketingCampaignAudiencesGrid(); }
/// <summary> /// Shows the edit details. /// </summary> /// <param name="group">The group.</param> private void ShowEditDetails( Group group ) { if ( group.Id == 0 ) { lReadOnlyTitle.Text = ActionTitle.Add( Group.FriendlyTypeName ).FormatAsHtmlTitle(); hlInactive.Visible = false; } else { lReadOnlyTitle.Text = group.Name.FormatAsHtmlTitle(); } SetEditMode( true ); tbName.Text = group.Name; tbDescription.Text = group.Description; cbIsSecurityRole.Checked = group.IsSecurityRole; cbIsActive.Checked = group.IsActive; using ( new UnitOfWorkScope() ) { var groupService = new GroupService(); var attributeService = new AttributeService(); LoadDropDowns(); gpParentGroup.SetValue( group.ParentGroup ?? groupService.Get( group.ParentGroupId ?? 0 ) ); // GroupType depends on Selected ParentGroup ddlParentGroup_SelectedIndexChanged( null, null ); gpParentGroup.Label = "Parent Group"; if ( group.Id == 0 && ddlGroupType.Items.Count > 1 ) { if ( GetAttributeValue( "LimittoSecurityRoleGroups" ).FromTrueFalse() ) { // default GroupType for new Group to "Security Roles" if LimittoSecurityRoleGroups var securityRoleGroupType = GroupTypeCache.GetSecurityRoleGroupType(); if ( securityRoleGroupType != null ) { ddlGroupType.SetValue( securityRoleGroupType.Id ); } else { ddlGroupType.SelectedIndex = 0; } } else { // if this is a new group (and not "LimitToSecurityRoleGroups", and there is more than one choice for GroupType, default to no selection so they are forced to choose (vs unintentionallly choosing the default one) ddlGroupType.SelectedIndex = 0; } } else { ddlGroupType.SetValue( group.GroupTypeId ); } ddlCampus.SetValue( group.CampusId ); GroupLocationsState = new ViewStateList<GroupLocation>(); foreach ( var groupLocation in group.GroupLocations ) { var groupLocationState = new GroupLocation(); groupLocationState.CopyPropertiesFrom( groupLocation ); if ( groupLocation.Location != null ) { groupLocationState.Location = new Location(); groupLocationState.Location.CopyPropertiesFrom( groupLocation.Location ); } if ( groupLocation.GroupLocationTypeValue != null) { groupLocationState.GroupLocationTypeValue = new DefinedValue(); groupLocationState.GroupLocationTypeValue.CopyPropertiesFrom( groupLocation.GroupLocationTypeValue ); } GroupLocationsState.Add( groupLocationState ); } ShowGroupTypeEditDetails( GroupTypeCache.Read(group.GroupTypeId), group, true); // if this block's attribute limit group to SecurityRoleGroups, don't let them edit the SecurityRole checkbox value if ( GetAttributeValue( "LimittoSecurityRoleGroups" ).FromTrueFalse() ) { cbIsSecurityRole.Enabled = false; cbIsSecurityRole.Checked = true; } string qualifierValue = group.Id.ToString(); GroupMemberAttributesState = new ViewStateList<Attribute>(); GroupMemberAttributesState.AddAll( attributeService.GetByEntityTypeId( new GroupMember().TypeId ).AsQueryable() .Where( a => a.EntityTypeQualifierColumn.Equals( "GroupId", StringComparison.OrdinalIgnoreCase ) && a.EntityTypeQualifierValue.Equals( qualifierValue ) ) .OrderBy( a => a.Order ) .ThenBy( a => a.Name ) .ToList() ); BindGroupMemberAttributesGrid(); BindInheritedAttributes( group.GroupTypeId, attributeService ); } }
private void ShowEditDetails( GroupType groupType ) { hlType.Visible = false; if ( groupType.Id == 0 ) { lReadOnlyTitle.Text = ActionTitle.Add( GroupType.FriendlyTypeName ).FormatAsHtmlTitle(); if ( groupType.GroupTypePurposeValue != null ) { hlType.Text = groupType.GroupTypePurposeValue.Name; hlType.Visible = true; } } else { lReadOnlyTitle.Text = groupType.Name.FormatAsHtmlTitle(); } SetEditMode( true ); using ( new UnitOfWorkScope() ) { var groupTypeService = new GroupTypeService(); var attributeService = new AttributeService(); LoadDropDowns( groupType.Id ); // General tbName.ReadOnly = groupType.IsSystem; tbName.Text = groupType.Name; tbDescription.ReadOnly = groupType.IsSystem; tbDescription.Text = groupType.Description; tbGroupTerm.ReadOnly = groupType.IsSystem; tbGroupTerm.Text = groupType.GroupTerm; tbGroupMemberTerm.ReadOnly = groupType.IsSystem; tbGroupMemberTerm.Text = groupType.GroupMemberTerm; ddlGroupTypePurpose.Enabled = !groupType.IsSystem; ddlGroupTypePurpose.SetValue( groupType.GroupTypePurposeValueId ); ChildGroupTypesDictionary = new Dictionary<int, string>(); groupType.ChildGroupTypes.ToList().ForEach( a => ChildGroupTypesDictionary.Add( a.Id, a.Name ) ); BindChildGroupTypesGrid(); // Display cbShowInGroupList.Checked = groupType.ShowInGroupList; cbShowInNavigation.Checked = groupType.ShowInNavigation; tbIconCssClass.Text = groupType.IconCssClass; // Locations cbAllowMultipleLocations.Enabled = !groupType.IsSystem; cbAllowMultipleLocations.Checked = groupType.AllowMultipleLocations; cblLocationSelectionModes.Enabled = !groupType.IsSystem; cblLocationSelectionModes.Enabled = true; foreach(ListItem li in cblLocationSelectionModes.Items) { GroupLocationPickerMode mode = (GroupLocationPickerMode)li.Value.AsInteger().Value; li.Selected = (groupType.LocationSelectionMode & mode) == mode; } LocationTypesDictionary = new Dictionary<int, string>(); groupType.LocationTypes.ToList().ForEach( a => LocationTypesDictionary.Add( a.LocationTypeValueId, a.LocationTypeValue.Name ) ); BindLocationTypesGrid(); // Check In cbTakesAttendance.Checked = groupType.TakesAttendance; ddlAttendanceRule.SetValue( (int)groupType.AttendanceRule ); ddlAttendancePrintTo.SetValue( (int)groupType.AttendancePrintTo ); // Attributes gtpInheritedGroupType.Enabled = !groupType.IsSystem; gtpInheritedGroupType.SelectedGroupTypeId = groupType.InheritedGroupTypeId; GroupTypeRolesState = new ViewStateList<GroupTypeRole>(); foreach(var role in groupType.Roles) { role.LoadAttributes(); GroupTypeRolesState.Add( role ); } BindGroupTypeRolesGrid(); string qualifierValue = groupType.Id.ToString(); GroupTypeAttributesState = new ViewStateList<Attribute>(); GroupTypeAttributesState.AddAll( attributeService.GetByEntityTypeId( new GroupType().TypeId ).AsQueryable() .Where( a => a.EntityTypeQualifierColumn.Equals( "Id", StringComparison.OrdinalIgnoreCase ) && a.EntityTypeQualifierValue.Equals( qualifierValue ) ) .OrderBy( a => a.Order ) .ThenBy( a => a.Name ) .ToList() ); BindGroupTypeAttributesGrid(); GroupAttributesState = new ViewStateList<Attribute>(); GroupAttributesState.AddAll( attributeService.GetByEntityTypeId( new Group().TypeId ).AsQueryable() .Where( a => a.EntityTypeQualifierColumn.Equals( "GroupTypeId", StringComparison.OrdinalIgnoreCase ) && a.EntityTypeQualifierValue.Equals( qualifierValue ) ) .OrderBy( a => a.Order ) .ThenBy( a => a.Name ) .ToList() ); BindGroupAttributesGrid(); GroupMemberAttributesState = new ViewStateList<Attribute>(); GroupMemberAttributesState.AddAll( attributeService.GetByEntityTypeId( new GroupMember().TypeId ).AsQueryable() .Where( a => a.EntityTypeQualifierColumn.Equals( "GroupTypeId", StringComparison.OrdinalIgnoreCase ) && a.EntityTypeQualifierValue.Equals( qualifierValue ) ) .OrderBy( a => a.Order ) .ThenBy( a => a.Name ) .ToList() ); BindGroupMemberAttributesGrid(); BindInheritedAttributes( groupType.InheritedGroupTypeId, groupTypeService, attributeService ); } }
/// <summary> /// Saves the state of the workflow activity controls to view. /// </summary> private void SaveWorkflowActivityControlsToViewState() { WorkflowActivityTypesState = new ViewStateList<WorkflowActivityType>(); int order = 0; foreach ( var activityEditor in phActivities.Controls.OfType<WorkflowActivityTypeEditor>() ) { WorkflowActivityType workflowActivityType = activityEditor.GetWorkflowActivityType(); workflowActivityType.Order = order++; WorkflowActivityTypesState.Add( workflowActivityType ); } }