本文整理汇总了C#中IPersistenceContext.Load方法的典型用法代码示例。如果您正苦于以下问题:C# IPersistenceContext.Load方法的具体用法?C# IPersistenceContext.Load怎么用?C# IPersistenceContext.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersistenceContext
的用法示例。
在下文中一共展示了IPersistenceContext.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateProcedureType
public void UpdateProcedureType(ProcedureType procType, ProcedureTypeDetail detail, IPersistenceContext context)
{
procType.Id = detail.Id;
procType.Name = detail.Name;
procType.BaseType = detail.CustomProcedurePlan && detail.BaseType != null
? context.Load<ProcedureType>(detail.BaseType.ProcedureTypeRef, EntityLoadFlags.Proxy)
: null;
procType.DefaultDuration = detail.DefaultDuration;
procType.Deactivated = detail.Deactivated;
try
{
if(detail.CustomProcedurePlan)
{
procType.Plan = new ProcedurePlan(detail.PlanXml);
}
else
{
var modality = context.Load<Modality>(detail.DefaultModality.ModalityRef);
procType.Plan = ProcedurePlan.CreateDefaultPlan(detail.Name, modality);
}
}
catch (XmlException e)
{
throw new RequestValidationException(string.Format("Procedure plan XML is invalid: {0}", e.Message));
}
}
示例2: Capture
protected override OperationData Capture(IServiceOperationRecorderContext recorderContext, IPersistenceContext persistenceContext)
{
var request = (PlaceOrderRequest)recorderContext.Request;
var profile = persistenceContext.Load<PatientProfile>(request.Requisition.Patient.PatientProfileRef, EntityLoadFlags.None);
var response = (PlaceOrderResponse) recorderContext.Response;
var order = persistenceContext.Load<Order>(response.Order.OrderRef, EntityLoadFlags.None);
return new OperationData(Operations.New, profile, order);
}
示例3: UpdateProtocol
public void UpdateProtocol(Protocol protocol, ProtocolDetail detail, IPersistenceContext context)
{
protocol.Urgency = EnumUtils.GetEnumValue<ProtocolUrgencyEnum>(detail.Urgency, context);
// if detail specifies a supervisor use it otherwise retain previous supervisor (null or valued)
protocol.Supervisor = detail.Supervisor != null ? context.Load<Staff>(detail.Supervisor.StaffRef) : protocol.Supervisor;
protocol.Codes.Clear();
foreach (var codeSummary in detail.Codes)
{
var code = context.Load<ProtocolCode>(codeSummary.ProtocolCodeRef, EntityLoadFlags.Proxy);
protocol.Codes.Add(code);
}
}
示例4: Capture
protected override OperationData Capture(IServiceOperationRecorderContext recorderContext, IPersistenceContext persistenceContext)
{
var response = (LoadPatientProfileForEditResponse)recorderContext.Response;
var patientProfile = persistenceContext.Load<PatientProfile>(response.PatientProfileRef, EntityLoadFlags.None);
return new OperationData(Operations.OpenForUpdate, patientProfile);
}
示例5: ShouldCapture
protected override bool ShouldCapture(IServiceOperationRecorderContext recorderContext, IPersistenceContext persistenceContext)
{
var request = (SaveReportRequest)recorderContext.Request;
var rps = persistenceContext.Load<ReportingProcedureStep>(request.ReportingStepRef, EntityLoadFlags.None);
// only relevant for the main report, not for addendums (i.e. we are still in P status)
return rps.ReportPart.Report.Status == ReportStatus.P && base.ShouldCapture(recorderContext, persistenceContext);
}
示例6: CreateNote
public PatientNote CreateNote(PatientNoteDetail detail, Staff author, IPersistenceContext context)
{
PatientNoteCategory category = context.Load<PatientNoteCategory>(detail.Category.NoteCategoryRef, EntityLoadFlags.Proxy);
PatientNote note = new PatientNote(author, category, detail.Comment);
note.ValidRange.Until = detail.ValidRangeUntil;
return note;
}
示例7: Capture
private static OperationData Capture(DiscontinueModalityProcedureStepsRequest request, IPersistenceContext persistenceContext)
{
var procedures = request.ModalityProcedureSteps.Select(r => persistenceContext.Load<ModalityProcedureStep>(r, EntityLoadFlags.None).Procedure).ToList();
var order = procedures.First().Order;
var patientProfile = procedures.First().PatientProfile;
return new OperationData(Operations.Discontinue, patientProfile, order, procedures);
}
示例8: UpdateCannedText
public void UpdateCannedText(CannedText cannedText, CannedTextDetail detail, Staff owner, IPersistenceContext context)
{
cannedText.Name = detail.Name;
cannedText.Category = detail.Category;
cannedText.Staff = detail.IsPersonal ? owner : null;
cannedText.StaffGroup = detail.IsGroup ? context.Load<StaffGroup>(detail.StaffGroup.StaffGroupRef, EntityLoadFlags.Proxy) : null;
cannedText.Text = detail.Text;
}
示例9: Capture
protected override OperationData Capture(IServiceOperationRecorderContext recorderContext, IPersistenceContext persistenceContext)
{
var response = (GetOrderRequisitionForEditResponse)recorderContext.Response;
var patientProfile = persistenceContext.Load<PatientProfile>(response.Requisition.Patient.PatientProfileRef, EntityLoadFlags.None);
var order = persistenceContext.Load<Order>(response.Requisition.OrderRef, EntityLoadFlags.None);
return new OperationData(Operations.OpenForModifyOrReplace, patientProfile, order);
}
示例10: UpdateDepartment
public void UpdateDepartment(Department item, DepartmentDetail detail, IPersistenceContext context)
{
item.Id = detail.Id;
item.Name = detail.Name;
item.Description = detail.Description;
item.Facility = context.Load<Facility>(detail.Facility.FacilityRef, EntityLoadFlags.Proxy);
item.Deactivated = detail.Deactivated;
}
示例11: UpdateProtocolGroup
public void UpdateProtocolGroup(ProtocolGroup group, ProtocolGroupDetail detail, IPersistenceContext context)
{
group.Name = detail.Name;
group.Description = detail.Description;
group.Codes.Clear();
detail.Codes.ForEach(delegate(ProtocolCodeSummary summary)
{
group.Codes.Add(context.Load<ProtocolCode>(summary.ProtocolCodeRef));
});
group.ReadingGroups.Clear();
detail.ReadingGroups.ForEach(delegate(ProcedureTypeGroupSummary procedureTypeGroupSummary)
{
group.ReadingGroups.Add(context.Load<ReadingGroup>(procedureTypeGroupSummary.ProcedureTypeGroupRef));
});
}
示例12: UpdateModality
public void UpdateModality(ModalityDetail detail, Modality modality, IPersistenceContext context)
{
modality.Id = detail.Id;
modality.Name = detail.Name;
modality.Facility = detail.Facility == null ? null : context.Load<Facility>(detail.Facility.FacilityRef, EntityLoadFlags.Proxy);
modality.AETitle = detail.AETitle;
modality.DicomModality = EnumUtils.GetEnumValue<DicomModalityEnum>(detail.DicomModality, context);
modality.Deactivated = detail.Deactivated;
}
示例13: Capture
private static OperationData Capture(DiscontinueModalityPerformedProcedureStepRequest request, IPersistenceContext persistenceContext)
{
var mpps = persistenceContext.Load<ModalityPerformedProcedureStep>(request.Mpps.ModalityPerformendProcedureStepRef, EntityLoadFlags.None);
var procedures = mpps.Activities.Select(a => a.Downcast<ModalityProcedureStep>().Procedure).ToList();
var order = procedures.First().Order;
var patientProfile = procedures.First().PatientProfile;
return new OperationData(Operations.Discontinue, patientProfile, order, procedures);
}
示例14: UpdateDiagnosticService
public void UpdateDiagnosticService(DiagnosticService ds, DiagnosticServiceDetail detail, IPersistenceContext context)
{
ds.Id = detail.Id;
ds.Name = detail.Name;
ds.Deactivated = detail.Deactivated;
ds.ProcedureTypes.Clear();
ds.ProcedureTypes.AddAll(
detail.ProcedureTypes.Select(pt => context.Load<ProcedureType>(pt.ProcedureTypeRef, EntityLoadFlags.Proxy)).ToList());
}
示例15: UpdateOrderFromRequisition
public void UpdateOrderFromRequisition(Order order, OrderRequisition requisition, Staff currentStaff, IPersistenceContext context)
{
// only certain properties of an order may be updated from a requisition
// Patient cannot not be updated
// DiagnosticService cannot be updated
// OrderingFacility cannot be updated
// do not update the individual procedures, as this is done separately - see UpdateProcedureFromRequisition
// Some properties cannot be updated if the procedure is terminated
if (!order.IsTerminated)
{
order.Visit = context.Load<Visit>(requisition.Visit.VisitRef, EntityLoadFlags.Proxy);
order.SchedulingRequestTime = requisition.SchedulingRequestTime;
order.OrderingPractitioner = context.Load<ExternalPractitioner>(
requisition.OrderingPractitioner.PractitionerRef, EntityLoadFlags.Proxy);
order.ReasonForStudy = requisition.ReasonForStudy;
order.Priority = EnumUtils.GetEnumValue<OrderPriority>(requisition.Priority);
// wipe out and reset the result recipients
order.ResultRecipients.Clear();
CollectionUtils.Map<ResultRecipientDetail, ResultRecipient>(
requisition.ResultRecipients,
s => new ResultRecipient(
context.Load<ExternalPractitionerContactPoint>(s.ContactPoint.ContactPointRef, EntityLoadFlags.Proxy),
EnumUtils.GetEnumValue<ResultCommunicationMode>(s.PreferredCommunicationMode))).ForEach(r => order.ResultRecipients.Add(r));
}
// synchronize Order.Attachments from order requisition
var attachmentAssembler = new OrderAttachmentAssembler();
attachmentAssembler.Synchronize(order.Attachments, requisition.Attachments, currentStaff, context);
// synchronize Order.Notes from order requisition
var noteAssembler = new OrderNoteAssembler();
noteAssembler.SynchronizeOrderNotes(order, requisition.Notes, currentStaff, context);
if (requisition.ExtendedProperties != null)
{
ExtendedPropertyUtils.Update(order.ExtendedProperties, requisition.ExtendedProperties);
}
}