public void CreateMasterAccount(MasterAccountSettings settings) { using (var db = GetDBConnect()) { var account = new _master_accounts { trading_account_id = settings.TradingAccountId, account_type_id = settings.AccountTypeId, currency = settings.Currency, period = settings.Period, date_next_processing = settings.DateNextProcessing, date_previous_processing = DateTime.MinValue, amount_own = settings.AmountOwn, amount_min = settings.AmountMin, fee_management = settings.FeeMenagement, fee_success = settings.FeeSuccess, confirmation_required = settings.ConfirmationRequired, wallet_id = settings.WalletId, nickname = settings.NickName, description = settings.Description, date_open = settings.DateOpen, date_close = settings.DateClose, client_account_id = settings.ClientAccountId, login = settings.Login, isdeleted = false, isenabled = true, status = (short)AccountStatus.PendingIn, avatar = settings.Avatar }; db.Insert(account); } }
public OperationResult CreateTrustManagementMasterAccount(MasterAccountSettings settings) { Logger.Trace("Create TrustManagement master account"); return(InvokeOperations.InvokeOperation(() => { var statuses = accountService.GetAccountStatuses(settings.TradingAccountId); if (!statuses.IsSuccess) { throw new OperationException(statuses.Error, statuses.Code); } if (statuses.Result.Has(AccountStatuses.IsPropTrading)) { throw new OperationException("Not available", ResultCode.SiteOperationNotAvailable); } if (settings.AmountOwn < Convert.ToInt32(ConfigurationManager.AppSettings["MinimalTrustManagementMasterInvestAmount"])) { throw new OperationException("Not enough money ", ResultCode.NotEnoughMoney); } repository.CreateTrustManagementMasterAccount(settings); statisticService.CalculateStatisticAccount(settings.TradingAccountId); })); }