本文整理汇总了C#中IMaintainableRefObject.SplitVersion方法的典型用法代码示例。如果您正苦于以下问题:C# IMaintainableRefObject.SplitVersion方法的具体用法?C# IMaintainableRefObject.SplitVersion怎么用?C# IMaintainableRefObject.SplitVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMaintainableRefObject
的用法示例。
在下文中一共展示了IMaintainableRefObject.SplitVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHeader
/// <summary>
/// This method queries the mapping store for header information for a specific dataflow
/// </summary>
/// <param name="beginDate">For ReportingBegin element</param>
/// <param name="endDate">For ReportingEnd element</param>
/// <param name="dataflowReference">The dataflow reference.</param>
/// <returns>
/// A <see cref="IHeader" /> object. Otherwise null
/// </returns>
private IHeader GetHeader(DateTime? beginDate, DateTime? endDate, IMaintainableRefObject dataflowReference)
{
long headerSysId;
string paramId = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.IdParameter);
string version1 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter1);
string version2 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter2);
string version3 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter3);
string agency = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.AgencyParameter);
var sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT HD.HEADER_ID, HD.TEST, HD.DATASET_AGENCY, HD.DF_ID ");
sqlCommand.Append("FROM HEADER HD, DATAFLOW DF, ARTEFACT ART ");
sqlCommand.Append("WHERE HD.DF_ID = DF.DF_ID ");
sqlCommand.Append("AND DF.DF_ID = ART.ART_ID ");
sqlCommand.AppendFormat("AND ART.ID = {0} ", paramId);
sqlCommand.AppendFormat("AND dbo.isEqualVersion(ART.VERSION1,ART.VERSION2,ART.VERSION3,{0},{1},{2})=1 ", version1, version2, version3);
sqlCommand.AppendFormat("AND ART.AGENCY = {0} ", agency);
IDictionary<string, string> additionalAttributes = new Dictionary<string, string>(StringComparer.Ordinal);
bool test;
DateTime currentDate = DateTime.Now;
var dataflowId = dataflowReference.MaintainableId;
var dataflowAgency = dataflowReference.AgencyId;
var version = dataflowReference.SplitVersion(3);
using (DbCommand command = this._mappingStoreDb.GetSqlStringCommand(sqlCommand.ToString()))
{
this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.IdParameter, DbType.String, dataflowId);
this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter1, DbType.Int64, version[0].HasValue ? version[0].Value : 0);
this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter2, DbType.Int64, version[1].HasValue ? version[1].Value : 0);
this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter3, DbType.Int64, version[2].HasValue ? (object)version[2].Value : null);
this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.AgencyParameter, DbType.String, dataflowAgency);
using (IDataReader dataReader = this._mappingStoreDb.ExecuteReader(command))
{
// we expect only 1 record here
if (dataReader.Read())
{
headerSysId = DataReaderHelper.GetInt64(dataReader, "HEADER_ID");
test = DataReaderHelper.GetBoolean(dataReader, "TEST");
additionalAttributes.Add("DataSetAgency", DataReaderHelper.GetString(dataReader, "DATASET_AGENCY"));
_log.DebugFormat(CultureInfo.InvariantCulture, "Found header information in mapping store for Dataflow {0}", dataflowId);
}
else
{
_log.DebugFormat(CultureInfo.InvariantCulture, "No header information found in mapping store for Dataflow {0}", dataflowId);
return null;
}
}
}
string datasetId = BuildDatasetId(dataflowId, currentDate);
// DatasetAction: Information (case that is response to a query)
DatasetAction datasetAction = DatasetAction.GetAction("Information");
IHeader ret = new HeaderImpl(additionalAttributes, null, null, datasetAction, dataflowId, datasetId, null, currentDate, currentDate, beginDate, endDate, null, null, null, null, test);
PopulateHeaderLocalisedStrings(this._mappingStoreDb, headerSysId, ret);
PoulateHeaderSendersAndReceivers(this._mappingStoreDb, headerSysId, ret);
if (ret.Sender != null)
{
DateTime extracted = ret.Extracted.HasValue ? ret.Extracted.Value : currentDate;
ret.DatasetId = BuildDatasetId(ret.Id, extracted, ret.Sender.Id);
}
return ret;
}