当前位置: 首页>>代码示例>>C#>>正文


C# SaveEventArgs类代码示例

本文整理汇总了C#中SaveEventArgs的典型用法代码示例。如果您正苦于以下问题:C# SaveEventArgs类的具体用法?C# SaveEventArgs怎么用?C# SaveEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SaveEventArgs类属于命名空间,在下文中一共展示了SaveEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Album_saved

        private void Album_saved(IContentService sender, SaveEventArgs<IContent> e)
        {
            foreach (IContent node in e.SavedEntities)
              {
            if (node.ContentType.ContentTypeCompositionExists("Album") || node.ContentType.Alias == "Album")
            {
              IMediaService ms = UmbracoContext.Current.Application.Services.MediaService;
              IContent parent = node.Parent();
              int media_parentId;
              if (parent.ContentType.ContentTypeCompositionExists("Album") || parent.ContentType.Alias == "Album")
              {
            IMedia media_parent = ms.GetRootMedia().Where(x => x.Name == parent.Name).First(x => x.ContentType.Alias == "Folder");
            if (media_parent == null)
            {
              media_parent = ms.CreateMedia(parent.Name, -1, "Folder");
              ms.Save(media_parent);
            }
            media_parentId = media_parent.Id;
              }
              else
            media_parentId = -1;

              IMedia media_album = ms.CreateMedia(node.Name, media_parentId, "Folder");
              ms.Save(media_album);
            }
              }
        }
开发者ID:pavelsavrovsky,项目名称:cactus,代码行数:27,代码来源:UserEventHandler.cs

示例2: User_Saving

        /// <summary>
        /// User saving event.
        /// </summary>
        /// <remarks>
        /// User is already saved but the object itself is not updated yet.
        /// </remarks>
        void User_Saving(IUserService service, SaveEventArgs<IUser> e)
        {
            foreach (var savedEntity in e.SavedEntities)
            {
                if (savedEntity != null)
                {
                    if (!savedEntity.IsNewEntity())
                    {

                        // Update permissions for old users if the user type changes.
                        IUser savedUser = service.GetUserById(savedEntity.Id);
                        if (savedEntity.UserType.Alias != savedUser.UserType.Alias)
                        {
                            _userTypePermissionsService.CopyPermissionsForSingleUser(savedUser);
                        }

                    }
                    else
                    {

                        // Set permissions for new users.
                        _userTypePermissionsService.CopyPermissionsForSingleUser(savedEntity);

                    }
                }
            }
        }
开发者ID:AffinityID,项目名称:usergrouppermissions,代码行数:33,代码来源:UserSaved.cs

示例3: ContentServiceOnSaving

 /// <summary>
 /// Set auto-properties on content saving
 /// We can't do these properties on create as the source values will not exist
 /// </summary>
 /// <param name="sender">The content service</param>
 /// <param name="e">The save event arguments</param>
 protected void ContentServiceOnSaving(IContentService sender, SaveEventArgs<IContent> e)
 {
     foreach (IContent entity in e.SavedEntities)
     {
         entity.SetDefaultValue("headTitle", entity.Name);
     }
 }
开发者ID:JonKnaggs,项目名称:Merchello.UkFest.Workshop,代码行数:13,代码来源:UmbracoApplicationEventHandler.cs

