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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
public ActionResult UpdateDfr() { string url; HtmlNodeCollection colNode; string resp; bool parseResult; decimal rate; var currencyPair = _context.CurrencyPairView; DateTime today = Utility.GetLocalDateTime().Date; var dfrList = _context.Dfr.Where(m => m.TradeDate == today); _context.RemoveRange(dfrList); foreach (var cp in currencyPair) { if (cp.CurrencyName1 == "ETH" || cp.CurrencyName1 == "UST" || cp.CurrencyName2 == "ETH" || cp.CurrencyName2 == "UST") { string currFrom = cp.CurrencyName1 == "UST" ? "USDT" : cp.CurrencyName1; string currTo = cp.CurrencyName2 == "UST" ? "USDT" : cp.CurrencyName2; url = "https://min-api.cryptocompare.com/data/price?fsym=" + currFrom + "&tsyms=" + currTo; resp = getWebResponse(url); var result = Regex.Match(resp, @"\d+(\.\d+)?").Value; parseResult = decimal.TryParse(result, out rate); if (parseResult) { Dfr dfr = new Dfr(); dfr.TradeDate = Utility.GetLocalDateTime().Date; dfr.CurrencyPairID = cp.id; dfr.Rate = rate; dfr.DateTimeAdded = Utility.GetLocalDateTime(); dfr.DateTimeModified = Utility.GetLocalDateTime(); _context.Add(dfr); } } else { url = "https://xecdapi.xe.com/v1/convert_from.xml/?from=" + cp.CurrencyName1 + "&to=" + cp.CurrencyName2; colNode = getNodes(url, "//to/rate/mid"); if (colNode != null) { string s = colNode[0].InnerText; parseResult = decimal.TryParse(s, NumberStyles.Float, CultureInfo.CreateSpecificCulture("en-US"), out rate); if (parseResult) { Dfr dfr = new Dfr(); dfr.TradeDate = Utility.GetLocalDateTime().Date; dfr.CurrencyPairID = cp.id; dfr.Rate = rate; dfr.DateTimeAdded = Utility.GetLocalDateTime(); dfr.DateTimeModified = Utility.GetLocalDateTime(); _context.Add(dfr); } } } } _context.SaveChanges(); //var txn = _context.TxnCompleteView.Where(x => x.id == txnID).FirstOrDefault(); return(Json(null)); }
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)); }