本文整理汇总了C#中IUpdateContext类的典型用法代码示例。如果您正苦于以下问题:C# IUpdateContext类的具体用法?C# IUpdateContext怎么用?C# IUpdateContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUpdateContext类属于命名空间,在下文中一共展示了IUpdateContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Import
/// <summary>
/// Import user from CSV format.
/// </summary>
/// <param name="rows">
/// Each string in the list must contain 25 CSV fields, as follows:
/// 0 - UserName
/// 1 - StaffType
/// 2 - Id
/// 3 - FamilyName
/// 4 - GivenName
/// 5 - MiddleName
/// 6 - Prefix
/// 7 - Suffix
/// 8 - Degree
/// </param>
/// <param name="context"></param>
public override void Import(List<string> rows, IUpdateContext context)
{
_context = context;
List<User> importedUsers = new List<User>();
foreach (string row in rows)
{
string[] fields = ParseCsv(row, _numFields);
string userName = fields[0];
string staffId = fields[2];
string staffFamilyName = fields[3];
string staffGivenName = fields[4];
User user = GetUser(userName, importedUsers);
if (user == null)
{
UserInfo userInfo =
new UserInfo(userName, string.Format("{0} {1}", staffFamilyName, staffGivenName), null, null, null);
user = User.CreateNewUser(userInfo, _settings.DefaultTemporaryPassword);
_context.Lock(user, DirtyState.New);
importedUsers.Add(user);
}
}
}
示例2: 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");
}
示例3: 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);
}
示例4: Update
/// <summary>
/// Internally called by <see cref="SensorEngineHook"/> to update sensors
/// during the update step.
/// </summary>
/// <param name="gameContext">The current game context.</param>
/// <param name="updateContext">The current update context.</param>
public void Update(IGameContext gameContext, IUpdateContext updateContext)
{
foreach (var sensor in _sensors)
{
sensor.Update(gameContext, updateContext);
}
}
示例5: Update
public void Update(IGameContext gameContext, IUpdateContext updateContext)
{
using (this.m_Profiler.Measure("resize_window"))
{
gameContext.ResizeWindow(800, 600);
}
}
示例6: MoveSeries
/// <summary>
/// Inserts a move request to move one or more series in a study.
/// </summary>
/// <param name="context">The persistence context used for database connection.</param>
/// <param name="partition">The <see cref="ServerPartition"/> where the study resides</param>
/// <param name="studyInstanceUid">The Study Instance Uid of the study</param>
/// <param name="deviceKey">The Key of the device to move the series to.</param>
/// <param name="seriesInstanceUids">The Series Instance Uid of the series to be move.</param>
/// <param name="externalRequest">Optional <see cref="ExternalRequestQueue"/> entry that triggered this move</param>
/// <returns>A MoveSeries <see cref="WorkQueue"/> entry inserted into the system.</returns>
/// <exception cref="InvalidStudyStateOperationException"></exception>
public static IList<WorkQueue> MoveSeries(IUpdateContext context, ServerPartition partition, string studyInstanceUid, ServerEntityKey deviceKey, List<string> seriesInstanceUids, ExternalRequestQueue externalRequest=null)
{
// Find all location of the study in the system and insert series delete request
IList<StudyStorageLocation> storageLocations = StudyStorageLocation.FindStorageLocations(partition.Key, studyInstanceUid);
IList<WorkQueue> entries = new List<WorkQueue>();
foreach (StudyStorageLocation location in storageLocations)
{
try
{
// insert a move series request
WorkQueue request = InsertMoveSeriesRequest(context, location, seriesInstanceUids, deviceKey, externalRequest);
Debug.Assert(request.WorkQueueTypeEnum.Equals(WorkQueueTypeEnum.WebMoveStudy));
entries.Add(request);
}
catch (Exception ex)
{
Platform.Log(LogLevel.Error, ex, "Errors occurred when trying to insert move request");
if (!ServerHelper.UnlockStudy(location.Key))
throw new ApplicationException("Unable to unlock the study");
}
}
return entries;
}
示例7: 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");
}
示例8: Update
public override void Update(IGameContext gameContext, IUpdateContext updateContext)
{
base.Update(gameContext, updateContext);
var mouse = Mouse.GetState();
var keyboard = Keyboard.GetState();
if (mouse.LeftPressed(this))
{
this.X = mouse.X;
this.Y = mouse.Y;
this.XSpeed = 0;
this.YSpeed = 0;
this.m_JumpHandle.Play();
}
if (keyboard.IsKeyDown(Keys.Left))
this.m_Platforming.ApplyMovement(this, -4, 0, gameContext.World.Entities.Cast<IBoundingBox>(), x => x is Solid);
if (keyboard.IsKeyDown(Keys.Right))
this.m_Platforming.ApplyMovement(this, 4, 0, gameContext.World.Entities.Cast<IBoundingBox>(), x => x is Solid);
if (!this.OnGround(gameContext))
this.m_Platforming.ApplyGravity(this, 0, 0.5f);
else if (this.YSpeed > 0)
{
this.YSpeed = 0;
this.m_Platforming.ApplyActionUntil(this, a => a.Y += 1, a => this.OnGround(gameContext), 12);
}
this.m_Platforming.ClampSpeed(this, null, 12);
if (keyboard.IsKeyPressed(Keys.Up) && this.OnGround(gameContext))
this.YSpeed = -6;
}
示例9: 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;
}
示例10: DeleteSeries
/// <summary>
/// Inserts delete request(s) to delete a series in a study.
/// </summary>
/// <param name="context">The persistence context used for database connection.</param>
/// <param name="partition">The <see cref="ServerPartition"/> where the study resides</param>
/// <param name="studyInstanceUid">The Study Instance Uid of the study</param>
/// <param name="seriesInstanceUids">The Series Instance Uid of the series to be deleted.</param>
/// <param name="reason">The reason for deleting the series.</param>
/// <returns>A list of DeleteSeries <see cref="WorkQueue"/> entries inserted into the system.</returns>
/// <exception cref="InvalidStudyStateOperationException"></exception>
public static IList<WorkQueue> DeleteSeries(IUpdateContext context, ServerPartition partition, string studyInstanceUid, List<string> seriesInstanceUids, string reason)
{
// Find all location of the study in the system and insert series delete request
IList<StudyStorageLocation> storageLocations = StudyStorageLocation.FindStorageLocations(partition.Key, studyInstanceUid);
IList<WorkQueue> entries = new List<WorkQueue>();
foreach (StudyStorageLocation location in storageLocations)
{
try
{
string failureReason;
if (ServerHelper.LockStudy(location.Key, QueueStudyStateEnum.WebDeleteScheduled, out failureReason))
{
// insert a delete series request
WorkQueue request = InsertDeleteSeriesRequest(context, location, seriesInstanceUids, reason);
Debug.Assert(request.WorkQueueTypeEnum.Equals(WorkQueueTypeEnum.WebDeleteStudy));
entries.Add(request);
}
else
{
throw new ApplicationException(String.Format("Unable to lock storage location {0} for deletion : {1}", location.Key, failureReason));
}
}
catch(Exception ex)
{
Platform.Log(LogLevel.Error, ex, "Errors occurred when trying to insert delete request");
if (!ServerHelper.UnlockStudy(location.Key))
throw new ApplicationException("Unable to unlock the study");
}
}
return entries;
}
示例11: DeleteStudy
/// <summary>
/// Inserts delete request(s) to delete a series in a study.
/// </summary>
/// <param name="context">The persistence context used for database connection.</param>
/// <param name="partition">The <see cref="ServerPartition"/> where the study resides</param>
/// <param name="studyInstanceUid">The Study Instance Uid of the study</param>
/// <param name="reason">The reason for deleting the series.</param>
/// <returns>A list of DeleteSeries <see cref="WorkQueue"/> entries inserted into the system.</returns>
/// <exception cref="InvalidStudyStateOperationException"></exception>
public static WorkQueue DeleteStudy(IUpdateContext context, ServerPartition partition, string studyInstanceUid,
string reason)
{
StudyStorageLocation location = FindStudyStorageLocation(context, partition, studyInstanceUid);
string failureReason;
try
{
if (LockStudyForDeletion(location.Key, out failureReason))
{
WorkQueue deleteRequest = InsertDeleteStudyRequest(context, location, reason);
if (deleteRequest == null)
throw new ApplicationException(
String.Format("Unable to insert a Delete Study request for study {0}",
location.StudyInstanceUid));
return deleteRequest;
}
}
catch (Exception ex)
{
Platform.Log(LogLevel.Error, ex, "Errors occurred when trying to insert study delete request");
if (!ReleaseDeletionLock(location.Key))
Platform.Log(LogLevel.Error, "Unable to unlock the study: " + location.StudyInstanceUid);
throw;
}
throw new ApplicationException(
String.Format("Unable to lock storage location {0} for deletion : {1}", location.Key, failureReason));
}
示例12: 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;
}
示例13: 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;
}
示例14: PhysicsEvent
/// <summary>
/// Initializes a new instance of a <see cref="PhysicsEvent"/>. This constructor
/// is intended to be used internally within the engine.
/// </summary>
/// <param name="gameContext">The current game context, or null if running on a server.</param>
/// <param name="serverContext">The current server context, or null if running on a client.</param>
/// <param name="updateContext">The current update context.</param>
protected PhysicsEvent(
IGameContext gameContext,
IServerContext serverContext,
IUpdateContext updateContext)
{
GameContext = gameContext;
ServerContext = serverContext;
UpdateContext = updateContext;
}
示例15: 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;
}