コード例 #1
0
        public async Task <IActionResult> Create([Bind("id,ReferenceNo,SlipDate,ProviderTradingProfileID,TxnID,AccountBankAccountID,SenderID,SlipAmount,ActualAmount,DateTimeModified,DateTimeAdded")] Slip slip)
        {
            if (ModelState.IsValid)
            {
                slip.DateTimeModified = Utility.GetLocalDateTime();
                slip.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(slip);
                await _context.SaveChangesAsync();

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////
                //update AccountTxn
                if (slip.ActualAmount != null && slip.ActualAmount > 0)
                {
                    AccountTxn accountTxn = new AccountTxn();
                    accountTxn.Type                 = "S";
                    accountTxn.ReferenceID          = slip.id;
                    accountTxn.AccountBankAccountID = slip.AccountBankAccountID;
                    accountTxn.AmountCredit         = slip.ActualAmount;
                    accountTxn.DateTimeModified     = Utility.GetLocalDateTime();
                    accountTxn.DateTimeAdded        = Utility.GetLocalDateTime();
                    _context.Add(accountTxn);
                    await _context.SaveChangesAsync();
                }
                /////////////////////////////////////////////////////////////////////////////
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.ProviderTradingProfile = new SelectList(_context.TxnView.ToList().Where(x => x.Type != "L").GroupBy(x => x.ProviderTradingProfileID).Select(x => x.First()).OrderBy(x => x.ProviderTradingProfileName), "ProviderTradingProfileID", "ProviderTradingProfileName");
            ViewBag.AccountBankAccount     = new SelectList(_context.AccountBankAccount.OrderBy(x => x.AccountName).ToList(), "id", "AccountName");

            return(View(slip));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("id,Type,ReferenceID,AccountBankAccountID,AmountCredit,AmountDebit,DateTimeModified,DateTimeAdded")] AccountTxn accountTxn)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accountTxn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountTxn));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ProviderTradingProfileID,ProviderTradingProfileName,AmountReceivable,CurrencyName2,AmountReceivableUSD,Rate")] ReportAccountReceivable reportAccountReceivable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportAccountReceivable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportAccountReceivable));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("id,AccountName,CurrencyName,Balance,BalanceUSD,Rate")] ReportAccountBalance reportAccountBalance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportAccountBalance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportAccountBalance));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,ProviderName,TotalProviderExpectedPayInAmount,TotalSlipAmount,MissingSlipAmount")] ReportProvider reportProvider)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportProvider);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportProvider));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("Id,AccountName,TotalClientAmountOut")] ReportAccount reportAccount)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportAccount));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("TxnID,ProviderPayinUSD,ClientPayoutUSD,IntroducerCommissionUSD,ReferenceNo,TradeDate,ClientTradingProfileName,ClientCurrencyNameOut,ClientAmountOut,GrossProfitUSD,GrossProfitUSDPct")] ReportTxn reportTxn)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportTxn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportTxn));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("ClientTradingProfileID,ClientTradingProfileName,ClientCurrencyNameOut,TradeDate,ClientAmountUncompleted,ClientAmountUncompletedUSD,Rate")] ReportAccountPayable reportAccountPayable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportAccountPayable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reportAccountPayable));
        }
