Ejemplo n.º 1
0
        /// <summary>
        /// 获取发货记录的Html
        /// </summary>
        /// <param name="info">订单显示信息</param>
        /// <param name="deliveries">发货记录</param>
        /// <returns></returns>
        public static HtmlString GetDeliveryRecordsHtml(
            this OrderDisplayInfo info, IEnumerable <OrderDelivery> deliveries)
        {
            var table = new StaticTableBuilder();

            table.Columns.Add("Serial");
            table.Columns.Add("OrderLogistics", "150");
            table.Columns.Add("LogisticsSerial", "150");
            table.Columns.Add("DeliveryOperator", "150");
            table.Columns.Add("DeliveryTime", "150");
            table.Columns.Add("Actions", "150", cssClass: "actions");
            deliveries = deliveries.OrderByDescending(d => d.CreateTime);
            var templateManager = Application.Ioc.Resolve <TemplateManager>();

            foreach (var delivery in deliveries)
            {
                var viewUrl = string.Format(info.ViewDeliveryUrlFormat, delivery.Id);
                var action  = string.IsNullOrEmpty(viewUrl) ? new HtmlString("") :
                              DefaultOrderDisplayInfoProvider.GetModalAction(templateManager,
                                                                             new T("View"), viewUrl, "fa fa-edit",
                                                                             new T("View Delivery"), "btn btn-xs btn-info");
                table.Rows.Add(new {
                    Serial           = delivery.Serial,
                    OrderLogistics   = delivery.Logistics?.Name,
                    LogisticsSerial  = delivery.LogisticsSerial,
                    DeliveryOperator = delivery.Operator?.Username,
                    DeliveryTime     = delivery.CreateTime.ToClientTimeString(),
                    Actions          = action
                });
            }
            return((HtmlString)table.ToLiquid());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取相关交易的Html
        /// </summary>
        /// <param name="info">订单显示信息</param>
        /// <returns></returns>
        public static HtmlString GetReleatedTransactionsHtml(this OrderDisplayInfo info)
        {
            var currencyManager = Application.Ioc.Resolve <CurrencyManager>();
            var orderManager    = Application.Ioc.Resolve <SellerOrderManager>();
            var table           = new StaticTableBuilder();

            table.Columns.Add("CreateTime", "150");
            table.Columns.Add("Serial");
            table.Columns.Add("PaymentApi", "150");
            table.Columns.Add("ExternalSerial", "150");
            table.Columns.Add("Amount", "150");
            table.Columns.Add("State", "150");
            table.Columns.Add("Actions", cssClass: "actions");
            var transactions    = orderManager.GetReleatedTransactions(info.Id);
            var templateManager = Application.Ioc.Resolve <TemplateManager>();

            foreach (var transaction in transactions)
            {
                var currency = currencyManager.GetCurrency(transaction.CurrencyType);
                var viewUrl  = string.Format(info.ViewTransactionUrlFormat, transaction.Id);
                var action   = string.IsNullOrEmpty(viewUrl) ? new HtmlString("") :
                               DefaultOrderDisplayInfoProvider.GetModalAction(templateManager,
                                                                              new T("View"), viewUrl, "fa fa-edit",
                                                                              new T("View Transaction"), "btn btn-xs btn-info");
                table.Rows.Add(new {
                    CreateTime     = transaction.CreateTime.ToClientTimeString(),
                    Serial         = transaction.Serial,
                    PaymentApi     = transaction.Api?.Name,
                    ExternalSerial = transaction.ExternalSerial,
                    Amount         = currency.Format(transaction.Amount),
                    State          = new T(transaction.State.GetDescription()),
                    Actions        = action
                });
            }
            return((HtmlString)table.ToLiquid());
        }