本文整理汇总了C#中System.Data.SqlClient.SqlDataReader.Int32Field方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataReader.Int32Field方法的具体用法?C# SqlDataReader.Int32Field怎么用?C# SqlDataReader.Int32Field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlDataReader
的用法示例。
在下文中一共展示了SqlDataReader.Int32Field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapPersonIds
/// <summary>
/// Maps the person ids.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>returns personIds</returns>
internal static async Task<string> MapPersonIds(SqlDataReader dataReader)
{
var personIdList = string.Empty;
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var personId = dataReader.Int32Field(PersonId);
personIdList = string.Concat(personIdList, personId, CommaSeparator);
}
if (!dataReader.IsClosed)
{
dataReader.Close();
}
}
return personIdList;
}
示例2: MapMediaItemAddress
/// <summary>
/// Maps the specified data reader.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Media Item Address</returns>
internal static async Task<string> MapMediaItemAddress(SqlDataReader dataReader)
{
var mediaItemAddress = string.Empty;
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var mediaItemId = dataReader.Int32Field(MediaItemId).ToString();
var baseAddress = dataReader.StringField(Mediapath);
mediaItemAddress = string.Concat(mediaItemId, CommonConstants.Comma, baseAddress);
}
if (!dataReader.IsClosed)
{
dataReader.Close();
}
}
return await Task.FromResult(mediaItemAddress);
}
示例3: MapLoyaltyLevelTypes
/// <summary>
/// Maps the loyalty level types.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Loyalty level types</returns>
private static async Task<LoyaltyLevelTypeCollection> MapLoyaltyLevelTypes(SqlDataReader dataReader)
{
var loyaltyLevelTypeCollection = new LoyaltyLevelTypeCollection();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var loyaltyLevelType = new LoyaltyLevelType
{
LoyaltyLevelTypeId = dataReader.Int32Field(LoyaltyLevelTypeId).ToString(),
NoOfCruiseNights = dataReader.Int32Field(NoOfCruiseNights),
Name = dataReader.StringField(Name),
LogoImageAddress = dataReader.StringField(LogoImageAddress),
BrandId = dataReader.Int16Field(BrandId).ToString()
};
byte[] bytes = await loyaltyLevelType.LogoImageAddress.ImageAddressToByteArray();
loyaltyLevelType.LoyaltyIcon = bytes.ToBitmapSource();
loyaltyLevelTypeCollection.Add(loyaltyLevelType);
}
}
return loyaltyLevelTypeCollection;
}
示例4: MapAlert
/// <summary>
/// Maps the alerts.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Alert object.</returns>
private static Alert MapAlert(SqlDataReader dataReader)
{
return new Alert
{
AlertId = dataReader.Int32Field(AlertId).ToString(CultureInfo.CurrentCulture),
AlertType = dataReader.StringField(AlertType),
IsDenyAshore = dataReader.BooleanField(IsDenyAshore),
IsDenyOnboard = dataReader.BooleanField(IsDenyOnboard),
IsOverride = dataReader.BooleanField(IsOverride),
IsSoundEnable = dataReader.BooleanField(IsSoundEnable),
AddedDateTime = dataReader.DateTimeField(AddedDate)
};
}
示例5: MapPersonStatus
/// <summary>
/// Maps the person status.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Person Status List.</returns>
internal static async Task<List<PersonStatus>> MapPersonStatus(SqlDataReader dataReader)
{
var personStatusList = new List<PersonStatus>();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var personStatus = new PersonStatus();
personStatus.PersonId = dataReader.Int32Field(PersonId);
personStatus.Status = dataReader.StringField(Status);
personStatus.StatusChangedDate = dataReader.DateTimeNullableField(StatusChangedDate);
personStatusList.Add(personStatus);
}
if (!dataReader.IsClosed)
{
dataReader.Close();
}
}
return personStatusList;
}
示例6: RetrieveCrewmemberPersonalDetail
/// <summary>
/// Maps the crew personal detail.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>The crew member</returns>
private static async Task<CrewmemberCollection> RetrieveCrewmemberPersonalDetail(SqlDataReader dataReader)
{
var crewmembers = new CrewmemberCollection();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var crewmember = new Crewmember();
crewmember.CrewmemberId = dataReader.Int32Field(CrewMemberId).ToString();
crewmember.PersonalDetail = new PersonalDetail();
crewmember.PersonalDetail.Age = dataReader.Int16NullableField(Age);
crewmember.PersonalDetail.AnniversaryDate = dataReader.DateTimeNullableField(AnniversaryDate);
crewmember.PersonalDetail.BirthCountryId = dataReader.Int32NullableField(BirthCountryId).ToString();
crewmember.PersonalDetail.Birthdate = dataReader.DateTimeNullableField(BirthDate);
crewmember.PersonalDetail.CitizenshipCountryId = dataReader.Int32NullableField(CitizenshipCountryId).ToString();
crewmember.PersonalDetail.FirstName = dataReader.StringField(FirstName);
crewmember.PersonalDetail.Gender = dataReader.StringField(Gender);
crewmember.PersonalDetail.LastName = dataReader.StringField(LastName);
crewmember.PersonalDetail.MaritalStatus = dataReader.StringField(MaritalStatus);
crewmember.PersonalDetail.MiddleName = dataReader.StringField(MiddleName);
crewmember.PersonalDetail.Nickname = dataReader.StringField(NickName);
crewmember.PersonalDetail.Occupation = dataReader.StringField(Occupation);
crewmember.PersonalDetail.DocumentNumber = dataReader.StringField(DocumentNumber);
crewmember.PersonalDetail.Suffix = dataReader.StringField(Suffix);
crewmember.PersonalDetail.Title = dataReader.StringField(Title);
crewmember.PersonalDetail.PreferredName = dataReader.StringField(PreferredName);
crewmember.BoardingInfo.OnboardDate = dataReader.DateTimeNullableField(OnboardDate);
crewmember.BoardingInfo.AshoreDate = dataReader.DateTimeNullableField(AshoreDate);
crewmembers.Add(crewmember);
}
}
return crewmembers;
}
示例7: 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;
}
示例8: 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;
}
示例9: RetrieveGuestPersonalDetail
/// <summary>
/// Retrieves the guest personal detail.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Guest Collection.</returns>
private static async Task<GuestCollection> RetrieveGuestPersonalDetail(SqlDataReader dataReader)
{
var guestCollection = new GuestCollection();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var guest = new Guest();
guest.GuestId = dataReader.Int32Field(GuestId).ToString();
guest.PersonalDetail = new PersonalDetail();
guest.PersonalDetail.Title = dataReader.StringField(Title);
guest.PersonalDetail.FirstName = dataReader.StringField(FirstName);
guest.PersonalDetail.MiddleName = dataReader.StringField(MiddleName);
guest.PersonalDetail.LastName = dataReader.StringField(LastName);
guest.PersonalDetail.Nickname = dataReader.StringField(NickName);
guest.PersonalDetail.PreferredName = dataReader.StringField(PreferredName);
guest.PersonalDetail.Suffix = dataReader.StringField(Suffix);
guest.PersonalDetail.Birthdate = dataReader.DateTimeNullableField(BirthDate);
guest.PersonalDetail.BirthCountryId = dataReader.Int32NullableField(BirthCountryId).HasValue ? dataReader.Int32NullableField("BirthCountryID").Value.ToString() : null;
guest.PersonalDetail.CitizenshipCountryId = dataReader.Int32NullableField(CitizenshipCountryId).HasValue ? dataReader.Int32NullableField("BirthCountryID").Value.ToString() : null;
guest.PersonalDetail.Gender = dataReader.StringField(Gender);
guest.PersonalDetail.MaritalStatus = dataReader.StringField(MaritalStatus);
guest.PersonalDetail.Occupation = dataReader.StringField(Occupation);
guest.PersonalDetail.AnniversaryDate = dataReader.DateTimeNullableField(AnniversaryDate);
guest.PersonalDetail.DocumentNumber = dataReader.StringField(DocumentNumber);
guest.PersonalDetail.Age = dataReader.Int16Field(Age);
guest.PersonalDetail.SourceId = dataReader.StringField(SourceId);
guestCollection.Add(guest);
}
}
return guestCollection;
}
示例10: MapVoyageItinerary
/// <summary>
/// Maps the voyage itinerary.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>Voyage Itinerary</returns>
private static Itinerary MapVoyageItinerary(SqlDataReader dataReader)
{
return new Itinerary
{
VoyageItineraryId = dataReader.Int32Field(VoyageItineraryId).ToString(CultureInfo.CurrentCulture),
PortId = dataReader.Int32Field(PortId).ToString(CultureInfo.CurrentCulture),
ArrivalTime = dataReader.DateTimeNullableField(ArrivalTime),
GangwayClosingTime = dataReader.DateTimeNullableField(GangwayClosingTime),
GangwayOpeningTime = dataReader.DateTimeNullableField(GangwayOpeningTime),
DepartureTime = dataReader.DateTimeNullableField(DepartureTime),
Day = dataReader.ByteField(Day),
IsSeaDay = dataReader.BooleanField(IsSeaDay)
};
}
示例11: MapVoyages
/// <summary>
/// Maps the voyages.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>The Collection of voyages</returns>
private static async Task<ICollection<Voyage>> MapVoyages(SqlDataReader dataReader)
{
var voyages = new Collection<Voyage>();
IDictionary<string, ICollection<Itinerary>> itineraries = new Dictionary<string, ICollection<Itinerary>>();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var voyage = new Voyage
{
VoyageId = dataReader.Int32Field(VoyageId).ToString(),
ShipId = dataReader.ByteField(ShipId).ToString(),
Number = dataReader.StringField(Number),
Name = dataReader.StringField(Name),
EmbarkDate = dataReader.DateTimeField(EmbarkDate),
DebarkDate = dataReader.DateTimeField(DebarkDate),
EmbarkPortId = dataReader.Int32Field(EmbarkPortId).ToString(),
DebarkPortId = dataReader.Int32Field(DebarkPortId).ToString(),
Nights = dataReader.ByteField(Nights),
DestinationId = dataReader.StringField(DestinationName),
IsActive = dataReader.BooleanField(IsActive),
MediaItemAddress = dataReader.StringField(MediaItemAddress)
};
byte[] bytes = await voyage.MediaItemAddress.ImageAddressToByteArray();
voyage.ItineraryGraphImage = bytes.ToBitmapSource();
voyages.Add(voyage);
}
}
return voyages;
}
示例12: MapGangwayLocations
/// <summary>
/// Maps the gangway locations.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>The collection of gangway location</returns>
private static async Task<ICollection<GangwayLocation>> MapGangwayLocations(SqlDataReader dataReader)
{
var gangwayLocations = new Collection<GangwayLocation>();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var gangwayLocation = new GangwayLocation
{
LocationId = dataReader.Int32Field(LocationId).ToString(),
LocationTypeId = dataReader.ByteField(LocationTypeId).ToString(),
Name = dataReader.StringField(Name)
};
gangwayLocations.Add(gangwayLocation);
}
}
return gangwayLocations.OrderBy(a => a.Name).ToList();
}
示例13: MapBrandPorts
/// <summary>
/// Maps the brand ports.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>brand and Port dictionary.</returns>
private static async Task<IDictionary<int, Collection<int>>> MapBrandPorts(SqlDataReader dataReader)
{
var dictionary = new Dictionary<int, Collection<int>>();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var brandId = dataReader.ByteField(BrandId);
var portId = dataReader.Int32Field(PortId);
if (!dictionary.ContainsKey(brandId))
{
var strTest = new Collection<int>();
if (portId != default(int))
{
strTest.Add(portId);
}
dictionary.Add(brandId, strTest);
}
else
{
var val = dictionary[brandId];
if (portId != default(int))
{
val.Add(portId);
}
}
}
}
return dictionary;
}
示例14: MapStates
/// <summary>
/// Maps the states.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>State collection.</returns>
private static async Task<StateCollection> MapStates(SqlDataReader dataReader)
{
var stateCollection = new StateCollection();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var state = new State
{
CountryId = dataReader.Int32Field(CountryId).ToString(),
StateId = dataReader.Int32Field(StateId).ToString(),
Name = dataReader.StringField(Name)
};
stateCollection.Add(state);
}
}
return stateCollection;
}
示例15: MapPorts
/// <summary>
/// Maps the ports.
/// </summary>
/// <param name="dataReader">The data reader.</param>
/// <returns>port collection.</returns>
private static async Task<PortCollection> MapPorts(SqlDataReader dataReader)
{
var portCollection = new PortCollection();
if (dataReader != null)
{
while (await dataReader.ReadAsync())
{
var port = new Port
{
PortId = dataReader.Int32Field(PortId).ToString(),
CountryId = dataReader.Int32Field(CountryId).ToString(),
Code = dataReader.StringField(Code),
City = dataReader.StringField(City),
State = dataReader.StringField(State),
StateId = dataReader.Int32NullableField(StateId).ToString(),
Description = dataReader.StringField(Description),
Name = dataReader.StringField(Name)
};
portCollection.Add(port);
}
}
return portCollection;
}