public static Internals.HistoricalTransaction GetHistoricalTransaction(HistoricalTransaction historical)
        {
            var transaction = historical?.Transaction;

            if (transaction == null)
            {
                return(null);
            }

            var transactionInternal = GetTransactionInternal(transaction, transaction.GetHash());

            return(new Internals.HistoricalTransaction
            {
                Height = historical.LedgerHeight,
                LedgerTimestamp = historical.LedgerTimestamp,
                Transaction = transactionInternal
            });
        }
        public IList <HistoricalTransaction> Build()
        {
            IList <HistoricalTransaction> historicalTransactions = new List <HistoricalTransaction>();

            while (reader.Read())
            {
                var transaction =
                    new HistoricalTransaction(reader.ToString("YearMonth"),
                                              reader.ToDecimal("Invoices"),
                                              reader.ToDecimal("NF Invoices"),
                                              reader.ToDecimal("Credits"),
                                              reader.ToDecimal("Receipts"),
                                              reader.ToDecimal("Journals_AR"), // What is Journals_NAR?
                                              reader.ToDecimal("Discounts"),
                                              reader.ToDecimal("Repurchases"),
                                              reader.ToDecimal("Overpayments"));
                historicalTransactions.Add(transaction);
            }
            return(historicalTransactions);
        }
Example #3
0
        void cffGGV_TransactionGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Expand" && ((((System.Web.UI.WebControls.GridView)(sender)).Rows).Count > 0))
            {   //assign a datasource to the child and call databind
                bool isExpanded = false;
                if ((((System.Web.UI.WebControls.GridView)(sender)).Rows[rowIndex]).Controls.Count > 0)
                {
                    isExpanded = ((Cff.SaferTrader.Web.UserControls.gGridViewControls.CffCommandField)((((System.Web.UI.WebControls.DataControlFieldCell)((((System.Web.UI.WebControls.GridView)(sender)).Rows[rowIndex]).Controls[0]))).ContainingField)).isExpanded;
                }

                HistoricalTransaction o = (HistoricalTransaction)(((IList <HistoricalTransaction>)cffGGV_TransactionGridView.DataSource)[rowIndex]);
                Date date = new Date(Convert.ToDateTime(o.YrMonth));

                if (SessionWrapper.Instance.Get != null && this.CurrentScope() == Scope.CustomerScope)
                {  //customer view
                    IList <Transaction> details = presenter.LoadTransactionHistoryDetails(date, SessionWrapper.Instance.Get.CustomerFromQueryString.Id);
                    cffGGV_TransactionGridView.BindNestedGrid(sender, details);
                }
            }
        }
Example #4
0
        public IActionResult Send()
        {
            nodeCom.UpdatePeers();
            var usr = authService.GetAuthUser(Request, Response);

            if (usr == null)
            {
                return(authService.UnAuthenticatedResult);
            }
            var from = "";

            if (Request.Form.ContainsKey("wallet"))
            {
                if (Request.Form["wallet"].ToString().Split('-').Length > 1)
                {
                    from = Request.Form["wallet"].ToString().Split('-')[1];
                }
                else
                {
                    return(authService.UnAuthenticatedResult);
                }
            }
            var wallet = context.Wallets.First(r => r.OwnerId == usr.UId && r.Address == from);

            if (wallet == null)
            {
                return(authService.UnAuthenticatedResult);
            }
            var oo  = nodeCom.SendTransaction(usr, wallet, Request.Form);
            var suc = new ActionResultViewModel();

            if (oo != null)
            {
                var ht = new HistoricalTransaction()
                {
                    State           = TransactionState.NonVerified,
                    TimeOfCreation  = DateTime.UtcNow,
                    TransactionId   = oo.Body.TransactionId,
                    TransactionJson = JsonConvert.SerializeObject(oo),
                    User            = usr
                };
                context.HistoricalTransactions.Add(ht);

                suc.Title            = "Success !";
                suc.SubTitle         = "Transaction sent successfully!";
                suc.TextClass        = "text-success";
                suc.ButtonClass      = "btn-success";
                suc.ActionButtonLink = "/Home/Wallet";
                suc.ActionButtonText = "Back to wallet";

                return(new RedirectToActionResult("Result", "Home", routeValues: suc));
            }
            else
            {
                suc.Title            = "Error !";
                suc.SubTitle         = "Transaction was not sent successfully!";
                suc.TextClass        = "text-danger";
                suc.ButtonClass      = "btn-danger";
                suc.ActionButtonLink = "/Home/Wallet";
                suc.ActionButtonText = "Back to wallet";

                return(new RedirectToActionResult("Result", "Home", routeValues: suc));
            }
        }