本文整理汇总了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;
}
示例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;
}
示例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;
}