/// <summary> /// Handles the SaveClick event of the MdEditEntityType control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> private void MdEditEntityType_SaveClick(object sender, EventArgs e) { using (RockContext rockContext = new RockContext()) { EntityTypeService entityTypeService = new EntityTypeService(rockContext); var entityType = entityTypeService.Get(hfIdValue.ValueAsInt()); entityType.IsIndexingEnabled = cbEnabledIndexing.Checked; rockContext.SaveChanges(); if (cbEnabledIndexing.Checked) { IndexContainer.CreateIndex(entityType.IndexModelType); // call for bulk indexing BulkIndexEntityTypeTransaction bulkIndexTransaction = new BulkIndexEntityTypeTransaction(); bulkIndexTransaction.EntityTypeId = entityType.Id; RockQueue.TransactionQueue.Enqueue(bulkIndexTransaction); } else { IndexContainer.DeleteIndex(entityType.IndexModelType); } } mdEditEntityType.Hide(); LoadEntities(); }
/// <summary> /// Handles the Click event of the gContentItemBulkLoad control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param> protected void gBulkLoad_Click(object sender, RowEventArgs e) { var entityType = EntityTypeCache.Get(e.RowKeyId); if (entityType != null) { BulkIndexEntityTypeTransaction bulkIndexTransaction = new BulkIndexEntityTypeTransaction(); bulkIndexTransaction.EntityTypeId = entityType.Id; RockQueue.TransactionQueue.Enqueue(bulkIndexTransaction); maMessages.Show(string.Format("A request has been sent to index {0}.", entityType.FriendlyName.Pluralize()), ModalAlertType.Information); } else { maMessages.Show("An error occurred launching the bulk index request. Could not find the entity type.", ModalAlertType.Alert); } }