/// <summary> /// Raises the <see cref="E:GridReorder"/> event. /// </summary> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected virtual void OnGridReorder(GridReorderEventArgs e) { if (GridReorder != null) { GridReorder(this, e); } }
/// <summary> /// Raises the appropriate events for the <see cref="T:System.Web.UI.WebControls.GridView"/> control when it posts back to the server. /// </summary> /// <param name="eventArgument">The event argument from which to create a <see cref="T:System.Web.UI.WebControls.CommandEventArgs"/> for the event or events that are raised.</param> void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { if (eventArgument.StartsWith("re-order:")) { string[] parms = eventArgument.Substring(9).Split(';'); string dataKey = parms[0]; int oldIndex = 0; if (!Int32.TryParse(parms[1], out oldIndex)) { oldIndex = 0; } int newIndex = 0; if (!Int32.TryParse(parms[2], out newIndex)) { newIndex = 0; } int pageFactor = this.PageIndex * this.PageSize; oldIndex += pageFactor; newIndex += pageFactor; GridReorderEventArgs args = new GridReorderEventArgs(dataKey, oldIndex, newIndex); OnGridReorder(args); } else { base.RaisePostBackEvent(eventArgument); } }
/// <summary> /// Handles the Reorder event of the gLocations control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gLocations_Reorder(object sender, GridReorderEventArgs e) { if (ReorderLocationClick != null) { var eventArg = new CheckinGroupEventArg(GroupGuid, e.DataKey, e.OldIndex, e.NewIndex); ReorderLocationClick(this, eventArg); } }
/// <summary> /// Handles the Reorder event of the gFields control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gFields_Reorder(object sender, GridReorderEventArgs e) { if (ReorderFieldClick != null) { var eventArg = new TemplateFormFieldEventArg(FormGuid, e.OldIndex, e.NewIndex); ReorderFieldClick(this, eventArg); } }
/// <summary> /// Handles the Reorder event of the gAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gAttributes_Reorder(object sender, GridReorderEventArgs e) { if (ReorderAttributeClick != null) { var eventArg = new WorkflowActivityTypeAttributeEventArg(ActivityTypeGuid, e.OldIndex, e.NewIndex); ReorderAttributeClick(this, eventArg); } }
/// <summary> /// Handles the GridReorder event of the gMatrixItems control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> private void gMatrixItems_GridReorder(object sender, GridReorderEventArgs e) { var rockContext = new RockContext(); var attributeMatrix = new AttributeMatrixService(rockContext).Get(this.AttributeMatrixGuid.Value); var service = new AttributeMatrixItemService(rockContext); var items = service.Queryable().Where(a => a.AttributeMatrixId == attributeMatrix.Id).OrderBy(i => i.Order).ToList(); service.Reorder(items, e.OldIndex, e.NewIndex); rockContext.SaveChanges(); BindGrid(this.AttributeMatrixGuid); }
/// <summary> /// Handles the GridReorder event of the gContentChannelItems control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.GridReorderEventArgs"/> instance containing the event data.</param> protected void gContentChannelItems_GridReorder(object sender, Rock.Web.UI.Controls.GridReorderEventArgs e) { var contentChannel = this.GetContentChannel(); if (contentChannel != null) { var rockContext = new RockContext(); ContentChannelItemService contentChannelItemService = new ContentChannelItemService(rockContext); var contentChannelItems = contentChannelItemService.Queryable().Where(a => a.ContentChannelId == contentChannel.Id).OrderBy(a => a.Order).ThenBy(a => a.Title).ToList(); contentChannelItemService.Reorder(contentChannelItems, e.OldIndex, e.NewIndex); rockContext.SaveChanges(); BindContentChannelItemsGrid(); } }
/// <summary> /// Handles the GridReorder event of the gPages control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.GridReorderEventArgs"/> instance containing the event data.</param> protected void gPages_GridReorder(object sender, Rock.Web.UI.Controls.GridReorderEventArgs e) { var applicationId = PageParameter(PageParameterKey.SiteId).AsInteger(); using (var rockContext = new RockContext()) { PageService pageService = new PageService(rockContext); var pages = pageService.GetBySiteId(applicationId) .OrderBy(p => p.Order) .ThenBy(p => p.InternalName) .ToList(); pageService.Reorder(pages, e.OldIndex, e.NewIndex); rockContext.SaveChanges(); } BindPages( ); }
/// <summary> /// Handles the GridReorder event of the rGridSuggestion control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> void rGridSuggestion_GridReorder( object sender, GridReorderEventArgs e ) { var rockContext = new RockContext(); var service = new FollowingSuggestionTypeService( rockContext ); var followingSuggestions = service.Queryable().OrderBy( i => i.Order ).ToList(); service.Reorder( followingSuggestions, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); BindGrid(); }
/// <summary> /// Handles the Reorder event of the gFields control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gFields_Reorder( object sender, GridReorderEventArgs e ) { if ( ReorderFieldClick != null ) { var eventArg = new TemplateFormFieldEventArg( FormGuid, e.OldIndex, e.NewIndex ); ReorderFieldClick( this, eventArg ); } }
/// <summary> /// Handles the GridReorder event of the gPageBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { int pageId = PageParameter( "EditPage" ).AsInteger(); Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); var rockContext = new RockContext(); BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByPageAndZone( page.Id, zoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); page.FlushBlocks(); BindGrids(); }
/// <summary> /// Handles the GridReorder event of the gFees control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gFees_GridReorder( object sender, GridReorderEventArgs e ) { ParseControls(); var movedItem = FeeState.Where( a => a.Order == e.OldIndex ).FirstOrDefault(); if ( movedItem != null ) { if ( e.NewIndex < e.OldIndex ) { // Moved up foreach ( var otherItem in FeeState.Where( a => a.Order < e.OldIndex && a.Order >= e.NewIndex ) ) { otherItem.Order = otherItem.Order + 1; } } else { // Moved Down foreach ( var otherItem in FeeState.Where( a => a.Order > e.OldIndex && a.Order <= e.NewIndex ) ) { otherItem.Order = otherItem.Order - 1; } } movedItem.Order = e.NewIndex; } int order = 0; FeeState.OrderBy( f => f.Order ).ToList().ForEach( f => f.Order = order++ ); BuildControls(); }
/// <summary> /// Handles the GridReorder event of the gAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gAttributes_GridReorder( object sender, GridReorderEventArgs e ) { ParseControls(); SortAttributes( AttributesState, e.OldIndex, e.NewIndex ); ReOrderAttributes( AttributesState ); BindAttributesGrid(); BuildControls( true ); }
/// <summary> /// Handles the GridReorder event of the gPageBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { using ( var rockContext = new RockContext() ) { BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByPageAndZone( _Page.Id, _ZoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } _Page.FlushBlocks(); PageUpdated = true; BindGrids(); }
void gCategories_GridReorder( object sender, GridReorderEventArgs e ) { using ( new UnitOfWorkScope() ) { var categories = GetCategories(); if ( categories != null ) { new CategoryService().Reorder( categories.ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); } BindGrid(); } }
void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { blockInstanceService.Reorder( blockInstanceService.GetByLayoutAndPageIdAndZone( null, _page.Id, _zoneName ).ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); BindGrids(); }
/// <summary> /// Raises the appropriate events for the <see cref="T:System.Web.UI.WebControls.GridView"/> control when it posts back to the server. /// </summary> /// <param name="eventArgument">The event argument from which to create a <see cref="T:System.Web.UI.WebControls.CommandEventArgs"/> for the event or events that are raised.</param> void IPostBackEventHandler.RaisePostBackEvent( string eventArgument ) { if ( eventArgument.StartsWith( "re-order:" ) ) { string[] parms = eventArgument.Substring( 9 ).Split( ';' ); string dataKey = parms[0]; int oldIndex = 0; if ( !int.TryParse( parms[1], out oldIndex ) ) { oldIndex = 0; } int newIndex = 0; if ( !int.TryParse( parms[2], out newIndex ) ) { newIndex = 0; } int pageFactor = this.PageIndex * this.PageSize; oldIndex += pageFactor; newIndex += pageFactor; GridReorderEventArgs args = new GridReorderEventArgs( dataKey, oldIndex, newIndex ); OnGridReorder( args ); } else { base.RaisePostBackEvent( eventArgument ); } }
/// <summary> /// Handles the GridReorder event of the rGridAccounts control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void rGridAccount_GridReorder( object sender, GridReorderEventArgs e ) { var rockContext = new RockContext(); var accounts = GetAccounts( rockContext ); if ( accounts != null ) { new FinancialAccountService( rockContext ).Reorder( accounts.ToList(), e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Raises the <see cref="E:GridReorder"/> event. /// </summary> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected virtual void OnGridReorder( GridReorderEventArgs e ) { if ( GridReorder != null ) { GridReorder( this, e ); } }
/// <summary> /// Handles the GridReorder event of the rGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { int entityTypeId = iSecured.TypeId; var rockContext = new RockContext(); var authService = new Rock.Model.AuthService( rockContext ); List<Rock.Model.Auth> rules = authService.GetAuths( iSecured.TypeId, iSecured.Id, CurrentAction ).ToList(); authService.Reorder( rules, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); Authorization.ReloadAction( iSecured.TypeId, iSecured.Id, CurrentAction ); BindGrid(); }
/// <summary> /// Handles the GridReorder event of the gMetricPartitions control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gMetricPartitions_GridReorder( object sender, GridReorderEventArgs e ) { ReorderMetricPartitionsList( MetricPartitionsState, e.OldIndex, e.NewIndex ); BindMetricPartitionsGrid(); }
/// <summary> /// Handles the GridReorder event of the rGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { var categories = GetCategories(); if ( categories != null ) { var rockContext = new RockContext(); new CategoryService( rockContext ).Reorder( categories.ToList(), e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the Reorder event of the gAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gAttributes_Reorder( object sender, GridReorderEventArgs e ) { if ( ReorderAttributeClick != null ) { var eventArg = new WorkflowActivityTypeAttributeEventArg( ActivityTypeGuid, e.OldIndex, e.NewIndex ); ReorderAttributeClick( this, eventArg ); } }
/// <summary> /// Handles the GridReorder event of the grdFinancialBatch control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> private void rGridBatch_GridReorder( object sender, GridReorderEventArgs e ) { var batchService = new Rock.Model.FinancialBatchService(); var queryable = batchService.Queryable(); List<Rock.Model.FinancialBatch> items = queryable.ToList(); batchService.Reorder( items, e.OldIndex, e.NewIndex, CurrentPersonId ); BindGrid(); }
/// <summary> /// Handles the GridReorder event of the gAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gAttributes_GridReorder( object sender, GridReorderEventArgs e ) { ReorderAttributeList( AttributesState, e.OldIndex, e.NewIndex ); BindAttributesGrid(); }
/// <summary> /// Handles the GridReorder event of the gGroupTypeRoles control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gGroupTypeRoles_GridReorder( object sender, GridReorderEventArgs e ) { ReorderGroupTypeRoleList( GroupTypeRolesState, e.OldIndex, e.NewIndex ); BindGroupTypeRolesGrid(); }
/// <summary> /// Handles the GridReorder event of the gItemAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gItemAttributes_GridReorder( object sender, GridReorderEventArgs e ) { var movedItem = ItemAttributesState.Where( a => a.Order == e.OldIndex ).FirstOrDefault(); if ( movedItem != null ) { if ( e.NewIndex < e.OldIndex ) { // Moved up foreach ( var otherItem in ItemAttributesState.Where( a => a.Order < e.OldIndex && a.Order >= e.NewIndex ) ) { otherItem.Order = otherItem.Order + 1; } } else { // Moved Down foreach ( var otherItem in ItemAttributesState.Where( a => a.Order > e.OldIndex && a.Order <= e.NewIndex ) ) { otherItem.Order = otherItem.Order - 1; } } movedItem.Order = e.NewIndex; } BindItemAttributesGrid(); }
void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { int entityTypeId = iSecured.TypeId; List<Rock.Model.Auth> rules = authService.GetAuths( iSecured.TypeId, iSecured.Id, CurrentAction ).ToList(); authService.Reorder( rules, e.OldIndex, e.NewIndex, CurrentPersonId ); Authorization.ReloadAction( iSecured.TypeId, iSecured.Id, CurrentAction ); BindGrid(); }
/// <summary> /// Handles the GridReorder event of the gMemberWorkflowTriggers control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gMemberWorkflowTriggers_GridReorder( object sender, GridReorderEventArgs e ) { ReorderMemberWorkflowTriggerList( MemberWorkflowTriggersState, e.OldIndex, e.NewIndex ); BindMemberWorkflowTriggersGrid(); }
/// <summary> /// Handles the GridReorder event of the gFields control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gFields_GridReorder( object sender, GridReorderEventArgs e ) { ParseControls(); if ( FormFieldsState.Any() ) { var keyValue = FormFieldsState.First(); SortFields( keyValue.Value, e.OldIndex, e.NewIndex ); ReOrderFields( keyValue.Value ); } BuildControls(); }
private void gWidgityItemAttributes_GridReorder(object sender, Rock.Web.UI.Controls.GridReorderEventArgs e) { WidgityItemAttributes = SortAttributes(WidgityItemAttributes, e.OldIndex, e.NewIndex); SaveState(); }
/// <summary> /// Handles the GridReorder event of the gDefinedValues control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> private void gDefinedValues_GridReorder( object sender, GridReorderEventArgs e ) { int definedTypeId = hfDefinedTypeId.ValueAsInt(); DefinedTypeCache.Flush( definedTypeId ); using ( new UnitOfWorkScope() ) { var definedValueService = new DefinedValueService(); var definedValues = definedValueService.Queryable().Where( a => a.DefinedTypeId == definedTypeId ).OrderBy( a => a.Order ); definedValueService.Reorder( definedValues.ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); BindDefinedValuesGrid(); } }
/// <summary> /// Handles the GridReorder event of the gGroupType control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gGroupType_GridReorder( object sender, GridReorderEventArgs e ) { var rockContext = new RockContext(); var groupTypes = GetGroupTypes( rockContext ); if ( groupTypes != null ) { new GroupTypeService( rockContext ).Reorder( groupTypes.ToList(), e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the GridReorder event of the rGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { var tags = GetTags(); if ( tags != null ) { var rockContext = new RockContext(); var tagService = new TagService( rockContext ); tagService.Reorder( tags.ToList(), e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the GridReorder event of the gBatchList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> private void gBatchList_GridReorder( object sender, GridReorderEventArgs e ) { var rockContext = new RockContext(); var batchService = new Rock.Model.FinancialBatchService( rockContext ); var queryable = batchService.Queryable(); List<Rock.Model.FinancialBatch> items = queryable.ToList(); batchService.Reorder( items, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); BindGrid(); }
void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { int? parentPageId = null; if (_page != null) parentPageId = _page.Id; pageService.Reorder( pageService.GetByParentPageId( parentPageId ).ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); BindGrid(); }
/// <summary> /// Handles the GridReorder event of the gDefinedTypeAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> void gDefinedTypeAttributes_GridReorder( object sender, GridReorderEventArgs e ) { string qualifierValue = hfDefinedTypeId.Value; var rockContext = new RockContext(); var attributeService = new AttributeService( rockContext ); int order = 0; var attributes = attributeService .GetByEntityTypeId( new DefinedValue().TypeId ).AsQueryable() .Where( a => a.EntityTypeQualifierColumn.Equals( "DefinedTypeId", StringComparison.OrdinalIgnoreCase ) && a.EntityTypeQualifierValue.Equals( qualifierValue ) ) .OrderBy( a => a.Order ) .ThenBy( a => a.Name ) .ToList(); attributes.ForEach( a => a.Order = order++ ); var movedItem = attributes.Where( a => a.Order == e.OldIndex ).FirstOrDefault(); if ( movedItem != null ) { if ( e.NewIndex < e.OldIndex ) { // Moved up foreach ( var otherItem in attributes.Where( a => a.Order < e.OldIndex && a.Order >= e.NewIndex ) ) { otherItem.Order = otherItem.Order + 1; } } else { // Moved Down foreach ( var otherItem in attributes.Where( a => a.Order > e.OldIndex && a.Order <= e.NewIndex ) ) { otherItem.Order = otherItem.Order - 1; } } movedItem.Order = e.NewIndex; rockContext.SaveChanges(); } BindDefinedTypeAttributesGrid(); }
/// <summary> /// Handles the GridReorder event of the rGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Controls.GridReorderEventArgs"/> instance containing the event data.</param> void rGrid_GridReorder( object sender, GridReorderEventArgs e ) { var components = _container.Dictionary.ToList(); var movedItem = components[e.OldIndex]; components.RemoveAt( e.OldIndex ); if ( e.NewIndex >= components.Count ) components.Add( movedItem ); else components.Insert( e.NewIndex, movedItem ); var rockContext = new RockContext(); int order = 0; foreach ( var item in components ) { Component component = item.Value.Value; if ( component.Attributes.ContainsKey("Order") ) { Rock.Attribute.Helper.SaveAttributeValue( component, component.Attributes["Order"], order.ToString(), rockContext ); } order++; } _container.Refresh(); BindGrid(); }
void gCategories_GridReorder( object sender, GridReorderEventArgs e ) { var rockContext = new RockContext(); var categories = GetCategories( rockContext ); if ( categories != null ) { var changedIds = new CategoryService( rockContext ).Reorder( categories.ToList(), e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); foreach ( int id in changedIds ) { CategoryCache.Flush( id ); } } BindGrid(); }