コード例 #1
0
        /// <summary>
        /// Скрыть колонки, не показывающие данные для переданного типа.
        /// </summary>
        /// <param name="type">Тип информации в <see cref="ExecutionMessage"/>.</param>
        public void HideColumns(ExecutionTypes type)
        {
            switch (type)
            {
            case ExecutionTypes.Tick:
            {
                OrderIdColumn.Visibility                             =
                    OrderPriceColumn.Visibility                      =
                        OrderTypeColumn.Visibility                   =
                            OrderSideColumn.Visibility               =
                                OrderStateColumn.Visibility          =
                                    TransactionColumn.Visibility     =
                                        PortfolioColumn.Visibility   =
                                            BalanceColumn.Visibility =
                                                Visibility.Collapsed;
                break;
            }

            case ExecutionTypes.Order:
            {
                TradeIdColumn.Visibility = TradePriceColumn.Visibility = Visibility.Collapsed;
                break;
            }

            case ExecutionTypes.Trade:
                break;

            case ExecutionTypes.OrderLog:
                break;

            default:
                throw new ArgumentOutOfRangeException("type");
            }
        }
コード例 #2
0
 public string StartConnector(string name, ExecutionTypes executionType)
 {
     using (TracerFactory.StartTracer(this,string.Format("StartConnector({0},{1})", name,executionType)))
     {
         return Container.GetClient().StartConnector(name, executionType); 
     }
 }
コード例 #3
0
		/// <summary>
		/// To hide columns which do not show data for the passed type.
		/// </summary>
		/// <param name="type">Information type in <see cref="ExecutionMessage"/>.</param>
		public void HideColumns(ExecutionTypes type)
		{
			switch (type)
			{
				case ExecutionTypes.Tick:
				{
					OrderIdColumn.Visibility =
					OrderPriceColumn.Visibility =
					OrderTypeColumn.Visibility =
					OrderSideColumn.Visibility =
					OrderStateColumn.Visibility =
					TransactionColumn.Visibility =
					PortfolioColumn.Visibility =
					BalanceColumn.Visibility =
						Visibility.Collapsed;
					break;
				}
				case ExecutionTypes.Order:
				{
					TradeIdColumn.Visibility = TradePriceColumn.Visibility = Visibility.Collapsed;
					break;
				}
				case ExecutionTypes.Trade:
					break;
				case ExecutionTypes.OrderLog:
					break;
				default:
					throw new ArgumentOutOfRangeException(nameof(type));
			}
		}
コード例 #4
0
 public string StartConnector(string name, ExecutionTypes executionType)
 {
     using (TracerFactory.StartTracer(this, string.Format("StartConnector({0},{1})", name, executionType)))
     {
         return(Container.GetClient().StartConnector(name, executionType));
     }
 }
コード例 #5
0
ファイル: Exporter.cs プロジェクト: JonasSyrstad/Stardust
 protected override IBatchConnector <CoordinatedData> RunExecution(ExecutionTypes executionType)
 {
     foreach (var itemId in Data)
     {
         CheckForTerminationSignal();
         var item = Kernel.GetItem(itemId);
         ExportedItems.Add((CoordinatedData)item.MasterItem);
         UpdateProgress(itemId, "Export");
     }
     Data = null;
     return(this);
 }
コード例 #6
0
 protected override IBatchConnector <CoordinatedData> RunExecution(ExecutionTypes executionType)
 {
     foreach (var nameItem in Data)
     {
         CheckForTerminationSignal();
         Kernel.UpdateItem(nameItem.Id, new CoordinatedData {
             Id = nameItem.Id, FirstName = nameItem.FirstName, LastName = nameItem.LastName
         }, Name);
         UpdateProgress(nameItem.Id, "Import");
     }
     Data = null;
     return(this);
 }
コード例 #7
0
 public void Update(
     string name,
     Types type,
     bool header,
     List <ExportColumn> columns,
     ExecutionTypes executionType)
 {
     Name          = name;
     Type          = type;
     Header        = header;
     Columns       = columns;
     ExecutionType = executionType;
 }
