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


C# EntryType.ToString方法代码示例

本文整理汇总了C#中EntryType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EntryType.ToString方法的具体用法?C# EntryType.ToString怎么用?C# EntryType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntryType的用法示例。


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

示例1: Index

        public ActionResult Index(string filter, EntryType searchType = EntryType.Undefined, bool allowRedirect = true,
            string tag = null,
            string sort = null,
            int? artistId = null,
            ArtistType? artistType = null,
            DiscType? discType = null,
            SongType? songType = null,
            bool? onlyWithPVs = null
            )
        {
            filter = !string.IsNullOrEmpty(filter) ? filter.Trim() : string.Empty;

            if (allowRedirect && !string.IsNullOrEmpty(filter)) {

                var redirectResult = TryRedirect(filter, searchType);

                if (redirectResult != null)
                    return redirectResult;

            }

            ViewBag.Query = filter;
            ViewBag.SearchType = searchType != EntryType.Undefined ? searchType.ToString() : "Anything";
            ViewBag.Tag = tag;
            ViewBag.Sort = sort;
            ViewBag.ArtistId = artistId;
            ViewBag.ArtistType = artistType;
            ViewBag.DiscType = discType;
            ViewBag.SongType = songType;
            ViewBag.OnlyWithPVs = onlyWithPVs;

            SetSearchEntryType(searchType);
            return View();
        }
开发者ID:realzhaorong,项目名称:vocadb,代码行数:34,代码来源:SearchController.cs

示例2: AddEntry

        /// <summary>
        /// Adds an entry to the log.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="entryType">The type.</param>
        private static void AddEntry(string message, EntryType entryType)
        {
            lock (LockObject)
            {
                var logAbsolutePath = AppDomain.CurrentDomain.BaseDirectory + LogFileRelativePath;

                var writer = File.Exists(logAbsolutePath)
                                 ? new StreamWriter(File.Open(logAbsolutePath, FileMode.Append))
                                 : new StreamWriter(File.Open(logAbsolutePath, FileMode.Create));

                writer.WriteLine(string.Format("{0:yyyy-MM-dd hh:mm:ss} {1}: {2}", DateTime.Now, entryType.ToString().ToUpper(), message));
                writer.Close();
            }
        }
开发者ID:coding3d,项目名称:InstantRDF,代码行数:19,代码来源:Log.cs

示例3: Unvote

        public Task<RecivedVote> Unvote(EntryType entryType, int entryId, int commentId = 0)
        {
            if (!Enum.IsDefined(typeof (EntryType), entryType))
                throw new ArgumentOutOfRangeException(nameof(entryType));
            if (entryId <= 0) throw new ArgumentOutOfRangeException(nameof(entryId));

            var parameters = GetApiParameterSet();
            var methodParameters = new SortedSet<StringMethodParameter>
            {
                new StringMethodParameter("param1", entryType.ToString().ToLower()),
                new StringMethodParameter("param2", entryId)
            };
            if (entryType == EntryType.Comment && commentId != 0)
            {
                methodParameters.Add(new StringMethodParameter("param3", commentId));
            }

            return Client.CallApiMethodWithAuth<RecivedVote>(
                new ApiMethod(ApiV1Constants.EntriesUnvote, HttpMethod.Get, parameters, methodParameters)
                );
        }
开发者ID:adiospl,项目名称:WykopSharp,代码行数:21,代码来源:EntryRepository.cs

示例4: GetAccounts

 private IEnumerable<Models.Account> GetAccounts(EntryType entryType)
 {
     return _database.Query<Models.Account>(
         @"SELECT Account.*
             FROM Account
                 INNER JOIN AccountType ON AccountType.Name = AccountTypeName
             WHERE AccountType.EntryTypeName = @debitOrCredit",
         new {debitOrCredit = entryType.ToString()});
 }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:9,代码来源:GeneralLedgerRepository.cs

示例5: TryRedirect

        private ActionResult TryRedirect(string filter, EntryType searchType)
        {
            var matchMode = NameMatchMode.Auto;
            filter = FindHelpers.GetMatchModeAndQueryForSearch(filter, ref matchMode);

            switch (searchType) {

                case EntryType.Undefined: {
                    var result = services.Find(filter, 1, true);

                    if (result.OnlyOneItem) {

                        if (result.Albums.TotalCount == 1)
                            return RedirectToAlbum(result.Albums.Items[0].Id);

                        if (result.Artists.TotalCount == 1)
                            return RedirectToArtist(result.Artists.Items[0].Id);

                        if (result.Songs.TotalCount == 1)
                            return RedirectToSong(result.Songs.Items[0].Id);

                        if (result.Tags.TotalCount == 1)
                            return RedirectToAction("Details", "Tag", new { id = result.Tags.Items[0].Name });

                    }

                }
                break;

                case EntryType.Artist:
                    var artist = artistService.FindArtists(new ArtistQueryParams(filter, null, 0, 2, false, false, matchMode, ArtistSortRule.None, false));
                    if (artist.Items.Length == 1) {
                        return RedirectToArtist(artist.Items[0].Id);
                    }
                    break;

                case EntryType.Album:
                    var album = albumService.Find(new AlbumQueryParams(filter, DiscType.Unknown, 0, 2, false, false, matchMode, AlbumSortRule.None, false));
                    if (album.Items.Length == 1) {
                        return RedirectToAlbum(album.Items[0].Id);
                    }
                    break;

                case EntryType.Song:
                    var song = songService.Find(new SongQueryParams(filter, null, 0, 2, false, false, matchMode, SongSortRule.None, false, false, null));
                    if (song.Items.Length == 1) {
                        return RedirectToSong(song.Items[0].Id);
                    }
                    break;

                default: {
                    var action = "Index";
                    var controller = searchType.ToString();
                    return RedirectToAction(action, controller, new { filter });
                }

            }

            return null;
        }
开发者ID:realzhaorong,项目名称:vocadb,代码行数:60,代码来源:SearchController.cs


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