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


C# Umbraco类代码示例

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


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

示例1: PackagingDataType

        public override void PackagingDataType(Umbraco.Courier.ItemProviders.DataType item)
        {
            //to ensure UI is there, include the digibiz folder of files
            item.Dependencies.Add("~/umbraco/plugins/DigibizAdvancedMediaPicker", Umbraco.Courier.ItemProviders.ProviderIDCollection.folderItemProviderGuid);
            item.Resources.Add("~/bin/DigibizTree.dll");

            var source = item.Prevalues.Where(x => x.SortOrder == 2).FirstOrDefault();
            var defaultType = item.Prevalues.Where(x => x.SortOrder == 13).FirstOrDefault();

            List<string> foundNodes = new List<string>();
            if (source != null && source.Value != null){
                source.Value = Dependencies.ConvertIdentifierCollection(source.Value.ToString(), out foundNodes);

                foreach (var g in foundNodes)
                    item.Dependencies.Add(g, ProviderIDCollection.mediaItemProviderGuid);

            }

            if (defaultType != null && defaultType.Value != null)
            {
                defaultType.Value = Dependencies.ConvertIdentifierCollection(defaultType.Value.ToString(), out foundNodes);

                foreach (var g in foundNodes)
                    item.Dependencies.Add(g, ProviderIDCollection.mediaTypeItemProviderGuid);
            }
        }
开发者ID:jayvin,项目名称:Courier,代码行数:26,代码来源:Damp.cs

示例2: Index

        /// <summary>
        /// Hi hacjking in progress! WE are going to search here
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public override System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel model)
        {
            //the incoming search term
            string incomingSearch = Request.QueryString["query"];

            //search result model
            var searchResultsToReturn = new SearchPageModel();

            //let's check if the incoming string is empty or not
            if (!string.IsNullOrEmpty(incomingSearch))
            {
                //let's get the searcher
                var umbBookSearch = Examine.ExamineManager.Instance.SearchProviderCollection["UmbBookSearchSearcher"];

                //do some searching
                var searchResults = umbBookSearch.Search(incomingSearch, true);

                foreach (var item in searchResults)
                {
                    SearchResultModel searchResult = new SearchResultModel();
                    searchResult.Name = item.Fields["nodeName"];
                    searchResult.UserId = item.Fields["id"];
                    searchResultsToReturn.Results.Add(searchResult);
                }

            }

            return CurrentTemplate(searchResultsToReturn);
        }
开发者ID:tomasaronjonsson,项目名称:umbbook,代码行数:34,代码来源:SearchController.cs

示例3: MemberServiceSaved

        /// <summary>
        /// Copies first name, last name and email address from saved member to Merchello customer.
        /// </summary>
        /// <param name="sender">
        /// The <see cref="IMemberService"/>.
        /// </param>
        /// <param name="e">
        /// The saved <see cref="IMember"/>s.
        /// </param>
        private static void MemberServiceSaved(IMemberService sender, Umbraco.Core.Events.SaveEventArgs<Umbraco.Core.Models.IMember> e)
        {
            var members = e.SavedEntities.ToArray();

            // Allowed member types for Merchello customers
            var customerMemberTypes = MerchelloConfiguration.Current.CustomerMemberTypes.ToArray();

            // Get a reference to Merchello's customer service
            var customerService = MerchelloContext.Current.Services.CustomerService;

            foreach (var member in members)
            {
                // verify the member is a customer type
                if (!customerMemberTypes.Contains(member.ContentTypeAlias)) continue;

                var customer = customerService.GetByLoginName(member.Username);
                if (customer == null) continue;

                customer.FirstName = member.GetValue<string>("firstName") ?? string.Empty;
                customer.LastName = member.GetValue<string>("lastName") ?? string.Empty;
                customer.Email = member.Username;

                customerService.Save(customer);
            }
        }
开发者ID:jlarc,项目名称:Merchello,代码行数:34,代码来源:UmbracoEventHandler.cs

