Пример #1
0
        private void CargaDatos(string sortExpression, SortDirection sortDirection)
        {
            ulong blockNumber = Convert.ToUInt64(ViewState["blockNumber"]);

            MainService.SearchParameter searchParameter = new MainService.SearchParameter()
            {
                BlockNumber = blockNumber
            };
            List <MainService.TransactionDomain> items = items = mainService.GetTransactionsByBlockNumber(searchParameter).ToList <MainService.TransactionDomain>();

            if (sortExpression != "")
            {
                if (ViewState["e.SortDirection"] == null)
                {
                    ViewState["e.SortDirection"] = sortDirection.ToString();
                }
                string sortDir = ViewState["e.SortDirection"].ToString();
                items = Helpers.Util.OrderByField(items.AsQueryable(), sortExpression, sortDir == "Ascending").ToList();
            }

            lblResultActivity.InnerText = "Result of transactions. Transactions found: " + items.Count;

            gdvTransactions.DataSource = items;
            gdvTransactions.DataBind();
        }
Пример #2
0
        private void CargaDatos(string sortExpression, SortDirection sortDirection)
        {
            Int64?FiltroFechaDesde = ViewState["FiltroFechaDesde"] == null ? (Int64?)null : Convert.ToInt64(ViewState["FiltroFechaDesde"]);

            if (String.IsNullOrEmpty(txtEDN.Text))
            {
                lblStatus.Text = "Address is a mandatory field";
                return;
            }

            MainService.SearchParameter searchParameter = new MainService.SearchParameter()
            {
                Any = txtEDN.Text, From = (ulong)FiltroFechaDesde
            };

            List <MainService.ENSHistoryDomain> items = HttpContext.Current.Cache[ConstantsHelper.cacheKeyActivity] as List <MainService.ENSHistoryDomain>;
            string hexAddr = "N/A";

            if (items == null)
            {
                items   = mainService.GetHistoryAny(searchParameter).ToList <MainService.ENSHistoryDomain>();
                hexAddr = items.First().Address;
                if (items != null & items.First().NumberOfTransactions > 0)
                {
                    HttpContext.Current.Cache.Insert(ConstantsHelper.cacheKeyActivity, items, null, DateTime.Now.AddMinutes(180), TimeSpan.Zero);
                }
                else if (items != null & items.First().NumberOfTransactions == 0)
                {
                    lblStatus.Text = "Address does not exist.";
                    return;
                }
                else if (items != null & items.First().NumberOfTransactions == -1)
                {
                    lblStatus.Text = "It seems domain does not exist: " + txtEDN.Text;
                    return;
                }
                else if (items != null & items.First().NumberOfTransactions == -2)
                {
                    lblStatus.Text = "No records found for " + txtEDN.Text + " / Hex Address: " + hexAddr;
                    return;
                }
            }


            if (sortExpression != "")
            {
                if (ViewState["e.SortDirection"] == null)
                {
                    ViewState["e.SortDirection"] = sortDirection.ToString();
                }
                string sortDir = ViewState["e.SortDirection"].ToString();
                items = Helpers.Util.OrderByField(items.AsQueryable(), sortExpression, sortDir == "Ascending").ToList();
            }

            lblResultActivity.InnerText = "Result of activity. Results returned: " + items.Count + " for hex address: " + hexAddr;

            gdvActivity.DataSource = items;
            gdvActivity.DataBind();
        }