本文整理汇总了C#中IDataRecord.GetInt16方法的典型用法代码示例。如果您正苦于以下问题:C# IDataRecord.GetInt16方法的具体用法?C# IDataRecord.GetInt16怎么用?C# IDataRecord.GetInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataRecord
的用法示例。
在下文中一共展示了IDataRecord.GetInt16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PasswordItem
public PasswordItem(IDataRecord reader)
{
Id = reader.GetInt16(0);
Url = reader[1].ToString();
Name = reader[2].ToString();
Email = reader[3].ToString();
Number = reader[4].ToString();
Password = reader[5].ToString();
Mark = reader[6].ToString();
}
示例2: GetDataFromReader
private static Bundesland GetDataFromReader(IDataRecord reader)
{
var bl = new Bundesland();
if (!Convert.IsDBNull(reader["BundeslandID"]))
{
bl.Id = reader.GetInt16(reader.GetOrdinal("BundeslandID"));
}
if (!Convert.IsDBNull(reader["Bundesland"]))
{
bl.Name = reader.GetString(reader.GetOrdinal("Bundesland"));
}
return bl;
}
示例3: GetDataFromReader
private static StationOld GetDataFromReader(IDataRecord reader)
{
var st = new StationOld();
if (!Convert.IsDBNull(reader["WSCODE"]))
{
st.WsCode = reader.GetInt16(reader.GetOrdinal("WSCODE"));
}
if (!Convert.IsDBNull(reader["WSTATI"]))
{
st.WStati = reader.GetInt16(reader.GetOrdinal("WSTATI"));
}
if (!Convert.IsDBNull(reader["WDIENS"]))
{
st.WDiens = reader.GetString(reader.GetOrdinal("WDIENS"));
}
if (!Convert.IsDBNull(reader["WDSORT"]))
{
st.WdsOrt = reader.GetString(reader.GetOrdinal("WDSORT"));
}
return st;
}
示例4: SafeInt
private static int? SafeInt(IDataRecord record, string fieldName)
{
var ordinal = record.GetOrdinal(fieldName);
return !record.IsDBNull(ordinal) ? record.GetInt16(ordinal) : (int?)null;
}
示例5: TryReadValues
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this ItemTemplateTable source, IDataRecord dataRecord)
{
for (var i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "action_display_id":
source.ActionDisplayID =
(Nullable<ActionDisplayID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "description":
source.Description = dataRecord.GetString(i);
break;
case "equipped_body":
source.EquippedBody = (dataRecord.IsDBNull(i) ? null : dataRecord.GetString(i));
break;
case "graphic":
source.Graphic = (GrhIndex)dataRecord.GetUInt16(i);
break;
case "height":
source.Height = dataRecord.GetByte(i);
break;
case "hp":
source.HP = dataRecord.GetInt16(i);
break;
case "id":
source.ID = (ItemTemplateID)dataRecord.GetUInt16(i);
break;
case "mp":
source.MP = dataRecord.GetInt16(i);
break;
case "name":
source.Name = dataRecord.GetString(i);
break;
case "range":
source.Range = dataRecord.GetUInt16(i);
break;
case "stat_agi":
source.SetStat(StatType.Agi, dataRecord.GetInt16(i));
break;
case "stat_defence":
source.SetStat(StatType.Defence, dataRecord.GetInt16(i));
break;
case "stat_int":
source.SetStat(StatType.Int, dataRecord.GetInt16(i));
break;
case "stat_maxhit":
source.SetStat(StatType.MaxHit, dataRecord.GetInt16(i));
break;
case "stat_maxhp":
source.SetStat(StatType.MaxHP, dataRecord.GetInt16(i));
break;
case "stat_maxmp":
source.SetStat(StatType.MaxMP, dataRecord.GetInt16(i));
break;
case "stat_minhit":
source.SetStat(StatType.MinHit, dataRecord.GetInt16(i));
break;
case "stat_req_agi":
source.SetReqStat(StatType.Agi, dataRecord.GetInt16(i));
break;
case "stat_req_int":
source.SetReqStat(StatType.Int, dataRecord.GetInt16(i));
break;
case "stat_req_str":
source.SetReqStat(StatType.Str, dataRecord.GetInt16(i));
break;
case "stat_str":
source.SetStat(StatType.Str, dataRecord.GetInt16(i));
break;
//.........这里部分代码省略.........
示例6: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this ItemTemplateTable source, IDataRecord dataRecord)
{
Int32 i;
i = dataRecord.GetOrdinal("action_display_id");
source.ActionDisplayID = (Nullable<ActionDisplayID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("description");
source.Description = dataRecord.GetString(i);
i = dataRecord.GetOrdinal("equipped_body");
source.EquippedBody = (dataRecord.IsDBNull(i) ? null : dataRecord.GetString(i));
i = dataRecord.GetOrdinal("graphic");
source.Graphic = (GrhIndex)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("height");
source.Height = dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("hp");
source.HP = dataRecord.GetInt16(i);
i = dataRecord.GetOrdinal("id");
source.ID = (ItemTemplateID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("mp");
source.MP = dataRecord.GetInt16(i);
i = dataRecord.GetOrdinal("name");
source.Name = dataRecord.GetString(i);
i = dataRecord.GetOrdinal("range");
source.Range = dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("stat_agi");
source.SetStat(StatType.Agi, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_defence");
source.SetStat(StatType.Defence, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_int");
source.SetStat(StatType.Int, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_maxhit");
source.SetStat(StatType.MaxHit, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_maxhp");
source.SetStat(StatType.MaxHP, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_maxmp");
source.SetStat(StatType.MaxMP, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_minhit");
source.SetStat(StatType.MinHit, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_req_agi");
source.SetReqStat(StatType.Agi, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_req_int");
source.SetReqStat(StatType.Int, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_req_str");
source.SetReqStat(StatType.Str, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_str");
source.SetStat(StatType.Str, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("type");
source.Type = (ItemType)dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("value");
//.........这里部分代码省略.........
示例7: ReadRank
Rank ReadRank( IDataRecord reader, Field field ) {
int rankId = reader.GetInt16( (int)field );
Rank result;
if( rankMapping.TryGetValue( rankId, out result ) ) {
return result;
} else {
return null;
}
}
示例8: TryReadValues
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this CharacterTable source, IDataRecord dataRecord)
{
for (var i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "ai_id":
source.AIID = (Nullable<AIID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "body_id":
source.BodyID = (BodyID)dataRecord.GetUInt16(i);
break;
case "cash":
source.Cash = dataRecord.GetInt32(i);
break;
case "character_template_id":
source.CharacterTemplateID =
(Nullable<CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "chat_dialog":
source.ChatDialog =
(Nullable<NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "exp":
source.Exp = dataRecord.GetInt32(i);
break;
case "hp":
source.HP = dataRecord.GetInt16(i);
break;
case "id":
source.ID = (CharacterID)dataRecord.GetInt32(i);
break;
case "level":
source.Level = dataRecord.GetByte(i);
break;
case "load_map_id":
source.LoadMapID = (MapID)dataRecord.GetUInt16(i);
break;
case "load_x":
source.LoadX = dataRecord.GetUInt16(i);
break;
case "load_y":
source.LoadY = dataRecord.GetUInt16(i);
break;
case "move_speed":
source.MoveSpeed = dataRecord.GetUInt16(i);
break;
case "mp":
source.MP = dataRecord.GetInt16(i);
break;
case "name":
source.Name = dataRecord.GetString(i);
break;
case "respawn_map_id":
source.RespawnMapID = (Nullable<MapID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "respawn_x":
source.RespawnX = dataRecord.GetFloat(i);
break;
case "respawn_y":
source.RespawnY = dataRecord.GetFloat(i);
break;
case "shop_id":
source.ShopID = (Nullable<ShopID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
break;
case "statpoints":
source.StatPoints = dataRecord.GetInt32(i);
break;
case "stat_agi":
source.SetStat(StatType.Agi, dataRecord.GetInt16(i));
//.........这里部分代码省略.........
示例9: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this CharacterTable source, IDataRecord dataRecord)
{
Int32 i;
i = dataRecord.GetOrdinal("ai_id");
source.AIID = (Nullable<AIID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("body_id");
source.BodyID = (BodyID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("cash");
source.Cash = dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("character_template_id");
source.CharacterTemplateID =
(Nullable<CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("chat_dialog");
source.ChatDialog = (Nullable<NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("exp");
source.Exp = dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("hp");
source.HP = dataRecord.GetInt16(i);
i = dataRecord.GetOrdinal("id");
source.ID = (CharacterID)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("level");
source.Level = dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("load_map_id");
source.LoadMapID = (MapID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("load_x");
source.LoadX = dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("load_y");
source.LoadY = dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("move_speed");
source.MoveSpeed = dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("mp");
source.MP = dataRecord.GetInt16(i);
i = dataRecord.GetOrdinal("name");
source.Name = dataRecord.GetString(i);
i = dataRecord.GetOrdinal("respawn_map_id");
source.RespawnMapID = (Nullable<MapID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("respawn_x");
source.RespawnX = dataRecord.GetFloat(i);
i = dataRecord.GetOrdinal("respawn_y");
source.RespawnY = dataRecord.GetFloat(i);
i = dataRecord.GetOrdinal("shop_id");
source.ShopID = (Nullable<ShopID>)(dataRecord.IsDBNull(i) ? (ushort?)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("statpoints");
source.StatPoints = dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("stat_agi");
source.SetStat(StatType.Agi, dataRecord.GetInt16(i));
i = dataRecord.GetOrdinal("stat_defence");
source.SetStat(StatType.Defence, dataRecord.GetInt16(i));
//.........这里部分代码省略.........
示例10: GetSmallInt
/// <summary>
/// Retrieves a SmallInt, or the specified null replacement.
/// </summary>
/// <param name="reader"></param>
/// <param name="ordinal"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
protected static int GetSmallInt(IDataRecord reader, int ordinal, int defaultValue)
{
return (reader[ordinal] != DBNull.Value) ? (int)reader.GetInt16(ordinal) : defaultValue;
}
示例11: GetInt16FromReader
/// <summary>
///
/// </summary>
/// <param name="reader">Record that holds values for evaluation.</param>
/// <param name="field">String name of the field to evaluate.</param>
/// <returns></returns>
public static Int16 GetInt16FromReader(IDataRecord reader, string field)
{
int index = reader.GetOrdinal(field);
if (!reader.IsDBNull(index))
{
return reader.GetInt16(index);
}
return 0;
}
示例12: GetInt16
/// <summary>
/// The method retrieve a value from the reader and cast it to <see cref="Int16"/> data type
/// In case the retrieved value is null, the returned value is <see cref="Int16.MinValue"/>
/// </summary>
/// <param name="dataReader">
/// The source for reading the data
/// </param>
/// <param name="index">
/// The index of the column containing the value
/// </param>
/// <returns>
/// The extracted value as <see cref="Int16"/>
/// </returns>
public static short GetInt16(IDataRecord dataReader, int index)
{
short ret = short.MinValue;
if (!dataReader.IsDBNull(index))
{
ret = dataReader.GetInt16(index);
}
return ret;
}
示例13: MakeNativeRow
private static void MakeNativeRow(StringBuilder sb, string colName, IDataRecord reader)
{
int charMaxLen = reader.IsDBNull(0) ? -1 : reader.GetInt32(0);
string dataType = reader.GetString(3);
int dateTimePrec = reader.IsDBNull(4) ? -1 : reader.GetInt16(4);
bool nullable = ("YES" == reader.GetString(5));
int numericPrec = reader.IsDBNull(6) ? -1 : reader.GetByte(6);
int numericScale = reader.IsDBNull(7) ? -1 : reader.GetInt32(7);
sb.Append(Indent);
sb.Append(colName);
sb.Append(' ');
sb.Append(NativeType(dataType, charMaxLen, dateTimePrec, numericPrec, numericScale).ToUpper());
if (!nullable)
{
sb.Append(" NOT");
}
sb.Append(" NULL");
}
示例14: SetData
protected void SetData(IDataRecord reader)
{
_RowID = reader.GetInt32("RowID");
_IsUsedInventory = reader.GetBoolean("IsUsedInventory");
_IsUsedOTS = reader.GetBoolean("IsUsedOTS");
_IsUsedFabricControl = reader.GetBoolean("IsUsedFabricControl");
_IsUsedWashing = reader.GetBoolean("IsUsedWashing");
_IsUsedFixedAssets = reader.GetBoolean("IsUsedFixedAssets");
_IsUsedPackPlan = reader.GetBoolean("IsUsedPackPlan");
_IsUsedProduction = reader.GetBoolean("IsUsedProduction");
_IsUsedCommercial = reader.GetBoolean("IsUsedCommercial");
_WillUseColorBreakDown = reader.GetBoolean("WillUseColorBreakDown");
_WeekDay = reader.GetInt16("WeekDay");
_WeekEndDay = reader.GetInt16("WeekEndDay");
_WillAllowMultiProductInOrder = reader.GetBoolean("WillAllowMultiProductInOrder");
_LocalFontName = reader.GetString("LocalFontName");
_WillEnterProductSegmentFromProductDef = reader.GetBoolean("WillEnterProductSegmentFromProductDef");
_WillEnterItemSegmentFromItemDef = reader.GetBoolean("WillEnterItemSegmentFromItemDef");
_MaxAllowedWorkingHrPerDay = reader.GetInt16("MaxAllowedWorkingHrPerDay");
_IsUsedHRMS = reader.GetBoolean("IsUsedHRMS");
_UseProductDefination = reader.GetBoolean("UseProductDefination");
_CanEditTemplatInPO = reader.GetBoolean("CanEditTemplatInPO");
_IsUsedSizeWiseDia = reader.GetBoolean("IsUsedSizeWiseDia");
_AllowSegmentCreationInCTM = reader.GetBoolean("AllowSegmentCreationInCTM");
_IsUsedSizeWiseConsumtion = reader.GetBoolean("IsUsedSizeWiseConsumtion");
_CompanyNature = reader.GetString("CompanyNature");
_UsePOAudit = reader.GetBoolean("UsePOAudit");
_DyeSubProcDep = reader.GetBoolean("DyeSubProcDep");
_UseKnitDyePlanner = reader.GetBoolean("UseKnitDyePlanner");
_IsUseMerchandisingMaping = reader.GetBoolean("IsUseMerchandisingMaping");
_WillUseSinglePOSingleStyle = reader.GetBoolean("WillUseSinglePOSingleStyle");
_CostingInPdnProcessSet = reader.GetBoolean("CostingInPdnProcessSet");
_WillEnterLengthInFinQc = reader.GetBoolean("WillEnterLengthInFinQc");
_ShowBuyersPOInPOSearchScreen = reader.GetBoolean("ShowBuyersPOInPOSearchScreen");
_GoodsReceiptBy = reader.GetString("GoodsReceiptBy");
_MentionAllColorSizeInMapping = reader.GetBoolean("MentionAllColorSizeInMapping");
_UseWebTNA = reader.GetBoolean("UseWebTNA");
_MaxShipDateInPdnRef = reader.GetBoolean("MaxShipDateInPdnRef");
_AllowStaggeredDeliveryDateFromPdnRef = reader.GetBoolean("AllowStaggeredDeliveryDateFromPdnRef");
_isSizeFilterable = reader.GetBoolean("isSizeFilterable");
_UsedSegmentSensitivityInTemplate = reader.GetBoolean("UsedSegmentSensitivityInTemplate");
}
示例15: ReadFrom
public static void ReadFrom(this ICdlValueWriter writer, IDataRecord record, int index)
{
if (record.IsDBNull(index))
{
writer.SetNull();
return;
}
Type type = record.GetFieldType(index);
try
{
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
writer.SetBoolean(record.GetBoolean(index));
break;
case TypeCode.Byte:
writer.SetByte(record.GetByte(index));
break;
case TypeCode.Int16:
writer.SetInt16(record.GetInt16(index));
break;
case TypeCode.Int32:
writer.SetInt32(record.GetInt32(index));
break;
case TypeCode.Int64:
writer.SetInt64(record.GetInt64(index));
break;
case TypeCode.SByte:
unchecked
{
writer.SetSByte((sbyte) record.GetByte(index));
}
break;
case TypeCode.UInt16:
unchecked
{
writer.SetUInt16((ushort) record.GetInt16(index));
}
break;
case TypeCode.UInt32:
unchecked
{
writer.SetUInt32((uint) record.GetInt32(index));
}
break;
case TypeCode.UInt64:
unchecked
{
writer.SetUInt64((ulong) record.GetInt64(index));
}
break;
case TypeCode.DateTime:
writer.SetDateTime(record.GetDateTime(index));
break;
case TypeCode.Decimal:
writer.SetDecimal(record.GetDecimal(index));
break;
case TypeCode.Single:
writer.SetFloat(record.GetFloat(index));
break;
case TypeCode.Double:
writer.SetDouble(record.GetDouble(index));
break;
case TypeCode.String:
writer.SetString(record.GetString(index));
break;
default:
if (type == typeof (Guid))
{
writer.SetGuid(record.GetGuid(index));
}
else if (type == typeof (byte[]))
{
writer.SetByteArray((byte[]) record.GetValue(index));
}
else
{
writer.SetString(record.GetValue(index).ToString());
}
break;
}
}
catch (Exception err)
{
try
{
object val = record[index];
// try to read from boxed value (not very effective)
writer.ReadFrom(val);
}
catch
{
try
{
writer.SetString(record.GetString(index));
}
catch
{
// add information to exception
try
//.........这里部分代码省略.........