示例4: MediaServiceSaved

 static void MediaServiceSaved(IMediaService sender, SaveEventArgs<IMedia> e)
 {
     foreach (var item in e.SavedEntities)
     {
         library.ClearLibraryCacheForMedia(item.Id);
     }
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:LibraryCacheRefresher.cs

示例5: SetIsApproved

        static void SetIsApproved(IMemberService sender, SaveEventArgs<IMember> e)
        {
            // Automatically approve all members, as we don't have an approval process now
            // This is needed as we added new membership after upgrading so IsApproved is
            // currently empty. First time a member gets saved now (login also saves the member)
            // IsApproved would turn false (default value of bool) so we want to prevent that

            // Note: Since July 23rd 2015 we need people to activate their accounts! Don't
            // approve automatically.
            var nonApprovedMembers = e.SavedEntities.Where(
                member => member.CreateDate < DateTime.Parse("2015-07-23")
                && member.Properties.Contains(Constants.Conventions.Member.IsApproved)
                && member.IsApproved == false);

            var memberService = ApplicationContext.Current.Services.MemberService;
            foreach (var member in nonApprovedMembers)
            {
                // Adds test for member having an Id, if they don't then it's a NEW member,
                // new members don't automatically get approved any more, only existing
                // member before July 23rd 2015
                if (member.HasIdentity)
                {
                    member.IsApproved = true;
                    memberService.Save(member, false);
                }
            }
        }
开发者ID:umbraco,项目名称:OurUmbraco,代码行数:27,代码来源:MemberApprovedEventhandler.cs

示例6: OnTemplateBuildingBlockSave

        private static void OnTemplateBuildingBlockSave(TemplateBuildingBlock subject, SaveEventArgs e, EventPhases phase)
        {
            if (!subject.IsAssemblyTemplateBuildingBlock())
                return;

            using (var session = subject.Session)
            {
                var templatingAssembly = new TemplatingAssembly(subject);

                foreach (var embeddedParameterSchema in templatingAssembly.EmbeddedParameterSchemas)
                {
                    if (session.IsExistingObject(String.Concat(subject.OrganizationalItem.WebDavUrl, "/", embeddedParameterSchema.Title, ".xsd")))
                        continue;

                    var parameterSchema = new Schema(session, subject.OrganizationalItem.Id)
                    {
                        Title = embeddedParameterSchema.Title,
                        Description = embeddedParameterSchema.Title,
                        Purpose = SchemaPurpose.TemplateParameters,
                        RootElementName = "Parameters",
                        Xsd = embeddedParameterSchema.Xsd
                    };

                    parameterSchema.Save(true);
                }

                foreach (var cSharpTemplateBuildingBlock in templatingAssembly.CSharpTemplateBuildingBlocks)
                {
                    //If a TBB already exists
                    if (session.IsExistingObject(String.Concat(subject.OrganizationalItem.WebDavUrl, "/", cSharpTemplateBuildingBlock.Title, ".tbbcs")))
                        continue;

                    //Create a new C# TBB
                    var templateBuildingBlock = new TemplateBuildingBlock(session, subject.OrganizationalItem.Id)
                    {
                        Title = cSharpTemplateBuildingBlock.Title,
                        TemplateType = TemplateTypes.CSharpTemplate,
                        Content = String.Format(CSharpTemplateBuildingBlockContent, templatingAssembly.Id, cSharpTemplateBuildingBlock.ClassName)
                    };

                    if (cSharpTemplateBuildingBlock.ParameterSchema != null)
                    {
                        if (cSharpTemplateBuildingBlock.ParameterSchema.ToLower().StartsWith("/webdav/") || cSharpTemplateBuildingBlock.ParameterSchema.ToLower().StartsWith("tcm:"))
                        {
                            var parameterSchema = (Schema) session.GetObject(cSharpTemplateBuildingBlock.ParameterSchema);
                            templateBuildingBlock.ParameterSchema = parameterSchema;
                        }
                        else if (cSharpTemplateBuildingBlock.ParameterSchema.ToLower().StartsWith("resource:"))
                        {
                            var parameterSchemaUrl = String.Concat(subject.OrganizationalItem.WebDavUrl, "/", Regex.Match(cSharpTemplateBuildingBlock.ParameterSchema, @"[\w ]*(?=\.xsd$)").Value, ".xsd");
                            var parameterSchema = (Schema)session.GetObject(parameterSchemaUrl);
                            templateBuildingBlock.ParameterSchema = parameterSchema;
                        }
                    }

                    templateBuildingBlock.Save(true);
                }
            }
        }
开发者ID:DavidForster,项目名称:Tridion-Event-Assembly-Upload,代码行数:59,代码来源:Events.cs

示例7: EntityCollectionServiceOnSaved

 /// <summary>
 /// The entity collection service on saved.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EntityCollectionServiceOnSaved(IEntityCollectionService sender, SaveEventArgs<IEntityCollection> e)
 {
     if (!EntityCollectionProviderResolver.HasCurrent) return;
     foreach (var collection in e.SavedEntities)
     {
         EntityCollectionProviderResolver.Current.AddOrUpdateCache(collection);
     }
 }
开发者ID:drpeck,项目名称:Merchello,代码行数:17,代码来源:EntityCollectionEvents.cs

示例8: Member_AfterSave

 private void Member_AfterSave(Member sender, SaveEventArgs e)
 {
     //ensure that only the providers are flagged to listen execute
     var xml = sender.ToXml(new System.Xml.XmlDocument(), false).ToXElement();
     var providers = ExamineManager.Instance.IndexProviderCollection.OfType<BaseUmbracoIndexer>()
         .Where(x => x.EnableDefaultEventHandler);
     ExamineManager.Instance.ReIndexNode(xml, IndexTypes.Member, providers);
 }
开发者ID:Xamarui,项目名称:Examine,代码行数:8,代码来源:UmbracoEventManager.cs

示例9: ExpireCache

 private void ExpireCache(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e)
 {
     foreach (var dataType in e.SavedEntities)
     {
         ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
             string.Concat("Our.Umbraco.NestedContent.GetPreValuesCollectionByDataTypeId_", dataType.Id));
     }
 }
