コード例 #1
0
        private CustomerOrderInfoModel GetPrinterByOrderNumber(string customerOrderNumber)
        {
            try
            {
                var entity = _customerOrderService.PrintByCustomerOrderNumber(customerOrderNumber);
                if (entity == null)
                {
                    return(null);
                }
                var model = entity.ToModel <CustomerOrderInfoModel>();
                if (string.IsNullOrWhiteSpace(model.TrackingNumber))
                {
                    var firstOrDefault = entity.WayBillInfos.FirstOrDefault();
                    if (firstOrDefault != null)
                    {
                        model.TrackingNumber = firstOrDefault.WayBillNumber;
                    }
                }
                model.BarCode = "<img id=\"img\" src=\"/barcode.ashx?m=0&h=35&vCode=" + model.TrackingNumber + "\" alt=\"" + model.TrackingNumber + "\" style=\"width:200px;height:35px;\" />";
                entity.ShippingInfo.ToModel(model);
                var country = GetCountryList().Single(c => c.CountryCode == entity.ShippingInfo.CountryCode);
                model.CountryName        = country.Name;
                model.CountryChineseName = country.ChineseName;

                return(model);
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                return(null);
            }
        }