Beispiel #1
0
        public OperationResult AddProvider(long accountId, string nickname, string description, decimal commission)
        {
            return(InvokeOperations.InvokeOperation(() =>
            {
                Logger.Trace("Add logger, account id - {0}, nickname - {1}", accountId, nickname);

                var accountInformation = accService.GetMt4AccountInfo(accountId);
                if (!accountInformation.IsSuccess)
                {
                    throw new OperationException(accountInformation.Error, accountInformation.Code);
                }
                var statuses = accService.GetAccountStatuses(accountId);
                if (!statuses.IsSuccess)
                {
                    throw new OperationException(statuses.Error, statuses.Code);
                }
                if (statuses.Result.Has(AccountStatuses.IsPropTrading))
                {
                    throw new OperationException("Not available", ResultCode.SiteOperationNotAvailable);
                }

                signalServiceRepository.AddProvider(accountInformation.Result.ClientId,
                                                    accountId,
                                                    nickname,
                                                    true,
                                                    (int)accountInformation.Result.AccountTypeId,
                                                    accountInformation.Result.Login,
                                                    description,
                                                    accountInformation.Result.Avatar,
                                                    accountInformation.Result.Currency,
                                                    commission);

                Logger.Trace("Provider added (account {0})", accountId);
            }));
        }