コード例 #8
0
 public Task <IBatchConnector <T> > ExecuteConnector(ExecutionTypes executionType)
 {
     if (IsRunning)
     {
         throw new InvalidAsynchronousStateException(string.Format("{0} is already running", Name));
     }
     ResetRunDetails();
     CheckForTerminationSignal();
     PrepareDataSet();
     Logger.SetBatchSize(RunId, ItemsToProcess, string.Format("Execution batch, type: {0}", executionType));
     CheckForTerminationSignal();
     return(RuntimeFactory.Run(() => InternalExecutor(executionType)));
 }
コード例 #9
0
 protected override IBatchConnector <CoordinatedData> RunExecution(ExecutionTypes executionType)
 {
     Thread.Sleep(100);
     foreach (var emailItem in Data)
     {
         CheckForTerminationSignal();
         Kernel.UpdateItem(emailItem.Id, new CoordinatedData {
             Email = emailItem.Email, Id = emailItem.Id
         }, Name);
         UpdateProgress(emailItem.Id, "Import");
     }
     Data = null;
     return(this);
 }
コード例 #10
0
        private void SetCommandEnableStatus(ExecutionTypes activeType = ExecutionTypes.None)
        {
            _currentExecutionType = activeType;

            switch (activeType)
            {
            case ExecutionTypes.Add:
            case ExecutionTypes.Edit:
            case ExecutionTypes.Delete:
            {
                CanCancelUser  = true;
                CanAddUserInfo = false;
                CanEditUser    = false;
                CanDeleteUser  = false;
                CanSaveUser    = true;

                IsUserListEnabled = false;

                if (activeType == ExecutionTypes.Edit)
                {
                    IsUserFormReadOnly = false;
                }
            }
            break;

            default:
            {
                CanCancelUser  = false;
                CanAddUserInfo = true;
                CanEditUser    = false;
                CanDeleteUser  = false;
                CanSaveUser    = false;

                if (SelectedUserIndex != -1)
                {
                    CanEditUser   = true;
                    CanDeleteUser = true;
                }

                IsUserListEnabled  = true;
                IsUserFormReadOnly = true;
            }
            break;
            }

            // Show New Form if execution type is Add
            UserInfoFormVisibility = activeType == ExecutionTypes.Add ? true : false;
        }
コード例 #11
0
 public void Update(
     string name,
     Types type,
     bool header,
     List <ExportColumn> columns,
     DelimiterTypes delimiterType,
     bool encloseDoubleQuotes,
     ExecutionTypes executionType)
 {
     Name                = name;
     Type                = type;
     Header              = header;
     Columns             = columns;
     DelimiterType       = delimiterType;
     EncloseDoubleQuotes = encloseDoubleQuotes;
     ExecutionType       = executionType;
 }
コード例 #12
0
 private IBatchConnector <T> InternalExecutor(ExecutionTypes executionType)
 {
     try
     {
         CheckForTerminationSignal();
         var result = RunExecution(executionType);
         IsRunning     = false;
         IsTerminating = false;
         Logger.FinalizeExecution(RunId);
         return(result);
     }
     catch (Exception)
     {
         IsRunning     = false;
         IsTerminating = false;
         throw;
     }
 }
コード例 #13
0
        public string StartConnector(string name, ExecutionTypes executionType)
        {
            Initialize(string.Format("StartConnector({0})", name));
            IBatchConnector <T> task;

            try
            {
                task = BatchProcessorFactory.GetKernel <T>().GetConnector(name);
                task.ExecuteConnector(executionType);
            }
            catch (Exception ex)
            {
                Tracer.SetAdidtionalInformation(ex.Message);
                Tracer.SetErrorState(ex);
                throw;
            }
            TearDown();
            return(task.RunId);
        }
コード例 #14
0
 public Export(
     int id,
     string name,
     Types type,
     bool header,
     List <ExportColumn> columns,
     ExecutionTypes executionType)
 {
     Id      = id;
     Name    = name;
     Type    = type;
     Header  = header;
     Columns = new List <ExportColumn>();
     columns.ForEach(column =>
     {
         column.Id = NewColumnId();
         Columns.Add(column);
     });
     ExecutionType = executionType;
 }