开发者ID:wderoo,项目名称:umbraco-nested-content,代码行数:8,代码来源:Bootstrap.cs

示例10: GatewayProviderServiceOnSaved

        private void GatewayProviderServiceOnSaved(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> args)
        {
            var key = new Guid(Constants.GatewayProviderSettingsKey);
            var provider = args.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);
            if (provider == null) return;

            MappingExtensions.SaveProcessorSettings(provider.ExtendedData, new SagePayProcessorSettings());
        }
开发者ID:chrisdaaaaay,项目名称:Merchello.Plugins.SagePay,代码行数:8,代码来源:SagePayProviderEvents.cs

示例11: GatewayProviderServiceOnSaved

        private static void GatewayProviderServiceOnSaved(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> args)
        {
            var key = new Guid("C6BF6743-3565-401F-911A-33B68CACB11B");
            var provider = args.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);
            if (provider == null) return;

            provider.ExtendedData.SaveProcessorSettings(new AuthorizeNetProcessorSettings());
        }
开发者ID:BatJan,项目名称:Merchello,代码行数:8,代码来源:AuthorizeNetApplicationEventListener.cs

示例12: GatewayProviderServiceOnSaving

            private static void GatewayProviderServiceOnSaving(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> args)
            {
                var key = new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8");
                var provider = args.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);
                if (provider == null) return;

                provider.ExtendedData.SaveProcessorSettings(new StripeProcessorSettings());
            }
开发者ID:drpeck,项目名称:Merchello,代码行数:8,代码来源:StripeApplicationEventListener.cs

示例13: GatewayProviderServiceOnSaved

        private void GatewayProviderServiceOnSaved(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> args)
        {
            var key = new Guid("5F2E88D1-6D07-4809-B9AB-D4D6036473E9");
            var provider = args.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);
            if (provider == null) return;

            provider.ExtendedData.SaveSmtpProviderSettings(new SmtpNotificationGatewayProviderSettings());
        }
开发者ID:drpeck,项目名称:Merchello,代码行数:8,代码来源:SmtpProviderEvents.cs

示例14: GatewayProviderServiceOnSaving

        private void GatewayProviderServiceOnSaving(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> saveEventArgs)
        {
            var key = new Guid(Constants.ProviderId);

              var provider = saveEventArgs.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);
              if (provider == null) return;

              provider.ExtendedData.SaveProviderSettings(new QuickPayProviderSettings());
        }
开发者ID:joelbhansen,项目名称:MerchelloQuickPayProvider,代码行数:9,代码来源:UmbracoApplicationEvents.cs

示例15: GatewayProviderServiceOnSaving

        /// <summary>
        /// The gateway provider service on saving.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="saveEventArgs">
        /// The save event args.
        /// </param>
        private void GatewayProviderServiceOnSaving(IGatewayProviderService sender, SaveEventArgs<IGatewayProviderSettings> saveEventArgs)
        {
            var key = new Guid("DBC48C38-0617-44EA-989A-18AAD8D5DE52");
            var provider = saveEventArgs.SavedEntities.FirstOrDefault(x => key == x.Key && !x.HasIdentity);

            if (provider == null) return;

            provider.ExtendedData.SaveProviderSettings(new AvaTaxProviderSettings());
        }
开发者ID:Teknyc,项目名称:Merchello,代码行数:18,代码来源:UmbracoApplicationEvents.cs


注:本文中的SaveEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。