本文整理汇总了C#中IPersistenceContext.GetBroker方法的典型用法代码示例。如果您正苦于以下问题:C# IPersistenceContext.GetBroker方法的具体用法?C# IPersistenceContext.GetBroker怎么用?C# IPersistenceContext.GetBroker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersistenceContext
的用法示例。
在下文中一共展示了IPersistenceContext.GetBroker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
/// <summary>
/// Delete the Work Queue record from the system.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public bool Delete(IPersistenceContext context)
{
IWorkQueueUidEntityBroker workQueueUidBroker = context.GetBroker<IWorkQueueUidEntityBroker>();
WorkQueueUidSelectCriteria criteria = new WorkQueueUidSelectCriteria();
criteria.WorkQueueKey.EqualTo(GetKey());
workQueueUidBroker.Delete(criteria);
IWorkQueueEntityBroker workQueueBroker = context.GetBroker<IWorkQueueEntityBroker>();
return workQueueBroker.Delete(GetKey());
}
示例2: CreateSysAdminUser
private static void CreateSysAdminUser(AuthorityGroup adminGroup, SetupCommandLine cmdLine, IPersistenceContext context, TextWriter log)
{
try
{
// create the sa user, if doesn't already exist
IUserBroker userBroker = context.GetBroker<IUserBroker>();
UserSearchCriteria where = new UserSearchCriteria();
where.UserName.EqualTo(cmdLine.SysAdminUserName);
userBroker.FindOne(where);
log.WriteLine(string.Format("User '{0}' already exists.", cmdLine.SysAdminUserName));
}
catch (EntityNotFoundException)
{
HashedSet<AuthorityGroup> groups = new HashedSet<AuthorityGroup>
{
adminGroup
};
// create sa user using initial password, set to expire never
User saUser = User.CreateNewUser(
new UserInfo(cmdLine.SysAdminUserName, cmdLine.SysAdminDisplayName, null, null, null),
Password.CreatePassword(cmdLine.SysAdminInitialPassword, null),
groups);
context.Lock(saUser, DirtyState.New);
}
}
示例3: LoadPreferredSyntaxes
/// <summary>
/// Load a list of preferred SOP Classes and Transfer Syntaxes for a Device.
/// </summary>
/// <param name="read">A read context to read from the database.</param>
public void LoadPreferredSyntaxes(IPersistenceContext read)
{
var select = read.GetBroker<IDevicePreferredTransferSyntaxEntityBroker>();
// Setup the select parameters.
var criteria = new DevicePreferredTransferSyntaxSelectCriteria();
criteria.DeviceKey.EqualTo(_remoteDevice.GetKey());
IList<DevicePreferredTransferSyntax> list = select.Find(criteria);
// Translate the list returned into the database into a list that is supported by the Storage SCU Component
var sopList = new List<SupportedSop>();
foreach (DevicePreferredTransferSyntax preferred in list)
{
var sop = new SupportedSop
{
SopClass = SopClass.GetSopClass(preferred.GetServerSopClass().SopClassUid)
};
sop.AddSyntax(TransferSyntax.GetTransferSyntax(preferred.GetServerTransferSyntax().Uid));
sopList.Add(sop);
}
SetPreferredSyntaxList(sopList);
}
示例4: GetAllCurrentMoveEntries
/// <summary>
/// Gets a list of Web Study Move or AutoRoute WorkQueue entries
/// that are in progress for this device.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public List<WorkQueue> GetAllCurrentMoveEntries(IPersistenceContext context)
{
IQueryCurrentStudyMove broker = context.GetBroker<IQueryCurrentStudyMove>();
QueryCurrentStudyMoveParameters criteria = new QueryCurrentStudyMoveParameters();
criteria.DeviceKey = Key;
return new List<WorkQueue>(broker.Find(criteria));
}
示例5: LoadRequestAttributes
/// <summary>
/// Load the values for the sequence <see cref="DicomTags.RequestAttributesSequence"/>
/// into a response message for a specific series.
/// </summary>
/// <param name="read">The connection to use to read the values.</param>
/// <param name="response">The message to add the values into.</param>
/// <param name="row">The <see cref="Series"/> entity to load the related <see cref="RequestAttributes"/> entity for.</param>
private static void LoadRequestAttributes(IPersistenceContext read, DicomMessageBase response, Series row)
{
var select = read.GetBroker<IRequestAttributesEntityBroker>();
var criteria = new RequestAttributesSelectCriteria();
criteria.SeriesKey.EqualTo(row.GetKey());
IList<RequestAttributes> list = select.Find(criteria);
if (list.Count == 0)
{
response.DataSet[DicomTags.RequestAttributesSequence].SetNullValue();
return;
}
foreach (RequestAttributes request in list)
{
var item = new DicomSequenceItem();
item[DicomTags.ScheduledProcedureStepId].SetStringValue(request.ScheduledProcedureStepId);
item[DicomTags.RequestedProcedureId].SetStringValue(request.RequestedProcedureId);
response.DataSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);
}
}
示例6: MoveVisit
/// <summary>
/// The specified visit and its associated orders get moved from otherPatient to thisPatient
/// </summary>
/// <param name="thisPatient"></param>
/// <param name="otherPatient"></param>
/// <param name="visit"></param>
/// <param name="context"></param>
static public void MoveVisit(Patient thisPatient, Patient otherPatient, Visit visit, IPersistenceContext context)
{
var orderCriteria = new OrderSearchCriteria();
orderCriteria.Visit.EqualTo(visit);
var visitOrders = context.GetBroker<IOrderBroker>().Find(orderCriteria);
foreach (var order in visitOrders)
{
order.Patient = thisPatient;
}
visit.Patient = thisPatient;
}
示例7: GetUser
/// <summary>
/// Gets the user specified by the user name, or null if no such user exists.
/// </summary>
/// <param name="userName"></param>
/// <param name="persistenceContext"
/// <returns></returns>
private User GetUser(string userName, IPersistenceContext persistenceContext)
{
var criteria = new UserSearchCriteria();
criteria.UserName.EqualTo(userName);
// use query caching here to make this fast (assuming the user table is not often updated)
var users = persistenceContext.GetBroker<IUserBroker>().Find(
criteria, new SearchResultPage(0, 1), new EntityFindOptions { Cache = true });
// bug #3701: to ensure the username match is case-sensitive, we need to compare the stored name to the supplied name
// returns null if no match
return CollectionUtils.SelectFirst(users, u => u.UserName == userName);
}
示例8: FindReconciliationMatches
public IList<PatientProfileMatch> FindReconciliationMatches(PatientProfile targetProfile, IPersistenceContext context)
{
/* User needs to resort to manual linking of patient records from multiple HIS when automatic MPI fails.
*
* Allow user to to select 2 or more patient records from different hospitals and merge into an MPI.
*
* Display High-Probability match/search results from muliple HIS of patients with various Mrns when
* field: healthcard # is matched/identical.
*
* Display Moderate-Probability match/search results from multiple HIS of patients with various Mrns when fields: surname,
* given name, DOB, gender are matched/identical.
*
*/
IPatientProfileBroker broker = context.GetBroker<IPatientProfileBroker>();
IList<PatientProfileMatch> matches = new List<PatientProfileMatch>();
IList<PatientProfileMatch> highMatches = new List<PatientProfileMatch>();
if (targetProfile.Healthcard != null && !string.IsNullOrEmpty(targetProfile.Healthcard.Id))
{
PatientProfileSearchCriteria high = new PatientProfileSearchCriteria();
high.Healthcard.Id.EqualTo(targetProfile.Healthcard.Id);
highMatches = PatientProfileMatch.CreateList(targetProfile, broker.Find(high), PatientProfileMatch.ScoreValue.High);
}
PatientProfileSearchCriteria moderateViaName = new PatientProfileSearchCriteria();
if (targetProfile.Name.FamilyName != null && !string.IsNullOrEmpty(targetProfile.Name.FamilyName))
moderateViaName.Name.FamilyName.EqualTo(targetProfile.Name.FamilyName);
if (targetProfile.Name.GivenName != null && !string.IsNullOrEmpty(targetProfile.Name.GivenName))
moderateViaName.Name.GivenName.EqualTo(targetProfile.Name.GivenName);
if (targetProfile.DateOfBirth != null)
moderateViaName.DateOfBirth.EqualTo(targetProfile.DateOfBirth);
moderateViaName.Sex.EqualTo(targetProfile.Sex);
IList<PatientProfileMatch> moderateMatchesViaName = PatientProfileMatch.CreateList(targetProfile, broker.Find(moderateViaName), PatientProfileMatch.ScoreValue.Moderate);
matches = PatientProfileMatch.Combine(highMatches, moderateMatchesViaName);
RemoveConflicts(targetProfile.Patient, matches);
return matches;
}
示例9: LoadModalitiesInStudy
/// <summary>
/// Load the values for the tag <see cref="DicomTags.ModalitiesInStudy"/> into a response
/// message for a specific <see cref="Study"/>.
/// </summary>
/// <param name="read">The connection to use to read the values.</param>
/// <param name="response">The message to add the value into.</param>
/// <param name="key">The <see cref="ServerEntityKey"/> for the <see cref="Study"/>.</param>
private static void LoadModalitiesInStudy(IPersistenceContext read, DicomMessageBase response, ServerEntityKey key)
{
var select = read.GetBroker<IQueryModalitiesInStudy>();
var parms = new ModalitiesInStudyQueryParameters { StudyKey = key };
IList<Series> list = select.Find(parms);
string value = "";
foreach (Series series in list)
{
value = value.Length == 0
? series.Modality
: String.Format("{0}\\{1}", value, series.Modality);
}
response.DataSet[DicomTags.ModalitiesInStudy].SetStringValue(value);
}
示例10: GetSopListForPatient
/// <summary>
/// Create a list of SOP Instances to move based on a Patient level C-MOVE-RQ.
/// </summary>
/// <param name="read"></param>
/// <param name="msg"></param>
/// <param name="errorComment"> </param>
/// <returns></returns>
private bool GetSopListForPatient(IPersistenceContext read, DicomMessageBase msg, out string errorComment)
{
errorComment = string.Empty;
string patientId = msg.DataSet[DicomTags.PatientId].GetString(0, "");
var select = read.GetBroker<IStudyEntityBroker>();
var criteria = new StudySelectCriteria();
criteria.PatientId.EqualTo(patientId);
criteria.ServerPartitionKey.EqualTo(Partition.Key);
IList<Study> studyList = select.Find(criteria);
bool bOfflineFound = false;
foreach (Study study in studyList)
{
StudyStorageLocation location;
try
{
FilesystemMonitor.Instance.GetReadableStudyStorageLocation(Partition.Key, study.StudyInstanceUid,
StudyRestore.True, StudyCache.True, out location);
}
catch (StudyIsNearlineException e)
{
errorComment = string.Format(e.RestoreRequested ? "Study is nearline, inserted restore request: {0}" : "Study is nearline: {0}", study.StudyInstanceUid);
bOfflineFound = true;
continue;
}
catch (Exception e)
{
errorComment = string.Format("Exception occurred when determining study location: {0}", e.Message);
bOfflineFound = true;
continue;
}
StudyXml theStream = LoadStudyXml(location);
_theScu.LoadStudyFromStudyXml(location.GetStudyPath(), theStream);
}
return !bOfflineFound;
}
示例11: GetDataAccessSubCriteriaForUser
public static StudyDataAccessSelectCriteria GetDataAccessSubCriteriaForUser(IPersistenceContext context, IPrincipal user)
{
if (user.IsInRole(ClearCanvas.Enterprise.Common.AuthorityTokens.DataAccess.AllStudies))
{
return null;
}
var principal = user as CustomPrincipal;
if (principal == null)
return null;
string key = GetDataAccessSubCriteriaCacheID(principal);
// check the cache first
var subCriteria = Cache.Current[key] as StudyDataAccessSelectCriteria;
if (subCriteria != null)
return subCriteria;
var oidList = new List<ServerEntityKey>();
foreach (var oid in principal.Credentials.DataAccessAuthorityGroups)
oidList.Add(new ServerEntityKey("OID", oid));
var dataAccessGroupSelectCriteria = new DataAccessGroupSelectCriteria();
dataAccessGroupSelectCriteria.AuthorityGroupOID.In(oidList);
IList<DataAccessGroup> groups;
var broker = context.GetBroker<IDataAccessGroupEntityBroker>();
groups = broker.Find(dataAccessGroupSelectCriteria);
var entityList = new List<ServerEntityKey>();
foreach (DataAccessGroup group in groups)
{
entityList.Add(group.Key);
}
subCriteria = new StudyDataAccessSelectCriteria();
subCriteria.DataAccessGroupKey.In(entityList);
// put into cache for re-use
Cache.Current[key] = subCriteria;
return subCriteria;
}
示例12: UpdateAuthorityGroup
internal void UpdateAuthorityGroup(AuthorityGroup authorityGroup, AuthorityGroupDetail detail, IPersistenceContext persistenceContext)
{
authorityGroup.Name = detail.Name;
authorityGroup.Description = detail.Description;
authorityGroup.DataGroup = detail.DataGroup;
authorityGroup.AuthorityTokens.Clear();
if (detail.AuthorityTokens.Count > 0)
{
// process authority tokens
List<string> tokenNames = CollectionUtils.Map<AuthorityTokenSummary, string>(
detail.AuthorityTokens,
token => token.Name);
AuthorityTokenSearchCriteria where = new AuthorityTokenSearchCriteria();
where.Name.In(tokenNames);
IList<AuthorityToken> authTokens = persistenceContext.GetBroker<IAuthorityTokenBroker>().Find(where);
authorityGroup.AuthorityTokens.AddAll(authTokens);
}
}
示例13: LoadStudyKey
/// <summary>
/// Find the <see cref="ServerEntityKey"/> reference for a given Study Instance UID and Server Partition.
/// </summary>
/// <param name="read">The connection to use to read the values.</param>
/// <param name="studyInstanceUid">The list of Study Instance Uids for which to retrieve the table keys.</param>
/// <returns>A list of <see cref="ServerEntityKey"/>s.</returns>
protected List<ServerEntityKey> LoadStudyKey(IPersistenceContext read, string[] studyInstanceUid)
{
var find = read.GetBroker<IStudyEntityBroker>();
var criteria = new StudySelectCriteria();
if (Partition!=null)
criteria.ServerPartitionKey.EqualTo(Partition.Key);
if (studyInstanceUid.Length > 1)
criteria.StudyInstanceUid.In(studyInstanceUid);
else
criteria.StudyInstanceUid.EqualTo(studyInstanceUid[0]);
IList<Study> list = find.Find(criteria);
var serverList = new List<ServerEntityKey>();
foreach (Study row in list)
serverList.Add(row.GetKey());
return serverList;
}
示例14: Find
/// <summary>
/// Find a <see cref="Study"/> with the specified study instance uid on the given partition.
/// </summary>
/// <param name="studyInstanceUid"></param>
/// <param name="partition"></param>
/// <returns></returns>
///
static public Study Find(IPersistenceContext context, String studyInstanceUid, ServerPartition partition)
{
IStudyEntityBroker broker = context.GetBroker<IStudyEntityBroker>();
StudySelectCriteria criteria = new StudySelectCriteria();
criteria.ServerPartitionKey.EqualTo(partition.GetKey());
criteria.StudyInstanceUid.EqualTo(studyInstanceUid);
Study study = broker.FindOne(criteria);
return study;
}
示例15: Load
static public FilesystemQueue Load(IPersistenceContext read, ServerEntityKey key)
{
var broker = read.GetBroker<IFilesystemQueueEntityBroker>();
FilesystemQueue theObject = broker.Load(key);
return theObject;
}