コード例 #15
0
 protected override IBatchConnector <CoordinatedData> RunExecution(ExecutionTypes executionType)
 {
     foreach (var itemId in _ItemsToProsess)
     {
         CheckForTerminationSignal();
         var coordinationItem = Kernel.GetItem(itemId);
         var master           = coordinationItem.MasterItem as CoordinatedData;
         if (master.IsNull())
         {
             master = new CoordinatedData {
                 Id = itemId
             };
             coordinationItem.MasterItem = master;
         }
         foreach (var source in coordinationItem.Sources)
         {
             if (source.Key == "EmailImporter")
             {
                 var data = source.Value as CoordinatedData;
                 if (data.IsInstance())
                 {
                     master.Email = data.Email;
                 }
             }
             else
             {
                 var data = source.Value as CoordinatedData;
                 if (data.IsInstance())
                 {
                     master.FirstName = data.FirstName;
                     master.LastName  = data.LastName;
                 }
             }
         }
         Kernel.SetExportItem(itemId, coordinationItem);
         UpdateProgress(itemId, "SynchronizeMaster");
     }
     _ItemsToProsess = null;
     return(this);
 }
コード例 #16
0
 public Export(
     int id,
     string name,
     Types type,
     bool header,
     List <ExportColumn> columns,
     DelimiterTypes delimiterType,
     bool encloseDoubleQuotes,
     ExecutionTypes executionType)
 {
     Id      = id;
     Name    = name;
     Type    = type;
     Header  = header;
     Columns = new List <ExportColumn>();
     columns.ForEach(column =>
     {
         column.Id = NewColumnId();
         Columns.Add(column);
     });
     DelimiterType       = delimiterType;
     EncloseDoubleQuotes = encloseDoubleQuotes;
     ExecutionType       = executionType;
 }
コード例 #17
0
 private void InitializeFields()
 {
     _userListViewCount    = 0;
     _currentExecutionType = ExecutionTypes.None;
 }
コード例 #18
0
 protected internal abstract void FillParameters(ref TDto pDto, ref DBParameter pParameter, ExecutionTypes pExecutionType);
コード例 #19
0
 IMessageStorage <ExecutionMessage> ISecurityMarketDataStorage.GetExecutionStorage(IMessageSerializer <ExecutionMessage> serializer, ExecutionTypes type)
 {
     return(new LocalMessageStorage <ExecutionMessage>(this, CreateFileName(typeof(ExecutionMessage), type), serializer));
 }
