Esempio n. 1
0
        /// <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
                    var processEntityTypeBulkIndexMsg = new ProcessEntityTypeBulkIndex.Message
                    {
                        EntityTypeId = entityType.Id
                    };

                    processEntityTypeBulkIndexMsg.Send();
                }
                else
                {
                    IndexContainer.DeleteIndex(entityType.IndexModelType);
                }
            }

            mdEditEntityType.Hide();
            LoadEntities();
        }
Esempio n. 2
0
        /// <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)
            {
                var processEntityTypeBulkIndexMsg = new ProcessEntityTypeBulkIndex.Message
                {
                    EntityTypeId = entityType.Id
                };

                processEntityTypeBulkIndexMsg.Send();

                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);
            }
        }