protected void OnCopyUri(string id)
        {
            if (string.IsNullOrEmpty(id) || SelectedItem == null)
            {
                return;
            }

            if (id == "address")
            {
                ClipboardUtil.SetText(SelectedItem.Payment.Address);
            }
            else if (id == "amount")
            {
                ClipboardUtil.SetText((SelectedItem.Payment.Amount / Math.Pow(10, 8)).ToString("0.00000000"));
            }
            else if (id == "label")
            {
                PaymentToMarkConverter converter = new PaymentToMarkConverter();
                var mark = converter.Convert(SelectedItem.Payment, typeof(object), null, new System.Globalization.CultureInfo(1033));
                if (mark != null)
                {
                    ClipboardUtil.SetText(mark.ToString());
                }
            }
            else if (id == "txid")
            {
                ClipboardUtil.SetText(SelectedItem.Payment.TxId);
            }
        }
Beispiel #2
0
        public static string GetCsvContent(this System.Collections.Generic.IEnumerable <TradeRecordInfo> tradeRecordInfos)
        {
            var state  = LanguageService.Default.GetLanguageValue("page_tradeRecord_state");
            var time   = LanguageService.Default.GetLanguageValue("page_tradeRecord_time");
            var type   = LanguageService.Default.GetLanguageValue("page_tradeRecord_type");
            var tag    = LanguageService.Default.GetLanguageValue("page_tradeRecord_tag");
            var amount = LanguageService.Default.GetLanguageValue("page_tradeRecord_amount");

            string        header        = string.Format("{0},{1},{2},{3},{4}", state, time, type, tag, amount);
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(header);

            var stateConverter  = new ConfirmationToStatusDetail();
            var timeConverter   = new TimestampToDateTimeConverter();
            var typeConverter   = new CategoryToStringConverter();
            var markConverter   = new PaymentToMarkConverter();
            var amountConverter = new PaymentToTradeAmountConverter();

            var cultureInfo = new System.Globalization.CultureInfo(1033);

            foreach (var item in tradeRecordInfos)
            {
                var txt_state  = stateConverter.Convert(item.Payment.Confirmations, typeof(object), null, cultureInfo);
                var txt_time   = timeConverter.Convert(item.Payment.Time, typeof(object), "yyyy-MM-dd HH:mm:ss", cultureInfo);
                var txt_type   = typeConverter.Convert(item.Payment.Category, typeof(object), null, cultureInfo);
                var txt_mark   = markConverter.Convert(item.Payment, typeof(object), null, cultureInfo);
                var txt_amount = amountConverter.Convert(item.Payment, typeof(object), null, cultureInfo);

                string line = string.Format("{0},{1},{2},{3},{4}", txt_state, txt_time, txt_type, txt_mark, txt_amount);
                stringBuilder.AppendLine(line);
            }

            return(stringBuilder.ToString());
        }
Beispiel #3
0
        public TradeRecordDetail(Payment payment)
        {
            if (payment == null)
            {
                return;
            }

            TradeFee           = payment.Fee;
            base.Confirmations = payment.Confirmations;
            base.Time          = payment.Time;
            base.Fee           = payment.Fee;
            base.TxId          = payment.TxId;
            base.TotalInput    = payment.TotalInput;
            base.TotalOutput   = payment.TotalOutput;
            base.Category      = payment.Category;
            base.Address       = payment.Address;

            var categoryType = (PaymentCategoryType)Enum.Parse(typeof(PaymentCategoryType), payment.Category);
            var converter    = new PaymentToMarkConverter();

            switch (categoryType)
            {
            case PaymentCategoryType.generate:
                break;

            case PaymentCategoryType.receive:
                break;

            case PaymentCategoryType.send:
                var mark = converter.Convert(payment, typeof(object), null, new System.Globalization.CultureInfo(1033));
                if (mark != null)
                {
                    To = mark.ToString();
                }
                TradeAmount   = payment.Amount;
                ArrivalAmount = payment.TotalOutput;
                break;

            case PaymentCategoryType.self:
                To            = LanguageService.Default.GetLanguageValue("converter_disabled");
                TradeAmount   = payment.TotalOutput;
                ArrivalAmount = payment.TotalOutput;
                Address       = LanguageService.Default.GetLanguageValue("self");
                break;

            default:
                break;
            }
        }