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


C# InternalItemsQuery.HasField方法代码示例

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


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

示例1: GetFinalColumnsToSelect

        private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] startColumns, IDbCommand cmd)
        {
            var list = startColumns.ToList();

            foreach (var field in allFields)
            {
                if (!query.HasField(field))
                {
                    foreach (var fieldToRemove in GetColumnNamesFromField(field).ToList())
                    {
                        list.Remove(fieldToRemove);
                    }
                }
            }

            if (!query.DtoOptions.EnableImages)
            {
                list.Remove("Images");
            }

            if (EnableJoinUserData(query))
            {
                list.Add("UserDataDb.UserData.UserId");
                list.Add("UserDataDb.UserData.lastPlayedDate");
                list.Add("UserDataDb.UserData.playbackPositionTicks");
                list.Add("UserDataDb.UserData.playcount");
                list.Add("UserDataDb.UserData.isFavorite");
                list.Add("UserDataDb.UserData.played");
                list.Add("UserDataDb.UserData.rating");
            }

            if (query.SimilarTo != null)
            {
                var item = query.SimilarTo;

                var builder = new StringBuilder();
                builder.Append("(");

                builder.Append("(([email protected]) * 10)");
                //builder.Append("+ (([email protected]) * 10)");

                builder.Append("+(Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 10 Then 2 Else 0 End )");
                builder.Append("+(Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 5 Then 2 Else 0 End )");

                //// genres
                builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=2 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=2)) * 10)");

                //// tags
                builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=4 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=4)) * 10)");

                builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=5 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=5)) * 10)");

                builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=3 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=3)) * 3)");

                //builder.Append("+ ((Select count(Name) from People where ItemId=Guid and Name in (select Name from People where [email protected])) * 3)");

                ////builder.Append("(select group_concat((Select Name from People where ItemId=Guid and Name in (Select Name from People where [email protected])), '|'))");

                builder.Append(") as SimilarityScore");

                list.Add(builder.ToString());
                cmd.Parameters.Add(cmd, "@ItemOfficialRating", DbType.String).Value = item.OfficialRating;
                cmd.Parameters.Add(cmd, "@ItemProductionYear", DbType.Int32).Value = item.ProductionYear ?? 0;
                cmd.Parameters.Add(cmd, "@SimilarItemId", DbType.Guid).Value = item.Id;

                var excludeIds = query.ExcludeItemIds.ToList();
                excludeIds.Add(item.Id.ToString("N"));
                query.ExcludeItemIds = excludeIds.ToArray();

                query.ExcludeProviderIds = item.ProviderIds;
            }

            return list.ToArray();
        }
开发者ID:t-andre,项目名称:Emby,代码行数:74,代码来源:SqliteItemRepository.cs

示例2: GetItem


//.........这里部分代码省略.........
                {
                    hasProgramAttributes.IsLive = reader.GetBoolean(10);
                }

                if (!reader.IsDBNull(11))
                {
                    hasProgramAttributes.IsNews = reader.GetBoolean(11);
                }

                if (!reader.IsDBNull(12))
                {
                    hasProgramAttributes.IsPremiere = reader.GetBoolean(12);
                }

                if (!reader.IsDBNull(13))
                {
                    hasProgramAttributes.EpisodeTitle = reader.GetString(13);
                }

                if (!reader.IsDBNull(14))
                {
                    hasProgramAttributes.IsRepeat = reader.GetBoolean(14);
                }
            }

            var index = 15;

            if (!reader.IsDBNull(index))
            {
                item.CommunityRating = reader.GetFloat(index);
            }
            index++;

            if (query.HasField(ItemFields.CustomRating))
            {
                if (!reader.IsDBNull(index))
                {
                    item.CustomRating = reader.GetString(index);
                }
                index++;
            }

            if (!reader.IsDBNull(index))
            {
                item.IndexNumber = reader.GetInt32(index);
            }
            index++;

            if (query.HasField(ItemFields.Settings))
            {
                if (!reader.IsDBNull(index))
                {
                    item.IsLocked = reader.GetBoolean(index);
                }
                index++;

                if (!reader.IsDBNull(index))
                {
                    item.PreferredMetadataLanguage = reader.GetString(index);
                }
                index++;

                if (!reader.IsDBNull(index))
                {
                    item.PreferredMetadataCountryCode = reader.GetString(index);
                }
开发者ID:t-andre,项目名称:Emby,代码行数:67,代码来源:SqliteItemRepository.cs


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