コード例 #20
0
        protected internal override void FillParameters(ref CidadeDto pDto, ref DBParameter pParameter, ExecutionTypes pExecutionType)
        {
            try
            {
                switch (pExecutionType)
                {
                case ExecutionTypes.Get:
                case ExecutionTypes.Update:
                case ExecutionTypes.Delete:
                    pParameter.AddParameter("CidadeId", pDto.CidadeId, SqlDbType.Int, ParameterDirection.Input);
                    break;
                }

                switch (pExecutionType)
                {
                case ExecutionTypes.GetByParameters:
                case ExecutionTypes.Insert:
                case ExecutionTypes.Update:
                    if (pDto.UnidadeFederacaoId > 0)
                    {
                        pParameter.AddParameter("UnidadeFederacaoId", pDto.UnidadeFederacaoId, SqlDbType.Int, ParameterDirection.Input);
                    }

                    if (!string.IsNullOrWhiteSpace(pDto.Nome))
                    {
                        pParameter.AddParameter("Nome", pDto.Nome, SqlDbType.VarChar, ParameterDirection.Input, 255);
                    }

                    if (!string.IsNullOrWhiteSpace(pDto.DDD))
                    {
                        pParameter.AddParameter("DDD", pDto.DDD, SqlDbType.VarChar, ParameterDirection.Input, 255);
                    }

                    if (!string.IsNullOrWhiteSpace(pDto.CEPInicial))
                    {
                        pParameter.AddParameter("CEPInicial", pDto.CEPInicial, SqlDbType.VarChar, ParameterDirection.Input, 255);
                    }

                    if (!string.IsNullOrWhiteSpace(pDto.CEPFinal))
                    {
                        pParameter.AddParameter("CEPFinal", pDto.CEPFinal, SqlDbType.VarChar, ParameterDirection.Input, 255);
                    }

                    if (!string.IsNullOrWhiteSpace(pDto.Classe))
                    {
                        pParameter.AddParameter("Classe", pDto.Classe, SqlDbType.VarChar, ParameterDirection.Input, 255);
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao preencher parametros do objeto Cidade. Motivo: " + ex.Message);
            }
        }
コード例 #21
0
        /// <summary>
        /// Получить хранилище транзакций для заданного инструмента.
        /// </summary>
        /// <param name="security">Инструмент.</param>
        /// <param name="type">Тип данных, информация о которых содержится <see cref="ExecutionMessage"/>.</param>
        /// <param name="drive">Хранилище. Если значение равно <see langword="null"/>, то будет использоваться <see cref="IStorageRegistry.DefaultDrive"/>.</param>
        /// <param name="format">Тип формата. По-умолчанию передается <see cref="StorageFormats.Binary"/>.</param>
        /// <returns>Хранилище транзакций.</returns>
        public IMarketDataStorage <ExecutionMessage> GetExecutionStorage(Security security, ExecutionTypes type, IMarketDataDrive drive = null, StorageFormats format = StorageFormats.Binary)
        {
            if (security == null)
            {
                throw new ArgumentNullException("security");
            }

            var securityId = security.ToSecurityId();

            return(_executionStorages.SafeAdd(Tuple.Create(securityId, type, (drive ?? DefaultDrive).GetStorageDrive(securityId, typeof(ExecutionMessage), type, format)), key =>
            {
                var secId = key.Item1;
                var mdDrive = key.Item3;

                switch (type)
                {
                case ExecutionTypes.Tick:
                    {
                        if (security is ContinuousSecurity)
                        {
                            return new ConvertableContinuousSecurityMarketDataStorage <ExecutionMessage, Trade>((ContinuousSecurity)security, null, t => t.ServerTime, t => ToSecurity(t.SecurityId), t => t.ToMessage(), t => t.Time, (s, d) => GetExecutionStorage(s, type, d, format), mdDrive);
                        }
                        else if (security is IndexSecurity)
                        {
                            return new IndexSecurityMarketDataStorage <ExecutionMessage>((IndexSecurity)security, null, d => ToSecurity(d.SecurityId), (s, d) => GetExecutionStorage(s, type, d, format), mdDrive);
                        }
                        else if (security.Board == ExchangeBoard.Associated)
                        {
                            return new ConvertableAllSecurityMarketDataStorage <ExecutionMessage, Trade>(security, null, t => t.ServerTime, t => ToSecurity(t.SecurityId), t => t.Time, (s, d) => GetExecutionStorage(s, type, d, format), mdDrive);
                        }
                        else
                        {
                            IMarketDataSerializer <ExecutionMessage> serializer;

                            switch (format)
                            {
                            case StorageFormats.Binary:
                                serializer = new TradeSerializer(key.Item1);
                                break;

                            case StorageFormats.Csv:
                                serializer = new CsvMarketDataSerializer <ExecutionMessage>(key.Item1, ExecutionTypes.Tick);
                                break;

                            default:
                                throw new ArgumentOutOfRangeException("format");
                            }

                            return new TradeStorage(security, mdDrive, serializer);
                        }
                    }

                case ExecutionTypes.Order:
                case ExecutionTypes.Trade:
                    return new ExecutionStorage(security, mdDrive, new ExecutionSerializer(secId));

                case ExecutionTypes.OrderLog:
                    {
                        IMarketDataSerializer <ExecutionMessage> serializer;

                        switch (format)
                        {
                        case StorageFormats.Binary:
                            serializer = new OrderLogSerializer(secId);
                            break;

                        case StorageFormats.Csv:
                            serializer = new CsvMarketDataSerializer <ExecutionMessage>(secId, ExecutionTypes.OrderLog);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException("format");
                        }

                        return new OrderLogStorage(security, mdDrive, serializer);
                    }

                default:
                    throw new ArgumentOutOfRangeException("type");
                }
            }));
        }
コード例 #22
0
        private static void RegisterStorage <T>(SynchronizedDictionary <Tuple <SecurityId, ExecutionTypes, IMarketDataStorageDrive>, IMarketDataStorage <T> > storages, ExecutionTypes type, IMarketDataStorage <T> storage)
        {
            if (storages == null)
            {
                throw new ArgumentNullException("storages");
            }

            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            storages.Add(Tuple.Create(storage.Security.ToSecurityId(), type, storage.Drive), storage);
        }
コード例 #23
0
 protected abstract IBatchConnector <T> RunExecution(ExecutionTypes executionType);