示例4: GetProperty

        /// <summary>
        /// Gets the property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="config">The config.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public override object GetProperty(Umbraco.Core.Models.Property property, UmbracoPropertyConfiguration config, UmbracoDataMappingContext context)
        {
            if (property == null || property.Value == null)
                return null;

            var mediaService = new MediaService(new RepositoryFactory());
            int id;

            if (!int.TryParse(property.Value.ToString(), out id))
                return null;

            var file = mediaService.GetById(id);

            if (file != null)
            {
                int bytes;
                int.TryParse(file.Properties["umbracoBytes"].Value.ToString(), out bytes);

                var img = new File
                    {
                        Id = file.Id,
                        Name = file.Name,
                        Src = file.Properties["umbracoFile"].Value.ToString(),
                        Extension = file.Properties["umbracoExtension"].Value.ToString(),
                        Size = bytes
                    };
                return img;
            }

            return null;
        }
开发者ID:neilduncan,项目名称:Glass.Mapper,代码行数:38,代码来源:UmbracoPropertyFileMapper.cs

示例5: ContentServicePublished

        void ContentServicePublished(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<IContent> e)
        {
            // when something is published, (if it's a ForumPost)
            // clear the relevant forum cache.
            // we do it in two steps because more than one post in a forum
            // may have been published, so we only need to clear the cache
            // once.

            List<string> invalidCacheList = new List<string>();

            foreach (var item in e.PublishedEntities)
            {
                // is a forum post...
                if (item.ContentTypeId == postContentTypeId)
                {
                    // get parent Forum.
                    invalidCacheList = AddParentForumCaches(item, invalidCacheList);
                }
            }

            // clear the cache for any forums that have had child pages published...
            foreach (var cache in invalidCacheList)
            {
                LogHelper.Info<SimpilyForumCacheHandler>("Clearing Forum Info Cache: {0}", () => cache);
                ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(cache);
            }
        }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:27,代码来源:SimpilyForumCache.cs

示例6: ContentService_Creating

 private void ContentService_Creating(IContentService sender, Umbraco.Core.Events.NewEventArgs<IContent> e)
 {
     //if (e.Alias == "SOSU-Nyhed")
     //{
     //    e.Entity.SetValue("contentDate", DateTime.Now);
     //    //                e.Entity.SetValue("umbracoNaviHide", true);
     //}
 }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:8,代码来源:ContentDefaultValues.cs

示例7: MediaService_Trashing

 void MediaService_Trashing(IMediaService sender, Umbraco.Core.Events.MoveEventArgs<IMedia> e)
 {
     SourceInfo.Load();
     LogHelper.Info<MediaEvents>("Archiving {0}", () => e.Entity.Name); 
     MediaExporter me = new MediaExporter();
     me.Archive(e.Entity);
     SourceInfo.Save(); 
 }
开发者ID:pbevis,项目名称:jumoo.usync,代码行数:8,代码来源:MediaEvents.cs

示例8: ContentService_Trashing

        /// <summary>
        ///  when something is deleted it's plopped in the recycle bin
        /// </summary>
        void ContentService_Trashing(IContentService sender, Umbraco.Core.Events.MoveEventArgs<IContent> e)
        {
            LogHelper.Info<ContentEvents>("Trashing {0}", () => e.Entity.Name);
            ArchiveContentItem(e.Entity);



        }
开发者ID:pbevis,项目名称:jumoo.usync,代码行数:11,代码来源:ContentEvents.cs

示例9: Index

 public override ActionResult Index(Umbraco.Web.Models.RenderModel model)
 {
     var image = _imageRepository.GetCurrentAndNextImage();
     var homePageModel = new ImagePageModel();
     homePageModel.CurrentImage = image.Item1;
     homePageModel.NextImage = image.Item2;
     ViewBag.ImageWidth = homePageModel.CurrentImage.Width;
     return View(@"~\Views\Home.cshtml", homePageModel);
 }
开发者ID:kimschurmann,项目名称:RauffsPhotoBlog,代码行数:9,代码来源:HomeController.cs

示例10: DataTypeService_Saved

 private void DataTypeService_Saved(Umbraco.Core.Services.IDataTypeService sender, Umbraco.Core.Events.SaveEventArgs<IDataTypeDefinition> e)
 {
     var types = CodeFirstManager.Current.Modules.DataTypeModule.DataTypeRegister.GetTypesByDataTypeDefinitionIds(e.SavedEntities.Select(x => x.Id));
     foreach (var type in types)
     {
         List<PreValue> val;
         _cache.TryRemove(type, out val); //invalidate any prevalue cache so prevalues are refreshed when next needed
     }
 }
