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


C# SqlDataReader.BooleanNullableField方法代码示例

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


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

示例1: MapCrew

        /// <summary>
        /// Maps the crew.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Crew member collection</returns>
        private static async Task<CrewmemberCollection> MapCrew(SqlDataReader dataReader)
        {
            var crewmemberCollection = new CrewmemberCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var crew = new Crewmember();

                    crew.CrewmemberId = dataReader.Int32Field(CrewMemberId).ToString();
                    crew.CrewmemberTypeId = dataReader.ByteField(CrewMemberTypeId).ToString();
                    crew.EmployeeNo = dataReader.StringField(EmployeeNo);
                    var hasAlert = dataReader.BooleanNullableField(HasAlert);
                    var hasMessage = dataReader.BooleanNullableField(HasMessage);
                    crew.HasAlert = hasAlert.HasValue ? hasAlert.Value : false;
                    crew.HasMessage = hasMessage.HasValue ? hasMessage.Value : false;
                    crew.Position = dataReader.StringField(Position);
                    crew.LastDateTime = dataReader.DateTimeNullableField(LastDateTime);
                    crew.LastEvent = dataReader.StringField(LastEvent);
                    crew.SafetyNumber = dataReader.StringField(SafetyNumber);
                    crew.SecurityPhotoAddress = dataReader.StringField(SecurityPhotoAddress);
                    crew.Stateroom = dataReader.StringField(Stateroom);
                    crew.StateroomOccupancy = dataReader.ByteField(StateroomOccupancy).ToString();
                    crew.Department = dataReader.StringField(Department);
                    crew.PortAssignedDate = dataReader.DateTimeNullableField(PortAssignedDate);

                    byte[] bytes = await crew.SecurityPhotoAddress.ImageAddressToByteArray();
                    crew.Photo = bytes.ToBitmapSource();
                    crew.AssignPhotoByteArray(new Collection<byte>(bytes));
                    crewmemberCollection.Add(crew);
                }
            }

            return crewmemberCollection;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:40,代码来源:PersonDataMapper.cs

示例2: MapVisitors

        /// <summary>
        /// Maps the visitors.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>The visitor collection</returns>
        private static async Task<VisitorCollection> MapVisitors(SqlDataReader dataReader)
        {
            var visitors = new VisitorCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var visitor = new Visitor
                    {
                        HasAlert = dataReader.BooleanNullableField(HasAlert).HasValue ? dataReader.BooleanNullableField(HasAlert).Value : false,
                        HasMessage = dataReader.BooleanNullableField(HasMessage).HasValue ? dataReader.BooleanNullableField(HasMessage).Value : false,
                        LastDateTime = dataReader.DateTimeNullableField(LastDateTime),
                        LastEvent = dataReader.StringField(LastEvent),
                        SecurityPhotoAddress = dataReader.StringField(SecurityPhotoAddress),
                        VisitorId = dataReader.Int32Field(VisitorId).ToString(),
                        VisitorTypeId = dataReader.ByteField(VisitorTypeId).ToString(),
                        VisitorType = dataReader.StringField(VisitorType),
                        VisitPurpose = dataReader.StringField(VisitPurpose)
                    };

                    byte[] bytes = await visitor.SecurityPhotoAddress.ImageAddressToByteArray();
                    visitor.Photo = bytes.ToBitmapSource();
                    visitor.AssignPhotoByteArray(new Collection<byte>(bytes));
                    visitors.Add(visitor);
                }
            }

            return visitors;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:34,代码来源:PersonDataMapper.cs

示例3: MapGuests

        /// <summary>
        /// Maps the guest personal detail.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Guest Collection.</returns>
        private static async Task<GuestCollection> MapGuests(SqlDataReader dataReader)
        {
            var guestCollection = new GuestCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var guest = new Guest();

                    guest.GuestId = dataReader.Int32Field(GuestId).ToString();
                    var hasAlert = dataReader.BooleanNullableField(HasAlert);
                    guest.HasAlert = hasAlert.HasValue ? hasAlert.Value : false;
                    var hasMessage = dataReader.BooleanNullableField(HasMessage);
                    guest.HasMessage = hasMessage.HasValue ? hasMessage.Value : false;
                    guest.LastDateTime = dataReader.DateTimeNullableField(LastDateTime);
                    guest.LastEvent = dataReader.StringField(LastEvent);
                    guest.SecurityPhotoAddress = dataReader.StringField(SecurityPhotoMediaItemAddress);

                    byte[] bytes = await guest.SecurityPhotoAddress.ImageAddressToByteArray();
                    guest.Photo = bytes.ToBitmapSource();
                    guest.AssignPhotoByteArray(new Collection<byte>(bytes));
                    guestCollection.Add(guest);
                }
            }

            return guestCollection;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:32,代码来源:PersonDataMapper.cs


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