コード例 #9
0
ファイル: AccountController.cs プロジェクト: k2y2/trading
        public async Task <IActionResult> Create([Bind("id,AccountName,DateTimeModified,DateTimeAdded")] Account account)
        {
            if (ModelState.IsValid)
            {
                account.DateTimeModified = Utility.GetLocalDateTime();
                account.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(account);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
コード例 #10
0
ファイル: ClientController.cs プロジェクト: k2y2/trading
 public async Task<IActionResult> Create([Bind("id,ClientName,ClientLegalName,ClientTypeID,DateTimeModified,DateTimeAdded")] Client client)
 {
     if (ModelState.IsValid)
     {
         client.DateTimeModified = Utility.GetLocalDateTime();
         client.DateTimeAdded = Utility.GetLocalDateTime();
         _context.Add(client);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     ViewBag.ClientType = new SelectList(_context.ClientType.ToList(), "id", "ClientTypeName");
     return View(client);
 }
コード例 #11
0
        public async Task <IActionResult> Create([Bind("id,CurrencyName,DateTimeModified,DateTimeAdded")] Currency currency)
        {
            if (ModelState.IsValid)
            {
                currency.DateTimeModified = Utility.GetLocalDateTime();
                currency.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(currency);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(currency));
        }
コード例 #12
0
        public async Task <IActionResult> Create([Bind("id,IntroducerName,IntroducerLegalName,DateTimeModified,DateTimeAdded")] Introducer introducer)
        {
            if (ModelState.IsValid)
            {
                introducer.DateTimeModified = Utility.GetLocalDateTime();
                introducer.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(introducer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(introducer));
        }
コード例 #13
0
        public async Task <IActionResult> Create([Bind("id,SenderName,ProviderID,Unit,AddressLine1,AddressLine2,City,Country,PostalCode,DirectorFirstName,DirectorLastName,DateTimeModified,DateTimeAdded")] Sender sender)
        {
            if (ModelState.IsValid)
            {
                sender.DateTimeModified = Utility.GetLocalDateTime();
                sender.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(sender);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Provider = new SelectList(_context.Provider.OrderBy(m => m.ProviderName).ToList(), "id", "ProviderName");
            return(View(sender));
        }
コード例 #14
0
        public async Task <IActionResult> Create([Bind("id,TradeDate,CurrencyPairID,Rate,DateTimeModified,DateTimeAdded")] Dfr dfr)
        {
            if (ModelState.IsValid)
            {
                dfr.DateTimeModified = Utility.GetLocalDateTime();
                dfr.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(dfr);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.CurrencyPair = new SelectList(_context.CurrencyPair.OrderBy(x => x.CurrencyPairName).ToList(), "id", "CurrencyPairName");
            return(View(dfr));
        }
コード例 #15
0
        public async Task <IActionResult> Create([Bind("id,UserName,Password,Role,DateTimeModified,DateTimeAdded")] User user)
        {
            if (ModelState.IsValid)
            {
                user.DateTimeModified = Utility.GetLocalDateTime();
                user.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Role = Role;
            return(View(user));
        }
コード例 #16
0
        public async Task <IActionResult> Create([Bind("id,TradeDate,ProviderTradingProfileID,Rate,DateTimeModified,DateTimeAdded")] CostRate costRate)
        {
            if (ModelState.IsValid)
            {
                costRate.DateTimeModified = Utility.GetLocalDateTime();
                costRate.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(costRate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfile.OrderBy(x => x.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName");

            return(View(costRate));
        }
コード例 #17
0
        public async Task <IActionResult> Create([Bind("id,ProviderID,ProviderTradingProfileName,CurrencyPairID,DateTimeModified,DateTimeAdded")] ProviderTradingProfile providerTradingProfile)
        {
            if (ModelState.IsValid)
            {
                providerTradingProfile.DateTimeModified = Utility.GetLocalDateTime();
                providerTradingProfile.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(providerTradingProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Provider     = new SelectList(_context.Provider.OrderBy(m => m.ProviderName).ToList(), "id", "ProviderName");
            ViewBag.CurrencyPair = new SelectList(_context.CurrencyPair.OrderBy(m => m.CurrencyPairName).ToList(), "id", "CurrencyPairName");

            return(View(providerTradingProfile));
        }
コード例 #18
0
        public async Task <IActionResult> Create([Bind("id,ClientTradingProfileID,IntroducerID,IntroducerCommissionTypeID,IntroducerCommissionRate,DateTimeModified,DateTimeAdded")] ClientTradingProfileIntroducerMap clientTradingProfileIntroducerMap)
        {
            if (ModelState.IsValid)
            {
                clientTradingProfileIntroducerMap.DateTimeModified = Utility.GetLocalDateTime();
                clientTradingProfileIntroducerMap.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(clientTradingProfileIntroducerMap);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.ClientTradingProfile     = new SelectList(_context.ClientTradingProfile.OrderBy(m => m.ClientTradingProfileName).ToList(), "id", "ClientTradingProfileName");
            ViewBag.Introducer               = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
            ViewBag.IntroducerCommissionType = new SelectList(_context.IntroducerCommissionType.ToList(), "id", "IntroducerCommissionTypeName");

            return(View(clientTradingProfileIntroducerMap));
        }
コード例 #19
0
        public async Task <IActionResult> Create([Bind("id,IntroducerID,AccountName,CurrencyID,AccountTypeID,AccountHolderName,AccountHolderAddress,AccountNo,IBAN,BSB,BankCode,BankName,SWIFT,CountryID,BranchAddress,Reference,DateTimeModified,DateTimeAdded")] IntroducerBankAccount introducerBankAccount)
        {
            if (ModelState.IsValid)
            {
                introducerBankAccount.DateTimeModified = Utility.GetLocalDateTime();
                introducerBankAccount.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(introducerBankAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Introducer  = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
            ViewBag.Currency    = new SelectList(_context.Currency.OrderBy(m => m.CurrencyName).ToList(), "id", "CurrencyName");
            ViewBag.AccountType = new SelectList(_context.AccountType.ToList(), "id", "AccountTypeName");
            ViewBag.Country     = new SelectList(_context.Country.OrderBy(m => m.CountryName).ToList(), "id", "CountryName");

            return(View(introducerBankAccount));
        }
コード例 #20
0
        public async Task <IActionResult> Create([Bind("id,ReferenceNo,Type,LinkedDepositID,TradeDate,ClientTradingProfileID,Status,ClientPriceRate,ClientCurrencyPairID,ClientDfrRate,ClientUniqueDfr,ClientExRate,ClientCurrencyIDIn,ClientAmountIn,ClientCurrencyIDOut,ClientAmountOut,ClientPayOutAccountID,ProviderTradingProfileID,ProviderCurrencyID,ProviderCostDate,ProviderCostRate,ProviderExpectedPayInAmount,ProviderBankAccountID,Remark,PayoutDone,PayoutDoneByID,MiniAccount,OvernightDeposit,DateTimeModified,ModifiedByID,DateTimeAdded,AddedByID")] Txn txn)
        {
            if (ModelState.IsValid)
            {
                txn.DateTimeModified = Utility.GetLocalDateTime();
                txn.DateTimeAdded    = Utility.GetLocalDateTime();
                txn.ModifiedByID     = HttpContext.Session.GetInt32("UserID");
                txn.AddedByID        = HttpContext.Session.GetInt32("UserID");
                if (txn.PayoutDone)
                {
                    txn.PayoutDoneByID = HttpContext.Session.GetInt32("UserID");
                }
                _context.Add(txn);

                if (txn.Type == "L")
                {
                    var deposit = await _context.Txn.FindAsync(txn.LinkedDepositID);

                    deposit.Status           = "C";
                    deposit.DateTimeModified = Utility.GetLocalDateTime();
                    _context.Update(deposit);
                }

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.ClientTradingProfile = new SelectList(_context.ClientTradingProfile.OrderBy(x => x.ClientTradingProfileName).ToList(), "id", "ClientTradingProfileName");
            ViewBag.CurrencyPair         = new SelectList(_context.CurrencyPair.OrderBy(x => x.CurrencyPairName).ToList(), "id", "CurrencyPairName");
            ViewBag.Currency             = new SelectList(_context.Currency.OrderBy(x => x.CurrencyName).ToList(), "id", "CurrencyName");
            ViewBag.ProviderBankAccount  = new SelectList(_context.ProviderBankAccount.OrderBy(x => x.AccountName).ToList(), "id", "AccountName");
            //ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfile.OrderBy(x => x.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName");
            ViewBag.Deposit = new SelectList(_context.Txn.ToList().Where(t => t.Type == "D" && t.Status != "C").OrderBy(x => x.ReferenceNo), "id", "ReferenceNo");
            ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfileView.OrderBy(x => x.ProviderTradingProfileName)
                                                            .Select(x => new
            {
                id   = x.id,
                text = x.ProviderTradingProfileName + ", " + x.CurrencyPairName
            }).ToList(), "id", "text");

            return(View(txn));
        }
コード例 #21
0
        public async Task <IActionResult> Create([Bind("id,ReferenceNo,AccountBankAccountIDFrom,AccountBankAccountIDTo,Amount,Rate,ActualDate,Reference,DateTimeModified,DateTimeAdded")] AccountTransfer accountTransfer)
        {
            if (ModelState.IsValid)
            {
                accountTransfer.DateTimeModified = Utility.GetLocalDateTime();
                accountTransfer.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(accountTransfer);
                await _context.SaveChangesAsync();

                /////////////////////////////////////////////////////////////////////////////
                //update AccountTxn
                AccountTxn accountTxnFrom = new AccountTxn();
                accountTxnFrom.Type                 = "T";
                accountTxnFrom.ReferenceID          = accountTransfer.id;
                accountTxnFrom.AccountBankAccountID = accountTransfer.AccountBankAccountIDFrom;
                accountTxnFrom.AmountDebit          = accountTransfer.Amount;
                accountTxnFrom.DateTimeModified     = Utility.GetLocalDateTime();
                accountTxnFrom.DateTimeAdded        = Utility.GetLocalDateTime();
                _context.Add(accountTxnFrom);

                AccountTxn accountTxnTo = new AccountTxn();
                accountTxnTo.Type                 = "T";
                accountTxnTo.ReferenceID          = accountTransfer.id;
                accountTxnTo.AccountBankAccountID = accountTransfer.AccountBankAccountIDTo;
                accountTxnTo.AmountCredit         = accountTransfer.Amount * accountTransfer.Rate;
                accountTxnTo.DateTimeModified     = Utility.GetLocalDateTime();
                accountTxnTo.DateTimeAdded        = Utility.GetLocalDateTime();
                _context.Add(accountTxnTo);
                /////////////////////////////////////////////////////////////////////////////

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.AccountBankAccount = new SelectList(_context.AccountBankAccount.OrderBy(m => m.AccountName).ToList(), "id", "AccountName");

            return(View(accountTransfer));
        }
コード例 #22
0
        public async Task <IActionResult> Create([Bind("id,ReferenceNo,AccountBankAccountID,Amount,ActualDate,Reference,DateTimeModified,DateTimeAdded")] AccountAdjust accountAdjust)
        {
            if (ModelState.IsValid)
            {
                accountAdjust.DateTimeModified = Utility.GetLocalDateTime();// Utility.GetLocalDateTime();
                accountAdjust.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(accountAdjust);
                await _context.SaveChangesAsync();

                /////////////////////////////////////////////////////////////////////////////
                //update AccountTxn
                AccountTxn accountTxn = new AccountTxn();
                accountTxn.Type                 = "A";
                accountTxn.ReferenceID          = accountAdjust.id;
                accountTxn.AccountBankAccountID = accountAdjust.AccountBankAccountID;
                if (accountAdjust.Amount >= 0)
                {
                    accountTxn.AmountCredit = accountAdjust.Amount;
                }
                else
                {
                    accountTxn.AmountDebit = Math.Abs(accountAdjust.Amount);
                }

                accountTxn.DateTimeModified = Utility.GetLocalDateTime();
                accountTxn.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(accountTxn);
                /////////////////////////////////////////////////////////////////////////////

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.AccountBankAccount = new SelectList(_context.AccountBankAccount.OrderBy(m => m.AccountName).ToList(), "id", "AccountName");
            return(View(accountAdjust));
        }
コード例 #23
0
        public async Task <IActionResult> Create([Bind("id,ReferenceNo,TxnID,ClientPayoutAmount,ClientPayoutUSDRate,ProviderPayinUSDRate,UsedCurrencyID,UsedAmount,UsedClientPayoutFXRate,UsedUSDRate,AccountBankAccountID,DateTimeModified,DateTimeAdded")] Payout payout)
        {
            if (ModelState.IsValid)
            {
                payout.DateTimeModified = Utility.GetLocalDateTime();
                payout.DateTimeAdded    = Utility.GetLocalDateTime();

                _context.Add(payout);
                await _context.SaveChangesAsync();

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////
                //check ClientPayoutMissing, update Status
                var reportTxn = await _context.ReportTxnOriginal.AsNoTracking().SingleOrDefaultAsync(m => m.TxnID == payout.TxnID);

                if (reportTxn != null)
                {
                    var txn = await _context.Txn.AsNoTracking().SingleOrDefaultAsync(m => m.id == payout.TxnID);

                    if (txn != null)
                    {
                        if (reportTxn.ClientPayoutMissing < reportTxn.ClientAmountOut && reportTxn.ClientPayoutMissing > 0)
                        {
                            txn.Status = "P";
                        }
                        else if (reportTxn.ClientPayoutMissing <= 0)
                        {
                            txn.Status = "C";
                        }
                        else
                        {
                            txn.Status = "";
                        }

                        _context.Update(txn);
                        await _context.SaveChangesAsync();
                    }
                }
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////
                //update AccountTxn
                AccountTxn accountTxn = new AccountTxn();
                accountTxn.Type                 = "P";
                accountTxn.ReferenceID          = payout.id;
                accountTxn.AccountBankAccountID = payout.AccountBankAccountID;
                accountTxn.AmountDebit          = payout.ClientPayoutAmount;
                accountTxn.DateTimeModified     = Utility.GetLocalDateTime();
                accountTxn.DateTimeAdded        = Utility.GetLocalDateTime();
                _context.Add(accountTxn);
                await _context.SaveChangesAsync();

                /////////////////////////////////////////////////////////////////////////////
                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.ClientTradingProfile = new SelectList(_context.TxnView.Where(t => t.Type != "D" && t.Status != "C" && t.PayoutDone)
                                                          .Select(t => new
            {
                id   = t.ClientTradingProfileID,
                text = t.ClientTradingProfileName
            }).Distinct().OrderBy(t => t.text).ToList(), "id", "text");

            ViewBag.Txn = new SelectList(_context.TxnView.Where(t => t.Type != "D" && t.Status != "C" && t.PayoutDone).OrderBy(m => m.ReferenceNo)
                                         .Select(t => new
            {
                id   = t.id,
                text = t.ClientTradingProfileName + ", " + t.TradeDate.ToString() + ", " + (t.ClientAmountOut.ToString() ?? "") + ", " + (t.ClientCurrencyNameOut ?? "") + ", " + t.ReferenceNo
            }).ToList(), "id", "text");
            ViewBag.Currency           = new SelectList(_context.Currency.OrderBy(m => m.CurrencyName).ToList(), "id", "CurrencyName");
            ViewBag.AccountBankAccount = new SelectList(_context.AccountBankAccount.OrderBy(x => x.AccountName).ToList(), "id", "AccountName");

            return(View(payout));
        }