开发者ID:DanMannMann,项目名称:UmbracoCodeFirst,代码行数:9,代码来源:PreValueCacheModule.cs

示例11: ContentService_Published

 void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<IContent> e)
 {
     foreach (var item in e.PublishedEntities.Where(x => x.ContentType.Alias == "Project"))
     {
         if (item.GetValue<bool>("projectLive"))
         {
             UpdateProjectExamineIndex(item);
         }
     }
 }
开发者ID:KerwinMa,项目名称:OurUmbraco,代码行数:10,代码来源:ProjectIndexer.cs

示例12: Index

        public override System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel model)
        {
            MembersWallModel membersWall = new MembersWallModel();

            if (User.Identity.IsAuthenticated)
            {
                //lets get the user id either from the query or the current user
                int userIdToView;
                int userCurrentUser = _myHelper.getBrowsingUserId();
                if (!Int32.TryParse(Request.Params.Get("id"), out userIdToView) || userIdToView == 0)
                {
                    userIdToView = userCurrentUser;
                }

                //store the user we are going to use
                var user = _memberService.GetById(userIdToView);
                //flag it if the browsing user is looking at his own profile
                if (userCurrentUser == userIdToView)
                {
                    membersWall.isThisHisOwnWall = true;
                }

                //store the basic info
                membersWall.owner = user;

                //lets add the profile image to the user

                //first we need the relation type
                IRelationType relationTypeToFetch = _relationService.GetRelationTypeByAlias("memberToProfileImage");

                //lets try to find a relationship between the member and some profile picture
                var memberToProfileImageRelation = _relationService.GetAllRelationsByRelationType(relationTypeToFetch.Id).Where(x => x.ParentId == membersWall.owner.Id);

                //get all the pictures
                var profileImageToUseRelation = memberToProfileImageRelation.Select(x => Umbraco.TypedMedia(x.ChildId));

                //select the newest picture and get the url for it
                var profileImageToUseMedia = profileImageToUseRelation.OrderByDescending(x => x.CreateDate);

                if (profileImageToUseMedia.Count() > 0)
                {
                    if (profileImageToUseMedia.First() != null)
                    {
                        membersWall.profileImage = profileImageToUseMedia.First().Url;
                    }
                }

            }
            else
            {
                return PartialView("MemberLogin");
            }

            return CurrentTemplate(membersWall);
        }
开发者ID:tomasaronjonsson,项目名称:umbbook,代码行数:55,代码来源:MembersWallController.cs

示例13: ContentService_Deleted

        void ContentService_Deleted(IContentService sender, Umbraco.Core.Events.DeleteEventArgs<Umbraco.Core.Models.IContent> e)
        {
            var fs = new ForumService(ApplicationContext.Current.DatabaseContext);
            foreach (var ent in e.DeletedEntities.Where(x => x.ContentType.Alias == "Forum"))
            {

                var f = fs.GetById(ent.Id);
                if (f != null)
                    fs.Delete(f);
            }
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:11,代码来源:NewForumHandler.cs

示例14: Property

        internal Property(Umbraco.Core.Models.Property property)
        {
            _id = property.Id;
            _property = property;
            _propertyType = property.PropertyType;

            //Just to ensure that there is a PropertyType available
            _pt = PropertyType.GetPropertyType(property.PropertyTypeId);
            _data = _pt.DataTypeDefinition.DataType.Data;
            _data.PropertyId = Id;
        }
开发者ID:CarlSargunar,项目名称:Umbraco-CMS,代码行数:11,代码来源:Property.cs

示例15: FormStorage_Deleted

 void FormStorage_Deleted(object sender, Umbraco.Forms.Core.FormEventArgs e)
 {
     // If this Form was stored in a Folder, remove it.
     var form = e.Form;
     var folder = PerplexFolder.Get(f => f.Forms.Any(fid => fid == form.Id.ToString()));
     if (folder != null)
     {
         folder.Forms.Remove(form.Id.ToString());
         PerplexFolder.SaveAll();
     }
 }
开发者ID:PerplexInternetmarketing,项目名称:Perplex-Umbraco-Forms,代码行数:11,代码来源:MvcApplication.cs


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