本文整理汇总了C#中IDataReader.GetDecimal方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetDecimal方法的具体用法?C# IDataReader.GetDecimal怎么用?C# IDataReader.GetDecimal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.GetDecimal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEnity
public ProcedureCost CreateEnity(ProcedureOccurrence procedure, IDataReader reader)
{
var paidCopay = reader.GetDecimal(PaidCopay);
var paidCoinsurance = reader.GetDecimal(PaidCoinsurance);
var paidTowardDeductible = reader.GetDecimal(PaidTowardDeductible);
long? revenueCodeConceptId = null;
string revenueCodeSource = null;
long? diseaseClassConceptId = null;
var diseaseClassSource = "";
var revenueCodeConcept = Concepts[0];
if (revenueCodeConcept.Fields.Length > 0)
{
revenueCodeSource = reader[revenueCodeConcept.Fields[0].Key].ToString().Trim();
var revenueConcepts = revenueCodeConcept.GetValues(Vocabulary, revenueCodeConcept.Fields[0], reader);
if(revenueConcepts.Count > 0)
revenueCodeConceptId = revenueConcepts[0].ConceptId;
}
string diseaseClassLookupKey = null;
if (Concepts.Length == 2)
{
var diseaseClassConcept = Concepts[1];
diseaseClassSource = reader[diseaseClassConcept.Fields[0].Key].ToString().Trim();
var diseaseConcepts = diseaseClassConcept.GetValues(Vocabulary, diseaseClassConcept.Fields[0], reader);
if (diseaseConcepts.Count > 0)
diseaseClassConceptId = diseaseConcepts[0].ConceptId;
diseaseClassLookupKey = diseaseClassConcept.GetConceptIdLookupKey(reader);
}
return new ProcedureCost(procedure)
{
PaidCopay = paidCopay,
PaidCoinsurance = paidCoinsurance,
PaidTowardDeductible = paidTowardDeductible,
PaidByPayer = reader.GetDecimal(PaidByPayer),
PaidByCoordinationBenefits = reader.GetDecimal(PaidByCoordinationBenefits),
TotalPaid = reader.GetDecimal(TotalPaid),
TotalOutOfPocket = paidCopay + paidCoinsurance + paidTowardDeductible,
RevenueCodeConceptId = revenueCodeConceptId,
RevenueCodeSourceValue = revenueCodeSource,
DiseaseClassConceptId = diseaseClassConceptId,
DiseaseClassSourceValue = diseaseClassSource,
DiseaseClassLookupKey = diseaseClassLookupKey
};
}
示例2: mCargarProd
private static EProdXUnd mCargarProd(IDataReader rdr)
{
EProdXUnd oProd = new EProdXUnd();
//oProd.Id_producto = rdr.IsDBNull(rdr.GetOrdinal("id_producto")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("id_producto"));
oProd.Id_prodprese = rdr.IsDBNull(rdr.GetOrdinal("id_prodprese")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("id_prodprese"));
oProd.Ds_prodprese = rdr.IsDBNull(rdr.GetOrdinal("ds_prodprese")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("ds_prodprese"));
oProd.Nu_uniprese = rdr.IsDBNull(rdr.GetOrdinal("nu_uniprese")) ? 0 : rdr.GetInt16(rdr.GetOrdinal("nu_uniprese"));
oProd.Nu_umprese = rdr.IsDBNull(rdr.GetOrdinal("nu_umprese")) ? 0 : rdr.GetInt16(rdr.GetOrdinal("nu_umprese"));
oProd.Qt_pesoneto = rdr.IsDBNull(rdr.GetOrdinal("qt_pesoneto")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("qt_pesoneto"));
oProd.Qt_pesobruto = rdr.IsDBNull(rdr.GetOrdinal("qt_pesobruto")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("qt_pesobruto"));
oProd.Mt_precio = rdr.IsDBNull(rdr.GetOrdinal("mt_precio")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("mt_precio"));
//oProd.St_anulado = rdr.IsDBNull(rdr.GetOrdinal("st_anulado")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("st_anulado"));
return oProd;
}
示例3: SeatPrice
public SeatPrice(IDataReader reader)
{
ID = reader.GetInt32(reader.GetOrdinal("id"));
seat = reader.GetInt32(reader.GetOrdinal("seat"));
flight = reader.GetInt32(reader.GetOrdinal("flight"));
price = reader.GetDecimal(reader.GetOrdinal("price"));
}
示例4: CreateRowFromReader
protected override Row CreateRowFromReader(IDataReader reader)
{
GetSchemaTable(reader);
Row r = new Row();
for (int i = 0; i < reader.FieldCount; i++)
{
Type fType = reader.GetFieldType(i);
if (fType == typeof(System.Decimal))
{
object o = reader.GetValue(i);
if (o != DBNull.Value)
{
string d = reader.GetValue(i).ToString();
//short scale = (short)SchemaTable.Rows[i].[4];
short scale = (short)SchemaTable.Rows[i].Field<short>("NumericPrecision");
decimal res = reader.GetDecimal(i);
if (scale > 0)
res = res / (int)(Math.Pow(10.0, scale));
r[reader.GetName(i)] = res;
}
else
r[reader.GetName(i)] = DBNull.Value;
}
else
{
r[reader.GetName(i)] = reader.GetValue(i);
}
}
return r;
}
示例5: createNewCharacter
public UInt32 createNewCharacter(string handle, UInt32 userid, UInt32 worldId)
{
conn.Open();
UInt32 charId = 0;
//TODO: Complete with real data from a hashtable (or something to do it faster);
//TODO: find values for uria starting place
string sqlInsertQuery="INSERT INTO characters SET userid = '" + userid.ToString() + "', worldid='" + worldId.ToString() + "', status='0', handle = '" + handle + "', created=NOW() ";
queryExecuter= conn.CreateCommand();
queryExecuter.CommandText = sqlInsertQuery;
queryExecuter.ExecuteNonQuery();
//As i didnt find a solution for "last_insert_id" in C# we must fetch the last row by a normal query
string sqlQuery = "SELECT charId FROM characters WHERE userId='" + userid.ToString() + "' AND worldId='" + worldId.ToString() + "' AND is_deleted='0' ORDER BY charId DESC LIMIT 1";
queryExecuter = conn.CreateCommand();
queryExecuter.CommandText = sqlQuery;
dr = queryExecuter.ExecuteReader();
while (dr.Read())
{
charId = (UInt32)dr.GetDecimal(0);
}
conn.Close();
// Create RSI Entry
conn.Open();
string sqlRSIQuery = "INSERT INTO rsivalues SET charid='" + charId.ToString() + "' ";
queryExecuter = conn.CreateCommand();
queryExecuter.CommandText = sqlRSIQuery;
queryExecuter.ExecuteNonQuery();
conn.Close();
return charId;
}
示例6: GetDecimal
public static decimal GetDecimal(IDataReader dr, string columnName)
{
int ordinal = dr.GetOrdinal(columnName);
bool isDbNull = dr.IsDBNull(ordinal);
return isDbNull ? decimal.Zero : dr.GetDecimal(ordinal);
}
示例7: GetValueByIndex
/// <summary>
/// Gets a column value by the index
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
/// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
if (dataReader.IsDBNull(mapping.ColumnIndex))
{
return DBNull.Value;
}
return dataReader.GetDecimal(mapping.ColumnIndex);
}
示例8: GetValueByName
/// <summary>
/// Gets a column value by the name
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
/// <returns></returns>
public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
{
int index = dataReader.GetOrdinal(mapping.ColumnName);
if (dataReader.IsDBNull(index))
{
return DBNull.Value;
}
return new decimal?( dataReader.GetDecimal(index) );
}
示例9: AddRecord
public override void AddRecord(IDataReader reader)
{
var prodcode = reader.GetInt("prodcode");
var ndd = reader.GetDecimal("ndd");
var quantity = reader.GetDecimal("qty");
var numpacks = reader.GetInt("numpacks");
var dayssupply = reader.GetInt("numdays");
if (prodcode.HasValue && dayssupply.HasValue)
{
var key = CompositeKeyHelper.GetCprdDaysSupplyKey(prodcode.Value, ndd, quantity, numpacks);
if (!lookup.ContainsKey(key))
{
lookup.Add(key, dayssupply.Value);
}
}
}
示例10: ReadMovie
public static Movie ReadMovie(IDataReader reader)
{
Movie movie = new Movie();
movie.ID = reader.GetInt32(0);
movie.Title = reader.GetString(1);
movie.ReleaseDate = reader.GetDateTime(2).Date;
movie.Genre = reader.GetString(3);
movie.Price = reader.GetDecimal(4);
return movie;
}
示例11: mCargarTJD
private static ETejeduria_DetMall mCargarTJD(IDataReader rdr)
{
ETejeduria_DetMall oTJ = new ETejeduria_DetMall();
//oTJ.Id_producto = rdr.IsDBNull(rdr.GetOrdinal("id_producto")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("id_producto"));
//oTJ.Nu_correficha = rdr.IsDBNull(rdr.GetOrdinal("nu_correficha")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_correficha"));
oTJ.Nu_secuen = rdr.IsDBNull(rdr.GetOrdinal("nu_secuen")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_secuen"));
oTJ.Nu_item = rdr.IsDBNull(rdr.GetOrdinal("nu_item")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_item"));
oTJ.Nu_longmalla = rdr.IsDBNull(rdr.GetOrdinal("nu_longmalla")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("nu_longmalla"));
oTJ.St_anulado = rdr.IsDBNull(rdr.GetOrdinal("st_anulado")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("st_anulado"));
return oTJ;
}
示例12: CreateCurrencyRate
private static CurrencyRate CreateCurrencyRate(IDataReader reader)
{
Requires.NotNull(reader, "reader");
return new CurrencyRate
{
Name = reader.GetString(reader.GetOrdinal("Cur_QuotName")),
RussianAlfaCode = reader.GetString(reader.GetOrdinal("Cur_Abbreviation")),
RussianNumberCode = reader.GetString(reader.GetOrdinal("Cur_Code")),
Rate = reader.GetDecimal(reader.GetOrdinal("Cur_OfficialRate")),
Scale = reader.GetInt32(reader.GetOrdinal("Cur_Scale"))
};
}
示例13: NullSafeGet
public object NullSafeGet(IDataReader resultSet,
string[] names,
object owner)
{
int index0 = resultSet.GetOrdinal(names[0]);
int index1 = resultSet.GetOrdinal(names[1]);
if (resultSet.IsDBNull(index0))
{
return null;
}
decimal value = resultSet.GetDecimal(index0);
string cur = resultSet.GetString(index1);
return new MonetaryAmount(value, cur);
}
示例14: CreateEnity
public DrugCost CreateEnity(DrugExposure drugExposure, IDataReader reader)
{
var paidCopay = reader.GetDecimal(PaidCopay);
var paidCoinsurance = reader.GetDecimal(PaidCoinsurance);
var paidTowardDeductible = reader.GetDecimal(PaidTowardDeductible);
return new DrugCost(drugExposure)
{
PaidCopay = paidCopay,
PaidCoinsurance = paidCoinsurance,
PaidTowardDeductible = paidTowardDeductible,
PaidByPayer = reader.GetDecimal(PaidByPayer),
PaidByCoordinationBenefits = reader.GetDecimal(PaidByCoordinationBenefits),
TotalPaid = reader.GetDecimal(TotalPaid),
IngredientCost = reader.GetDecimal(IngredientCost),
DispensingFee = reader.GetDecimal(DispensingFee),
AverageWholesalePrice = reader.GetDecimal(AverageWholesalePrice),
TotalOutOfPocket = paidCopay + paidCoinsurance + paidTowardDeductible
};
}
示例15: CreateCategoriesFromReader
private static Book CreateCategoriesFromReader(IDataReader reader)
{
var item = new Book
{
Id = reader.GetInt32(0),
Name = reader.GetString(1),
Description = reader.GetString(2),
UnitPrice = reader.GetDecimal(3),
Author = reader.GetString(4),
Isbn = reader.GetString(5),
Pages = reader.GetInt32(6)
};
return item;
}