本文整理汇总了C#中IUpdateContext.GetBroker方法的典型用法代码示例。如果您正苦于以下问题:C# IUpdateContext.GetBroker方法的具体用法?C# IUpdateContext.GetBroker怎么用?C# IUpdateContext.GetBroker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUpdateContext
的用法示例。
在下文中一共展示了IUpdateContext.GetBroker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExecute
protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
{
// Update StudyStatusEnum in the StudyStorageTable
IStudyStorageEntityBroker studyStorageUpdate = updateContext.GetBroker<IStudyStorageEntityBroker>();
StudyStorageUpdateColumns studyStorageUpdateColumns = new StudyStorageUpdateColumns();
studyStorageUpdateColumns.StudyStatusEnum = _newStatus;
studyStorageUpdate.Update(_location.Key, studyStorageUpdateColumns);
// Update ServerTransferSyntaxGUID in FilesystemStudyStorage
IFilesystemStudyStorageEntityBroker filesystemUpdate = updateContext.GetBroker<IFilesystemStudyStorageEntityBroker>();
FilesystemStudyStorageUpdateColumns filesystemUpdateColumns = new FilesystemStudyStorageUpdateColumns();
filesystemUpdateColumns.ServerTransferSyntaxKey = _newSyntax.Key;
filesystemUpdate.Update(_location.FilesystemStudyStorageKey, filesystemUpdateColumns);
}
示例2: OnExecute
protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
{
var insert = updateContext.GetBroker<IInsertWorkQueue>();
var parms = new InsertWorkQueueParameters
{
WorkQueueTypeEnum = WorkQueueTypeEnum.StudyProcess,
StudyStorageKey = _storageLocation.GetKey(),
ServerPartitionKey = _storageLocation.ServerPartitionKey,
SeriesInstanceUid = _message.DataSet[DicomTags.SeriesInstanceUid].GetString(0, String.Empty),
SopInstanceUid = _message.DataSet[DicomTags.SopInstanceUid].GetString(0, String.Empty),
ScheduledTime = Platform.Time,
WorkQueueGroupID = _uidGroupId
};
if (_duplicate)
{
parms.Duplicate = _duplicate;
parms.Extension = _extension;
parms.UidGroupID = _uidGroupId;
}
_insertedWorkQueue = insert.FindOne(parms);
if (_insertedWorkQueue == null)
throw new ApplicationException("UpdateWorkQueueCommand failed");
}
示例3: Import
/// <summary>
/// Imports the specified set of authority tokens.
/// </summary>
/// <param name="tokenDefs"></param>
/// <param name="addToGroups"></param>
/// <param name="context"></param>
/// <returns></returns>
public IList<AuthorityToken> Import(IEnumerable<AuthorityTokenDefinition> tokenDefs,
IList<string> addToGroups, IUpdateContext context)
{
// first load all the existing tokens into memory
// there should not be that many tokens ( < 500), so this should not be a problem
var broker = context.GetBroker<IAuthorityTokenBroker>();
var existingTokens = broker.FindAll();
// if there are groups to add to, load the groups
var groups = addToGroups != null && addToGroups.Count > 0 ? LoadGroups(addToGroups, context) : new List<AuthorityGroup>();
// order the input such that the renames are processed first
// otherwise there may be a corner case where a newly imported token is immediately renamed
tokenDefs = tokenDefs.OrderBy(t => t.FormerIdentities.Length > 0);
foreach (var tokenDef in tokenDefs)
{
var token = ProcessToken(tokenDef, existingTokens, context);
// add to groups
CollectionUtils.ForEach(groups, g => g.AuthorityTokens.Add(token));
}
return existingTokens;
}
示例4: OnExecute
/// <summary>
/// Execute the command
/// </summary>
/// <param name="updateContext">Database update context.</param>
/// <param name="theProcessor">The processor executing the command.</param>
protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
{
var columns = new ArchiveStudyStorageUpdateColumns
{
ArchiveTime = Platform.Time,
PartitionArchiveKey = _partitionArchiveKey,
StudyStorageKey = _studyStorageKey,
ArchiveXml = _archiveXml,
ServerTransferSyntaxKey = _serverTransferSyntaxKey
};
var insertBroker = updateContext.GetBroker<IArchiveStudyStorageEntityBroker>();
ArchiveStudyStorage storage = insertBroker.Insert(columns);
var parms = new UpdateArchiveQueueParameters
{
ArchiveQueueKey = _archiveQueueKey,
ArchiveQueueStatusEnum = ArchiveQueueStatusEnum.Completed,
ScheduledTime = Platform.Time,
StudyStorageKey = _studyStorageKey
};
var broker = updateContext.GetBroker<IUpdateArchiveQueue>();
if (!broker.Execute(parms))
throw new ApplicationException("InsertArchiveStudyStorageCommand failed");
}
示例5: OnExecute
/// <summary>
/// Execute the insert.
/// </summary>
/// <param name="theProcessor">The command processor calling us</param>
/// <param name="updateContext">The persistent store connection to use for the update.</param>
protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext)
{
var locInsert = updateContext.GetBroker<IInsertStudyStorage>();
var insertParms = new InsertStudyStorageParameters
{
ServerPartitionKey = _serverPartitionKey,
StudyInstanceUid = _studyInstanceUid,
Folder = _folder,
FilesystemKey = _filesystemKey,
QueueStudyStateEnum = QueueStudyStateEnum.Idle
};
if (_transfersyntax.LosslessCompressed)
{
insertParms.TransferSyntaxUid = _transfersyntax.UidString;
insertParms.StudyStatusEnum = StudyStatusEnum.OnlineLossless;
}
else if (_transfersyntax.LossyCompressed)
{
insertParms.TransferSyntaxUid = _transfersyntax.UidString;
insertParms.StudyStatusEnum = StudyStatusEnum.OnlineLossy;
}
else
{
insertParms.TransferSyntaxUid = _transfersyntax.UidString;
insertParms.StudyStatusEnum = StudyStatusEnum.Online;
}
// Find one so we don't uselessly process all the results.
_location = locInsert.FindOne(insertParms);
}
示例6: Import
/// <summary>
/// Import authority groups.
/// </summary>
/// <remarks>
/// Creates any authority groups that do not already exist.
/// This method performs an additive import. It will never remove an existing authority group or
/// remove authority tokens from an existing group.
/// </remarks>
/// <param name="groupDefs"></param>
/// <param name="context"></param>
public IList<AuthorityGroup> Import(IEnumerable<AuthorityGroupDefinition> groupDefs, IUpdateContext context)
{
// first load all the existing tokens into memory
// there should not be that many tokens ( < 500), so this should not be a problem
IAuthorityTokenBroker tokenBroker = context.GetBroker<IAuthorityTokenBroker>();
IList<AuthorityToken> existingTokens = tokenBroker.FindAll();
// load existing groups
IAuthorityGroupBroker groupBroker = context.GetBroker<IAuthorityGroupBroker>();
IList<AuthorityGroup> existingGroups = groupBroker.FindAll();
foreach (AuthorityGroupDefinition groupDef in groupDefs)
{
AuthorityGroup group = CollectionUtils.SelectFirst(existingGroups,
g => g.Name == groupDef.Name);
// if group does not exist, create it
if (group == null)
{
group = new AuthorityGroup
{
Name = groupDef.Name,
Description = groupDef.Description,
DataGroup = groupDef.DataGroup
};
context.Lock(group, DirtyState.New);
existingGroups.Add(group);
}
// process all token nodes contained in group
foreach (string tokenName in groupDef.Tokens)
{
AuthorityToken token = CollectionUtils.SelectFirst(existingTokens,
t => t.Name == tokenName);
// ignore non-existent tokens
if (token == null)
continue;
// add the token to the group
group.AuthorityTokens.Add(token);
}
}
return existingGroups;
}
示例7: Insert
static public StudyDataAccess Insert(IUpdateContext update, StudyDataAccess entity)
{
var broker = update.GetBroker<IStudyDataAccessEntityBroker>();
var updateColumns = new StudyDataAccessUpdateColumns();
updateColumns.StudyStorageKey = entity.StudyStorageKey;
updateColumns.DataAccessGroupKey = entity.DataAccessGroupKey;
StudyDataAccess newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例8: Insert
static public ServerPartitionDataAccess Insert(IUpdateContext update, ServerPartitionDataAccess entity)
{
var broker = update.GetBroker<IServerPartitionDataAccessEntityBroker>();
var updateColumns = new ServerPartitionDataAccessUpdateColumns();
updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
updateColumns.DataAccessGroupKey = entity.DataAccessGroupKey;
ServerPartitionDataAccess newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例9: Insert
static public DataAccessGroup Insert(IUpdateContext update, DataAccessGroup entity)
{
var broker = update.GetBroker<IDataAccessGroupEntityBroker>();
var updateColumns = new DataAccessGroupUpdateColumns();
updateColumns.AuthorityGroupOID = entity.AuthorityGroupOID;
updateColumns.Deleted = entity.Deleted;
DataAccessGroup newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例10: Insert
static public ServerTransferSyntax Insert(IUpdateContext update, ServerTransferSyntax entity)
{
var broker = update.GetBroker<IServerTransferSyntaxEntityBroker>();
var updateColumns = new ServerTransferSyntaxUpdateColumns();
updateColumns.Uid = entity.Uid;
updateColumns.Description = entity.Description;
updateColumns.Lossless = entity.Lossless;
ServerTransferSyntax newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例11: Insert
static public PartitionSopClass Insert(IUpdateContext update, PartitionSopClass entity)
{
var broker = update.GetBroker<IPartitionSopClassEntityBroker>();
var updateColumns = new PartitionSopClassUpdateColumns();
updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
updateColumns.ServerSopClassKey = entity.ServerSopClassKey;
updateColumns.Enabled = entity.Enabled;
PartitionSopClass newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例12: Insert
static public DevicePreferredTransferSyntax Insert(IUpdateContext update, DevicePreferredTransferSyntax entity)
{
var broker = update.GetBroker<IDevicePreferredTransferSyntaxEntityBroker>();
var updateColumns = new DevicePreferredTransferSyntaxUpdateColumns();
updateColumns.DeviceKey = entity.DeviceKey;
updateColumns.ServerSopClassKey = entity.ServerSopClassKey;
updateColumns.ServerTransferSyntaxKey = entity.ServerTransferSyntaxKey;
DevicePreferredTransferSyntax newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例13: Insert
static public CannedText Insert(IUpdateContext update, CannedText entity)
{
var broker = update.GetBroker<ICannedTextEntityBroker>();
var updateColumns = new CannedTextUpdateColumns();
updateColumns.Label = entity.Label;
updateColumns.Category = entity.Category;
updateColumns.Text = entity.Text;
CannedText newEntity = broker.Insert(updateColumns);
return newEntity;
}
示例14: Import
/// <summary>
/// Import external practitioner from CSV format.
/// </summary>
/// <param name="rows">
/// Each string in the list must contain 4 CSV fields, as follows:
/// 0 - Facility ID
/// 1 - Facility Name
/// 2 - Information Authority ID
/// 3 - Information Authoirty Name
/// </param>
/// <param name="context"></param>
public override void Import(List<string> rows, IUpdateContext context)
{
_enumBroker = context.GetBroker<IEnumBroker>();
_authorities = new List<InformationAuthorityEnum>(_enumBroker.Load<InformationAuthorityEnum>(true));
List<Facility> facilities = new List<Facility>();
foreach (string line in rows)
{
// expect 4 fields in the row
string[] fields = ParseCsv(line, 4);
string facilityId = fields[0];
string facilityName = fields[1];
string facilityDescription = fields[2];
string informationAuthorityId = fields[3];
string informationAuthorityName = fields[4];
// first check if we have it in memory
Facility facility = CollectionUtils.SelectFirst(facilities,
delegate(Facility f) { return f.Code == facilityId && f.Name == facilityName; });
// if not, check the database
if (facility == null)
{
FacilitySearchCriteria where = new FacilitySearchCriteria();
where.Code.EqualTo(facilityId);
where.Name.EqualTo(facilityName);
IFacilityBroker broker = context.GetBroker<IFacilityBroker>();
facility = CollectionUtils.FirstElement(broker.Find(where));
// if not, create a new instance
if (facility == null)
{
facility = new Facility(facilityId, facilityName, facilityDescription, GetAuthority(informationAuthorityId, informationAuthorityName));
context.Lock(facility, DirtyState.New);
}
facilities.Add(facility);
}
}
}
示例15: Insert
static public RequestAttributes Insert(IUpdateContext update, RequestAttributes entity)
{
var broker = update.GetBroker<IRequestAttributesEntityBroker>();
var updateColumns = new RequestAttributesUpdateColumns();
updateColumns.SeriesKey = entity.SeriesKey;
updateColumns.RequestedProcedureId = entity.RequestedProcedureId;
updateColumns.ScheduledProcedureStepId = entity.ScheduledProcedureStepId;
RequestAttributes newEntity = broker.Insert(updateColumns);
return newEntity;
}