Esempio n. 1
0
        private void BUndo_Click(object sender, EventArgs e)
        {
            if (HistoryList.SelectedItem == null)
            {
                MessageBox.Show("Select Item");
                return;
            }
            CommandData data = new CommandData();
            String      item = HistoryList.SelectedItem.ToString();

            data.RefactorString(item);

            IStoreCommand command = StoreCommandFactory.CreateCommand(data.CmdType);
            bool          DONE    = this.invoker.UndoCommand(command, data);

            if (DONE)
            {
                MessageBox.Show("Command UnDone");
            }
            else
            {
                MessageBox.Show("Error");
            }

            BShowStoreHistory_Click(sender, e);
        }
 private void AddStore(IStoreCommand command, Store store)
 {
     store.Name  = command.Name;
     store.Phone = command.Phone;
     AddStorePictures(command, store);
     AddLocation(command, store);
     AssignToUser(command, store);
 }
        //public ObjectStoreDataService ( ) {}

        public ObjectStoreService
        (
            IDicomInstnaceStorageDataAccess dataAccess,
            IStoreCommand storeCommand
        )
        {
            DataAccess   = dataAccess;
            StoreCommand = storeCommand;
        }
Esempio n. 4
0
        public DCloudCommandResult StoreDicom
        (
            fo.DicomDataset dataset,
            InstanceMetadata metadata
        )
        {
            IStoreCommand    storeCommand = CommandFactory.CreateStoreCommand( );
            StoreCommandData storeData    = new StoreCommandData( )
            {
                Dataset = dataset, Metadata = metadata
            };

            return(storeCommand.Execute(storeData));
        }
        public Task <RunDetails> RunForEachEnabledStore(IStoreCommand command, CancellationToken cancellationToken)
        {
            RunDetails result = new RunDetails();

            foreach (IStore enabledStore in EnabledStores)
            {
                EnsureStoreInitialised(enabledStore).Wait(cancellationToken);

                var storeTaskDetails = Run(result, command, enabledStore, cancellationToken);
                result.StoreDetails.Add(storeTaskDetails);
            }

            return(Task.WhenAll(result.Tasks).ContinueWith <RunDetails>((Func <Task, RunDetails>)(t => result), cancellationToken));
        }
        private static void AddStorePictures(IStoreCommand command, Store store)
        {
            if (command.Pictures == null)
            {
                throw new PictureIsNUllOrEmptyException(StoreWxceptionMessage.StorePictureIsRequired);
            }

            foreach (var picture in command.Pictures.Select(item => new StorePicture
            {
                Name = item.Name,
                Address = item.Address,
                CreationDate = DateTime.Now,
                LastUpdateDate = DateTime.Now,
            }))
            {
                store.AddPicture(picture);
            }
        }
        public StoreTaskDetails Run(RunDetails runDetails, IStoreCommand command, IStore store, CancellationToken cancellationToken)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Task <GroupOperationCost> task        = command.DoAsync(store, cancellationToken);
            StoreTaskDetails          taskDetails = new StoreTaskDetails(command, store, task);

            task.ContinueWith(t =>
            {
                sw.Stop();
                taskDetails.Elapsed = sw.Elapsed;
                if (task.IsCompleted)
                {
                    taskDetails.Cost = task.Result;
                }
            }, cancellationToken);

            return(taskDetails);
        }
        private static void AddLocation(IStoreCommand command, Store store)
        {
            var address = command.Location.Address;

            var location = new Location
            {
                CountryName    = command.Location.Country.Name,
                StateName      = command.Location.State.Name,
                Latitude       = command.Location.Latitude,
                Longitude      = command.Location.Longitude,
                CreationDate   = DateTime.Now,
                LastUpdateDate = DateTime.Now,
                Address        = new Address(address.AddressLine, address.City, address.ZipCode)
                {
                    CreationDate   = DateTime.Now,
                    LastUpdateDate = DateTime.Now
                }
            };

            store.Location = location;
        }
 public StoreTaskDetails(IStoreCommand command, IStore store, Task task)
 {
     this.Command = command;
     this.Store   = store;
     this.Task    = task;
 }
Esempio n. 10
0
 public bool UndoCommand(IStoreCommand cmd, CommandData data)
 {
     return(cmd.undo(data));
 }
Esempio n. 11
0
 public bool DoCommand(IStoreCommand cmd, CommandData data, bool CollabMode, StoreProduct storeProduct)
 {
     return(cmd.Execute(data, storeProduct, CollabMode));
 }
Esempio n. 12
0
        private void AssignToUser(IStoreCommand command, Store store)
        {
            var user = _membershipRepository.GetUserById(command.UserId);

            store.Users.Add(user);
        }