当前位置: 首页>>代码示例>>C#>>正文


C# IUpdateContext类代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:nhannd,项目名称:Xian,代码行数:45,代码来源:UserImporter.cs

示例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");
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:36,代码来源:InsertArchiveStudyStorageCommand.cs

示例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);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:36,代码来源:InsertFilesystemStudyStorageCommand.cs

示例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);
     }
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:13,代码来源:DefaultSensorEngine.cs

示例5: Update

 public void Update(IGameContext gameContext, IUpdateContext updateContext)
 {
     using (this.m_Profiler.Measure("resize_window"))
     {
         gameContext.ResizeWindow(800, 600);
     }
 }
开发者ID:RedpointGames,项目名称:Protogame.Template.Platformer,代码行数:7,代码来源:PROJECT_SAFE_NAMEWorld.cs

示例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;
        }
开发者ID:yjsyyyjszf,项目名称:ClearCanvas-1,代码行数:36,代码来源:StudyEditorHelper.cs

示例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");
        }
开发者ID:nhannd,项目名称:Xian,代码行数:26,代码来源:UpdateWorkQueueCommand.cs

示例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;
 }
开发者ID:hach-que,项目名称:Protogame.Examples,代码行数:31,代码来源:Player.cs

示例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;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:32,代码来源:AuthorityTokenImporter.cs

示例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;
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:43,代码来源:StudyEditorHelper.cs

示例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));
        }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:43,代码来源:StudyDeleteHelper.cs

示例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;
 }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:9,代码来源:ServerPartitionDataAccess.gen.cs

示例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;
 }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:9,代码来源:DataAccessGroup.gen.cs

示例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;
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:16,代码来源:PhysicsEvent.cs

示例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;
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:9,代码来源:StudyDataAccess.gen.cs


注:本文中的IUpdateContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。