Exemplo n.º 1
0
        private void GridAccountOnUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            if (walletExplicitDetail == null || walletExplicitDetail.IsIncomplete)
            {
                return;
            }
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            // окно пополнения - снятия
            var accountShared = (AccountShared)gridAccount.rows[rowIndex].ValueObject;

            if (col.Tag != null && col.Tag is string)
            {
                if (col.Tag == ColumnTagDeposit || col.Tag == ColumnTagWithdraw)
                {
                    var deposit = col.Tag == ColumnTagDeposit;
                    var dlg     = new WalletWithdrawForm(walletExplicitDetail.wallet,
                                                         gridAccount.GetRowValues <AccountShared>(false).Select(a => a.Account).ToList(),
                                                         accountShared.Account, deposit);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        if (dlg.TargetWithdrawal > 0)
                        {
                            WithdrawOrDepositFromAccount(accountShared.Account, dlg.TargetWithdrawal, true);
                        }
                        if (dlg.TargetDespoit > 0)
                        {
                            WithdrawOrDepositFromAccount(accountShared.Account, dlg.TargetDespoit, false);
                        }
                    }
                }
            }

            if (col.Tag != null && col.Tag is string)
            {
                if (col.Tag == ColumnTagChart)
                {
                    new AccountShareHistoryForm(accountShared).ShowDialog();
                }
            }
        }
Exemplo n.º 2
0
        public void OpenInvestInPAMMDialog(PerformerStat performer, bool invest)
        {
            ScheduleTaskOnSynchronizationCompleted(state =>
            {
                if (walletExplicitDetail == null || performer == null)
                {
                    return;
                }

                var performerAccount = new Account
                {
                    ID       = performer.Account,
                    Currency = performer.DepoCurrency,
                    Balance  = (decimal)performer.Equity,
                    Equity   = (decimal)performer.Equity
                };

                // сколько можно вывести средств?
                var userShare            = walletExplicitDetail.realAccounts.FirstOrDefault(a => a.AccountId == performer.Account);
                performerAccount.Balance = userShare == null ? 0 : userShare.ShareMoneyWallet;

                // окно пополнения - снятия
                var dlg = new WalletWithdrawForm(walletExplicitDetail.wallet,
                                                 gridAccount.GetRowValues <AccountShared>(false)
                                                 .Select(a => a.Account)
                                                 .ToList(),
                                                 performerAccount, true);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (dlg.TargetWithdrawal > 0)
                {
                    InvestInPAMM(performer, dlg.TargetWithdrawal, false, dlg.WithdrawAll);
                }
                if (dlg.TargetDespoit > 0)
                {
                    InvestInPAMM(performer, dlg.TargetDespoit, true, dlg.WithdrawAll);
                }
            });
        }
Exemplo n.º 3
0
        private void GridAccountOnUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            if (walletExplicitDetail == null || walletExplicitDetail.IsIncomplete) return;
            if (e.Button != MouseButtons.Left) return;

            // окно пополнения - снятия
            var accountShared = (AccountShared)gridAccount.rows[rowIndex].ValueObject;
            if (col.Tag != null && col.Tag is string)
            if (col.Tag == ColumnTagDeposit || col.Tag == ColumnTagWithdraw)
            {
                var deposit = col.Tag == ColumnTagDeposit;
                var dlg = new WalletWithdrawForm(walletExplicitDetail.wallet,
                    gridAccount.GetRowValues<AccountShared>(false).Select(a => a.Account).ToList(),
                    accountShared.Account, deposit);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    if (dlg.TargetWithdrawal > 0)
                        WithdrawOrDepositFromAccount(accountShared.Account, dlg.TargetWithdrawal, true);
                    if (dlg.TargetDespoit > 0)
                        WithdrawOrDepositFromAccount(accountShared.Account, dlg.TargetDespoit, false);
                }
            }

            if (col.Tag != null && col.Tag is string)
            if (col.Tag == ColumnTagChart)
            {
                new AccountShareHistoryForm(accountShared).ShowDialog();
            }
        }
Exemplo n.º 4
0
        public void OpenInvestInPAMMDialog(PerformerStat performer, bool invest)
        {
            ScheduleTaskOnSynchronizationCompleted(state =>
                {
                    if (walletExplicitDetail == null || performer == null) return;

                    var performerAccount = new Account
                        {
                            ID = performer.Account,
                            Currency = performer.DepoCurrency,
                            Balance = (decimal) performer.Equity,
                            Equity = (decimal) performer.Equity
                        };

                    // сколько можно вывести средств?
                    var userShare = walletExplicitDetail.realAccounts.FirstOrDefault(a => a.AccountId == performer.Account);
                    performerAccount.Balance = userShare == null ? 0 : userShare.ShareMoneyWallet;

                    // окно пополнения - снятия
                    var dlg = new WalletWithdrawForm(walletExplicitDetail.wallet,
                                                     gridAccount.GetRowValues<AccountShared>(false)
                                                                .Select(a => a.Account)
                                                                .ToList(),
                                                     performerAccount, true);
                    if (dlg.ShowDialog() != DialogResult.OK) return;

                    if (dlg.TargetWithdrawal > 0)
                        InvestInPAMM(performer, dlg.TargetWithdrawal, false, dlg.WithdrawAll);
                    if (dlg.TargetDespoit > 0)
                        InvestInPAMM(performer, dlg.TargetDespoit, true, dlg.WithdrawAll);
                });
        }