本文整理汇总了C#中IHeader.AddSource方法的典型用法代码示例。如果您正苦于以下问题:C# IHeader.AddSource方法的具体用法?C# IHeader.AddSource怎么用?C# IHeader.AddSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHeader
的用法示例。
在下文中一共展示了IHeader.AddSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateHeaderLocalisedStrings
/// <summary>
/// This method populates the Localized Strings (Names, Sources) of a <see cref="IHeader"/>
/// </summary>
/// <param name="mappingStoreDb">
/// The <see cref="Database"/> instance for Mapping Store database
/// </param>
/// <param name="headerSysId">
/// The header system identifier. In the database the column HEADER.HEADER_ID
/// </param>
/// <param name="header">
/// The <see cref="IHeader"/> to be populated in terms of Names and Sources
/// </param>
private static void PopulateHeaderLocalisedStrings(Database mappingStoreDb, long headerSysId, IHeader header)
{
string paramId = mappingStoreDb.BuildParameterName(ParameterNameConstants.IdParameter);
var sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT HLS.HLS_ID, HLS.TYPE, HLS.HEADER_ID, HLS.PARTY_ID, HLS.CONTACT_ID, HLS.LANGUAGE, HLS.TEXT ");
sqlCommand.Append("FROM HEADER_LOCALISED_STRING HLS ");
sqlCommand.AppendFormat("WHERE HLS.HEADER_ID = {0} ", paramId);
using (DbCommand command = mappingStoreDb.GetSqlStringCommand(sqlCommand.ToString()))
{
mappingStoreDb.AddInParameter(command, ParameterNameConstants.IdParameter, DbType.Int64, headerSysId);
using (IDataReader dataReader = mappingStoreDb.ExecuteReader(command))
{
while (dataReader.Read())
{
var text = new TextTypeWrapperMutableCore { Locale = DataReaderHelper.GetString(dataReader, "LANGUAGE"), Value = DataReaderHelper.GetString(dataReader, "TEXT") };
string textType = DataReaderHelper.GetString(dataReader, "TYPE");
// is it a sender or a receiver?
if (textType.Equals(NameText, StringComparison.OrdinalIgnoreCase))
{
header.AddName(new TextTypeWrapperImpl(text, null));
}
else
{
if (textType.Equals(SourceText, StringComparison.OrdinalIgnoreCase))
{
header.AddSource(new TextTypeWrapperImpl(text, null));
}
}
}
}
}
}