Ejemplo n.º 1
0
 private void BindInvoiceInfo(OrderInfo order)
 {
     if (!string.IsNullOrEmpty(order.InvoiceTitle))
     {
         UserInvoiceDataInfo userInvoiceDataInfo = order.InvoiceInfo;
         if (userInvoiceDataInfo == null)
         {
             userInvoiceDataInfo = new UserInvoiceDataInfo
             {
                 InvoiceType           = order.InvoiceType,
                 InvoiceTaxpayerNumber = order.InvoiceTaxpayerNumber,
                 InvoiceTitle          = order.InvoiceTitle
             };
         }
         this.litRegisterAddress.Text       = userInvoiceDataInfo.RegisterAddress.ToNullString();
         this.litRegisterTel.Text           = userInvoiceDataInfo.RegisterTel.ToNullString();
         this.litOpenBank.Text              = userInvoiceDataInfo.OpenBank.ToNullString();
         this.litBankName.Text              = userInvoiceDataInfo.BankAccount.ToNullString();
         this.litReceiveName.Text           = userInvoiceDataInfo.ReceiveName.ToNullString();
         this.litReceiveMobbile.Text        = userInvoiceDataInfo.ReceivePhone.ToNullString();
         this.litReceiveEmail.Text          = userInvoiceDataInfo.ReceiveEmail.ToNullString();
         this.litReceiveRegionName.Text     = userInvoiceDataInfo.ReceiveRegionName.ToNullString();
         this.litReceiveAddress.Text        = userInvoiceDataInfo.ReceiveAddress.ToNullString();
         this.litInvoiceTaxpayerNumber.Text = userInvoiceDataInfo.InvoiceTaxpayerNumber.ToNullString();
         this.litInvoiceTitle.Text          = userInvoiceDataInfo.InvoiceTitle.ToNullString();
         this.litInvoiceType.Text           = userInvoiceDataInfo.InvoceTypeText.ToNullString();
     }
     else
     {
         this.InvoicePanel.Visible = false;
     }
 }
Ejemplo n.º 2
0
        private void xlsContent(HttpContext context, List <OrderInfo> orderInfos)
        {
            StringBuilder stringBuilder = new StringBuilder(200);

            stringBuilder.Append("<table border='1'>");
            stringBuilder.Append("<thead><tr>");
            stringBuilder.Append("<th>订单编号</th>");
            stringBuilder.Append("<th>下单时间</th>");
            stringBuilder.Append("<th>付款时间</th>");
            stringBuilder.Append("<th>完成时间</th>");
            stringBuilder.Append("<th>用户名</th>");
            stringBuilder.Append("<th>等级</th>");
            stringBuilder.Append("<th>买家真实姓名</th>");
            stringBuilder.Append("<th>收货地址</th>");
            stringBuilder.Append("<th>详细地址</th>");
            stringBuilder.Append("<th>收货人姓名</th>");
            stringBuilder.Append("<th>电话号码</th>");
            stringBuilder.Append("<th>手机号码</th>");
            stringBuilder.Append("<th>发货时间</th>");
            stringBuilder.Append("<th>物流公司</th>");
            stringBuilder.Append("<th>运费</th>");
            stringBuilder.Append("<th>发货单号</th>");
            stringBuilder.Append("<th>购买数量</th>");
            stringBuilder.Append("<th>发货数量</th>");
            stringBuilder.Append("<th>用户备注</th>");
            stringBuilder.Append("<th>商品供货价</th>");
            stringBuilder.Append("<th>结算价</th>");
            stringBuilder.Append("<th>商品明细</th>");
            stringBuilder.Append("</tr></thead>");
            StringBuilder stringBuilder2 = new StringBuilder();

            foreach (OrderInfo orderInfo in orderInfos)
            {
                stringBuilder2.Append("<tr>");
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.OrderId, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.OrderDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.PayDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.FinishDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Username, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(MemberHelper.GetMemberGradeName(orderInfo.UserId), true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.RealName, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShippingRegion, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Address, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipTo, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.TelPhone, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.CellPhone, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipToDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ExpressCompanyName, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Freight, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipOrderNumber, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.GetAllQuantity(true), false));
                int     num  = 0;
                decimal num2 = default(decimal);
                if (orderInfo.LineItems != null && orderInfo.LineItems.Count > 0)
                {
                    num  = orderInfo.LineItems.Values.Sum((LineItemInfo i) => i.ShipmentQuantity);
                    num2 = orderInfo.LineItems.Values.Sum((LineItemInfo i) => i.ItemCostPrice * (decimal)i.Quantity);
                }
                stringBuilder2.Append(this.GetXLSFieldsTD(num, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Remark, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(num2, false));
                stringBuilder2.Append(this.GetXLSFieldsTD((orderInfo.OrderCostPrice + orderInfo.Freight).F2ToString("f2"), false));
                StringBuilder stringBuilder3 = new StringBuilder();
                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                {
                    stringBuilder3.Append(value.ItemDescription.ToNullString());
                    stringBuilder3.Append("[" + value.Quantity.ToNullString() + "]");
                    if (!string.IsNullOrEmpty(value.SKUContent))
                    {
                        stringBuilder3.Append("[" + value.SKUContent + "]");
                    }
                    if (!string.IsNullOrEmpty(value.PromotionName))
                    {
                        stringBuilder3.Append("(" + value.PromotionName + ")");
                    }
                    stringBuilder3.Append(";");
                }
                foreach (OrderGiftInfo gift in orderInfo.Gifts)
                {
                    stringBuilder3.Append(gift.GiftName.ToNullString());
                    stringBuilder3.Append("[" + gift.Quantity.ToNullString() + "]");
                    stringBuilder3.Append(";");
                }
                stringBuilder2.AppendFormat("<td>{0}</td>", stringBuilder3.ToString());
                UserInvoiceDataInfo invoiceInfo = orderInfo.InvoiceInfo;
                if (invoiceInfo == null)
                {
                    invoiceInfo = new UserInvoiceDataInfo
                    {
                        InvoiceType           = orderInfo.InvoiceType,
                        InvoiceTitle          = orderInfo.InvoiceTitle,
                        InvoiceTaxpayerNumber = orderInfo.InvoiceTaxpayerNumber
                    };
                }
                stringBuilder2.Append("</tr>");
            }
            stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString());
            StringWriter stringWriter = new StringWriter();

            stringWriter.Write(stringBuilder);
            ManageOrder.DownloadFile(context.Response, stringWriter.GetStringBuilder(), "OrderList" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls");
            stringWriter.Close();
            context.Response.End();
        }
Ejemplo n.º 3
0
        private void xlsContent(HttpContext context, List <OrderInfo> orderInfos)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<table border='1'>");
            stringBuilder.Append("<thead><tr>");
            stringBuilder.Append("<th>订单编号</th>");
            stringBuilder.Append("<th>下单时间</th>");
            stringBuilder.Append("<th>付款时间</th>");
            stringBuilder.Append("<th>完成时间</th>");
            stringBuilder.Append("<th>用户名</th>");
            stringBuilder.Append("<th>等级</th>");
            stringBuilder.Append("<th>买家真实姓名</th>");
            stringBuilder.Append("<th>收货地址</th>");
            stringBuilder.Append("<th>详细地址</th>");
            stringBuilder.Append("<th>收货人姓名</th>");
            stringBuilder.Append("<th>电话号码</th>");
            stringBuilder.Append("<th>手机号码</th>");
            stringBuilder.Append("<th>发货时间</th>");
            stringBuilder.Append("<th>物流公司</th>");
            stringBuilder.Append("<th>发货单号</th>");
            stringBuilder.Append("<th>订单总金额</th>");
            stringBuilder.Append("<th>退款金额</th>");
            stringBuilder.Append("<th>运费</th>");
            stringBuilder.Append("<th>订单奖励积分</th>");
            stringBuilder.Append("<th>供货价</th>");
            stringBuilder.Append("<th>支付方式</th>");
            stringBuilder.Append("<th>订单状态</th>");
            stringBuilder.Append("<th>税金</th>");
            stringBuilder.Append("<th>积分抵扣</th>");
            stringBuilder.Append("<th>优惠券抵扣</th>");
            stringBuilder.Append("<th>优惠金额</th>");
            stringBuilder.Append("<th>优惠活动</th>");
            stringBuilder.Append("<th>购买件数</th>");
            stringBuilder.Append("<th>发货件数</th>");
            stringBuilder.Append("<th>用户备注</th>");
            stringBuilder.Append("<th>商品总价</th>");
            stringBuilder.Append("<th>商品明细</th>");
            stringBuilder.Append("<th>供应商</th>");
            stringBuilder.Append("</tr></thead>");
            StringBuilder stringBuilder2 = new StringBuilder();

            foreach (OrderInfo orderInfo in orderInfos)
            {
                stringBuilder2.Append("<tr>");
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.PayOrderId, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.OrderDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.PayDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.FinishDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Username, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(MemberHelper.GetMemberGradeName(orderInfo.UserId), true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.RealName, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShippingRegion, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Address, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipTo, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.TelPhone, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.CellPhone, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipToDate, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ExpressCompanyName, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipOrderNumber, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.GetTotal(false), false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.RefundAmount, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Freight, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Points, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.GetCostPrice(), false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.PaymentType, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(EnumDescription.GetEnumDescription((Enum)(object)orderInfo.OrderStatus, 0), true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Tax, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.DeductionMoney.HasValue ? orderInfo.DeductionMoney.Value : decimal.Zero, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.CouponValue, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ReducedPromotionAmount, false));
                string text = "";
                if (!string.IsNullOrEmpty(orderInfo.ReducedPromotionName))
                {
                    text = text + orderInfo.ReducedPromotionName + ";";
                }
                if (!string.IsNullOrEmpty(orderInfo.SentTimesPointPromotionName))
                {
                    text = text + orderInfo.SentTimesPointPromotionName + ";";
                }
                if (!string.IsNullOrEmpty(orderInfo.FreightFreePromotionName))
                {
                    text = text + orderInfo.FreightFreePromotionName + ";";
                }
                stringBuilder2.Append(this.GetXLSFieldsTD(text, true));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.GetBuyQuantity(), false));
                int num = 0;
                if (orderInfo.LineItems != null && orderInfo.LineItems.Count > 0)
                {
                    num = orderInfo.LineItems.Values.Sum((LineItemInfo i) => i.ShipmentQuantity);
                }
                stringBuilder2.Append(this.GetXLSFieldsTD(num, false));
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.Remark, true));
                stringBuilder2.AppendFormat("<td>{0}</td>", orderInfo.GetAmount(false).F2ToString("f2"));
                StringBuilder stringBuilder3 = new StringBuilder();
                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                {
                    stringBuilder3.Append(value.ItemDescription.ToNullString());
                    stringBuilder3.Append("[" + value.Quantity.ToNullString() + "]");
                    if (!string.IsNullOrEmpty(value.SKUContent))
                    {
                        stringBuilder3.Append("[" + value.SKUContent + "]");
                    }
                    if (!string.IsNullOrEmpty(value.PromotionName))
                    {
                        stringBuilder3.Append("(" + value.PromotionName + ")");
                    }
                    stringBuilder3.Append(";");
                }
                foreach (OrderGiftInfo gift in orderInfo.Gifts)
                {
                    stringBuilder3.Append(gift.GiftName.ToNullString());
                    stringBuilder3.Append("[" + gift.Quantity.ToNullString() + "]");
                    stringBuilder3.Append(";");
                }
                stringBuilder2.AppendFormat("<td>{0}</td>", stringBuilder3.ToString());
                UserInvoiceDataInfo invoiceInfo = orderInfo.InvoiceInfo;
                if (invoiceInfo == null)
                {
                    invoiceInfo = new UserInvoiceDataInfo
                    {
                        InvoiceType           = orderInfo.InvoiceType,
                        InvoiceTitle          = orderInfo.InvoiceTitle,
                        InvoiceTaxpayerNumber = orderInfo.InvoiceTaxpayerNumber
                    };
                }
                stringBuilder2.Append(this.GetXLSFieldsTD(orderInfo.ShipperName, false));
                stringBuilder2.Append("</tr>");
            }
            stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString());
            StringWriter stringWriter = new StringWriter();

            stringWriter.Write(stringBuilder);
            ManageOrder.DownloadFile(context.Response, stringWriter.GetStringBuilder(), "OrderList" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls");
            stringWriter.Close();
            context.Response.End();
        }
Ejemplo n.º 4
0
 protected override void AttachChildControls()
 {
     this.orderId = base.GetParameter("orderId", false);
     this.litFightGroupStatusLabel = (FightGroupStatusLabel)this.FindControl("litFightGroupStatusLabel");
     this.litOrderId          = (Literal)this.FindControl("litOrderId");
     this.lbltotalPrice       = (FormatedMoneyLabel)this.FindControl("lbltotalPrice");
     this.litAddDate          = (FormatedTimeLabel)this.FindControl("litAddDate");
     this.lblOrderStatus      = (OrderStatusLabel)this.FindControl("lblOrderStatus");
     this.litCloseReason      = (Literal)this.FindControl("litCloseReason");
     this.litRemark           = (Literal)this.FindControl("litRemark");
     this.litShipTo           = (Literal)this.FindControl("litShipTo");
     this.litRegion           = (Literal)this.FindControl("litRegion");
     this.litAddress          = (Literal)this.FindControl("litAddress");
     this.litZipcode          = (Literal)this.FindControl("litZipcode");
     this.litEmail            = (Literal)this.FindControl("litEmail");
     this.litPhone            = (Literal)this.FindControl("litPhone");
     this.litTellPhone        = (Literal)this.FindControl("litTellPhone");
     this.litShipToDate       = (Literal)this.FindControl("litShipToDate");
     this.litPaymentType      = (Literal)this.FindControl("litPaymentType");
     this.litModeName         = (Literal)this.FindControl("litModeName");
     this.plOrderSended       = (Panel)this.FindControl("plOrderSended");
     this.litRealModeName     = (Literal)this.FindControl("litRealModeName");
     this.litShippNumber      = (Literal)this.FindControl("litShippNumber");
     this.litDiscountName     = (HyperLink)this.FindControl("litDiscountName");
     this.lblAdjustedDiscount = (FormatedMoneyLabel)this.FindControl("lblAdjustedDiscount");
     this.litFreeName         = (HyperLink)this.FindControl("litFreeName");
     this.plExpress           = (Panel)this.FindControl("plExpress");
     this.power                      = (HtmlAnchor)this.FindControl("power");
     this.litTakeCode                = (Literal)this.FindControl("litTakeCode");
     this.litStoreInfo               = (Literal)this.FindControl("litStoreInfo");
     this.litStoreName               = (Literal)this.FindControl("litStoreName");
     this.litStoreTel                = (Literal)this.FindControl("litStoreTel");
     this.divstoreinfo               = (HtmlGenericControl)this.FindControl("divstoreinfo");
     this.divInvoiceTitle            = (HtmlGenericControl)this.FindControl("divInvoiceTitle");
     this.divInvoiceTaxpayerNumber   = (HtmlGenericControl)this.FindControl("divInvoiceTaxpayerNumber");
     this.divTax                     = (HtmlGenericControl)this.FindControl("divTax");
     this.listOrders                 = (Common_OrderManage_OrderItems)this.FindControl("Common_OrderManage_OrderItems");
     this.orderGifts                 = (Common_OrderManage_OrderGifts)this.FindControl("Common_OrderManage_OrderGifts");
     this.plOrderGift                = (Panel)this.FindControl("plOrderGift");
     this.lblBundlingPrice           = (Literal)this.FindControl("lblBundlingPrice");
     this.litPoints                  = (Literal)this.FindControl("litPoints");
     this.litSentTimesPointPromotion = (HyperLink)this.FindControl("litSentTimesPointPromotion");
     this.litWeight                  = (Literal)this.FindControl("litWeight");
     this.litFree                    = (Literal)this.FindControl("litFree");
     this.lblFreight                 = (FormatedMoneyLabel)this.FindControl("lblFreight");
     this.litCouponValue             = (Literal)this.FindControl("litCouponValue");
     this.litPointMoney              = (Literal)this.FindControl("litPointMoney");
     this.lblDiscount                = (FormatedMoneyLabel)this.FindControl("lblDiscount");
     this.litTotalPrice              = (FormatedMoneyLabel)this.FindControl("litTotalPrice");
     this.lblRefundTotal             = (FormatedMoneyLabel)this.FindControl("lblRefundTotal");
     this.litAddOrderDate            = (FormatedTimeLabel)this.FindControl("litAddOrderDate");
     this.litPayDate                 = (FormatedTimeLabel)this.FindControl("litPayDate");
     this.litPayBack                 = (FormatedTimeLabel)this.FindControl("litPayBack");
     this.litBackShip                = (FormatedTimeLabel)this.FindControl("litBackShip");
     this.litShipDate                = (FormatedTimeLabel)this.FindControl("litShipDate");
     this.litResultDate              = (FormatedTimeLabel)this.FindControl("litResultDate");
     this.lkbtnConfirmOrder          = (LinkButton)this.FindControl("lkbtnConfirmOrder");
     this.lkbtnCloseOrder            = (LinkButton)this.FindControl("lkbtnCloseOrder");
     this.hidExpressCompanyName      = (HiddenField)this.FindControl("hidExpressCompanyName");
     this.hidShipOrderNumber         = (HiddenField)this.FindControl("hidShipOrderNumber");
     this.hidHiPOSTakeCode           = (HiddenField)this.FindControl("hidHiPOSTakeCode");
     this.btnPay                     = (Button)this.FindControl("btnPay");
     this.lbRefundMoney              = (Label)this.FindControl("lbRefundMoney");
     this.lbRefundMoney              = (Label)this.FindControl("lbRefundMoney");
     this.lbCloseReason              = (Label)this.FindControl("lbCloseReason");
     this.txtRemark                  = (TextBox)this.FindControl("txtRemark");
     this.txtReturnRemark            = (TextBox)this.FindControl("txtReturnRemark");
     this.txtReplaceRemark           = (TextBox)this.FindControl("txtReplaceRemark");
     this.dropRefundType             = (RefundTypeDropDownList)this.FindControl("dropRefundType");
     this.dropReturnRefundType       = (RefundTypeDropDownList)this.FindControl("dropReturnRefundType");
     this.dropPayType                = (DropDownList)this.FindControl("dropPayType");
     this.plRefund                   = (Panel)this.FindControl("plRefund");
     this.lblTotalBalance            = (FormatedMoneyLabel)this.FindControl("lblTotalBalance");
     this.litRefundOrderRemark       = (Literal)this.FindControl("litRefundOrderRemark");
     this.litInvoiceTitle            = (Literal)this.FindControl("litInvoiceTitle");
     this.litInvoiceTaxpayerNumber   = (Literal)this.FindControl("litInvoiceTaxpayerNumber");
     this.litTax                     = (FormatedMoneyLabel)this.FindControl("litTax");
     this.hdorderId                  = (HtmlInputHidden)this.FindControl("hdorderId");
     this.lkbtnApplyForRefund        = (HtmlAnchor)this.FindControl("lkbtnApplyForRefund");
     this.lkbtnUserRealNameVerify    = (HtmlAnchor)this.FindControl("lkbtnUserRealNameVerify");
     this.hidPreSaleId               = (HiddenField)this.FindControl("hidPreSaleId");
     this.hidIsPayDeposit            = (HiddenField)this.FindControl("hidIsPayDeposit");
     this.hidIsPaymentStore          = (HiddenField)this.FindControl("hidIsPaymentStore");
     this.litDepositPayDate          = (FormatedTimeLabel)this.FindControl("litDepositPayDate");
     this.litFinalPamentPayDate      = (Literal)this.FindControl("litFinalPamentPayDate");
     this.lblDeposit                 = (FormatedMoneyLabel)this.FindControl("lblDeposit");
     this.lblFinalPayment            = (FormatedMoneyLabel)this.FindControl("lblFinalPayment");
     this.litGetGoodsRemark          = (Literal)this.FindControl("litGetGoodsRemark");
     this.divPickUpRemark            = (HtmlGenericControl)this.FindControl("divPickUpRemark");
     this.litBalanceAmount           = (Literal)this.FindControl("litBalanceAmount");
     this.hidExpressStatus           = (HtmlInputHidden)this.FindControl("hidExpressStatus");
     this.litInvoiceType             = (Literal)this.FindControl("litInvoiceType");
     this.litRegisterAddress         = (Literal)this.FindControl("litRegisterAddress");
     this.litRegisterTel             = (Literal)this.FindControl("litRegisterTel");
     this.litOpenBank                = (Literal)this.FindControl("litOpenBank");
     this.litBankName                = (Literal)this.FindControl("litBankName");
     this.litReceiveName             = (Literal)this.FindControl("litReceiveName");
     this.litReceiveMobbile          = (Literal)this.FindControl("litReceiveMobbile");
     this.litReceiveEmail            = (Literal)this.FindControl("litReceiveEmail");
     this.litReceiveRegionName       = (Literal)this.FindControl("litReceiveRegionName");
     this.litReceiveAddress          = (Literal)this.FindControl("litReceiveAddress");
     this.listOrders.ItemDataBound  += this.orderItems_ItemDataBound;
     PageTitle.AddTitle("订单详细页", HiContext.Current.Context);
     this.order = TradeHelper.GetOrderInfo(this.orderId);
     this.divInvoiceTitle.Visible          = (this.order.Tax > decimal.Zero && !string.IsNullOrEmpty(this.order.InvoiceTitle));
     this.divInvoiceTaxpayerNumber.Visible = (this.order.Tax > decimal.Zero && !string.IsNullOrEmpty(this.order.InvoiceTaxpayerNumber));
     this.divTax.Visible           = (this.order.Tax > decimal.Zero);
     this.btnPay.Click            += this.btnPay_Click;
     this.lkbtnConfirmOrder.Click += this.lkbtnConfirmOrder_Click;
     this.lkbtnCloseOrder.Click   += this.lkbtnCloseOrder_Click;
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.order.TakeCode))
         {
             this.hidHiPOSTakeCode.Value = Globals.HIPOSTAKECODEPREFIX + this.order.TakeCode;
         }
         if (this.order == null || this.order.UserId != HiContext.Current.UserId)
         {
             this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单"));
         }
         else
         {
             this.BindOrderBase(this.order);
             this.BindOrderAddress(this.order);
             this.BindOrderItems(this.order);
             this.BindStoreInfo(this.order);
             if (!string.IsNullOrEmpty(this.order.InvoiceTitle))
             {
                 UserInvoiceDataInfo userInvoiceDataInfo = this.order.InvoiceInfo;
                 if (userInvoiceDataInfo == null)
                 {
                     userInvoiceDataInfo = new UserInvoiceDataInfo
                     {
                         InvoiceType           = this.order.InvoiceType,
                         InvoiceTaxpayerNumber = this.order.InvoiceTaxpayerNumber.ToNullString(),
                         InvoiceTitle          = this.order.InvoiceTitle.ToNullString()
                     };
                 }
                 this.litInvoiceTaxpayerNumber.SetWhenIsNotNull(this.order.InvoiceTaxpayerNumber);
                 this.litInvoiceTitle.SetWhenIsNotNull(this.order.InvoiceTitle);
                 this.litInvoiceType.SetWhenIsNotNull(EnumDescription.GetEnumDescription((Enum)(object)this.order.InvoiceType, 0));
                 this.litRegisterAddress.SetWhenIsNotNull(userInvoiceDataInfo.RegisterAddress.ToNullString());
                 this.litRegisterTel.SetWhenIsNotNull(userInvoiceDataInfo.RegisterTel.ToNullString());
                 this.litOpenBank.SetWhenIsNotNull(userInvoiceDataInfo.OpenBank.ToNullString());
                 this.litBankName.SetWhenIsNotNull(userInvoiceDataInfo.BankAccount.ToNullString());
                 this.litReceiveName.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveName.ToNullString());
                 if (this.order.InvoiceType != InvoiceType.Enterprise)
                 {
                     this.litReceiveMobbile.SetWhenIsNotNull(userInvoiceDataInfo.ReceivePhone.ToNullString());
                     if (this.order.InvoiceType != InvoiceType.VATInvoice)
                     {
                         this.litReceiveEmail.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveEmail.ToNullString());
                     }
                 }
                 this.litReceiveRegionName.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveRegionName.ToNullString());
                 this.litReceiveAddress.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveAddress.ToNullString());
             }
             if (this.order.FightGroupId > 0)
             {
                 FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId);
                 this.lkbtnApplyForRefund.Visible    = (fightGroup.Status != 0 && this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid && this.order.GetPayTotal() > decimal.Zero);
                 this.litFightGroupStatusLabel.Order = this.order;
             }
         }
     }
 }
Ejemplo n.º 5
0
        private void xlsContent(HttpContext context, List <OrderInfo> orderInfos)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<table border='1'>");
            stringBuilder.Append("<thead><tr>");
            stringBuilder.Append("<th>订单编号</th>");
            stringBuilder.Append("<th>下单时间</th>");
            stringBuilder.Append("<th>付款时间</th>");
            stringBuilder.Append("<th>完成时间</th>");
            stringBuilder.Append("<th>用户名</th>");
            stringBuilder.Append("<th>等级</th>");
            stringBuilder.Append("<th>收货地址</th>");
            stringBuilder.Append("<th>详细地址</th>");
            stringBuilder.Append("<th>收货人姓名</th>");
            stringBuilder.Append("<th>电话号码</th>");
            stringBuilder.Append("<th>手机号码</th>");
            stringBuilder.Append("<th>发货时间</th>");
            stringBuilder.Append("<th>配送方式</th>");
            stringBuilder.Append("<th>物流公司</th>");
            stringBuilder.Append("<th>发货单号</th>");
            stringBuilder.Append("<th>实付金额</th>");
            stringBuilder.Append("<th>退款金额</th>");
            stringBuilder.Append("<th>运费</th>");
            stringBuilder.Append("<th>订单奖励积分</th>");
            stringBuilder.Append("<th>商品总金额</th>");
            stringBuilder.Append("<th>支付方式</th>");
            stringBuilder.Append("<th>匹配门店</th>");
            stringBuilder.Append("<th>订单状态</th>");
            stringBuilder.Append("<th>税金</th>");
            stringBuilder.Append("<th>积分抵扣</th>");
            stringBuilder.Append("<th>优惠券抵扣</th>");
            stringBuilder.Append("<th>优惠金额</th>");
            stringBuilder.Append("<th>优惠活动</th>");
            stringBuilder.Append("<th>购买件数</th>");
            stringBuilder.Append("<th>发货件数</th>");
            stringBuilder.Append("<th>用户备注</th>");
            stringBuilder.Append("<th>商品明细</th>");
            if (HiContext.Current.SiteSettings.IsOpenCertification)
            {
                stringBuilder.Append("<th>身份证号码</th>");
            }
            stringBuilder.Append("<th>发票类型</th>");
            stringBuilder.Append("<th>抬头/单位名称</th>");
            stringBuilder.Append("<th>纳税人识别号</th>");
            stringBuilder.Append("<th>注册地址</th>");
            stringBuilder.Append("<th>注册电话</th>");
            stringBuilder.Append("<th>开户银行</th>");
            stringBuilder.Append("<th>银行帐户</th>");
            stringBuilder.Append("<th>收票人姓名</th>");
            stringBuilder.Append("<th>收票人手机</th>");
            stringBuilder.Append("<th>收票人邮箱</th>");
            stringBuilder.Append("<th>收票人地区</th>");
            stringBuilder.Append("<th>收票人详细地址</th>");
            stringBuilder.Append("</tr></thead>");
            StringBuilder stringBuilder2 = new StringBuilder();

            foreach (OrderInfo orderInfo in orderInfos)
            {
                stringBuilder2.Append("<tr>");
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.PayOrderId, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.OrderDate, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.PayDate, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.FinishDate, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Username, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(MemberHelper.GetMemberGradeName(orderInfo.UserId), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ShippingRegion, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Address, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ShipTo, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.TelPhone, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.CellPhone, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ShipToDate, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ModeName, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ExpressCompanyName, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ShipOrderNumber, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.GetTotal(false), false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.RefundAmount, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Freight, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Points, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.GetAmount(false), false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.PaymentType, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(string.IsNullOrEmpty(orderInfo.StoreName) ? "平台店" : orderInfo.StoreName, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(EnumDescription.GetEnumDescription((Enum)(object)orderInfo.OrderStatus, 0), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Tax, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.DeductionMoney.HasValue ? orderInfo.DeductionMoney.Value : decimal.Zero, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.CouponValue, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.ReducedPromotionAmount, false));
                string text = "";
                if (!string.IsNullOrEmpty(orderInfo.ReducedPromotionName))
                {
                    text = text + orderInfo.ReducedPromotionName + ";";
                }
                if (!string.IsNullOrEmpty(orderInfo.SentTimesPointPromotionName))
                {
                    text = text + orderInfo.SentTimesPointPromotionName + ";";
                }
                if (!string.IsNullOrEmpty(orderInfo.FreightFreePromotionName))
                {
                    text = text + orderInfo.FreightFreePromotionName + ";";
                }
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(text, true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.GetAllQuantity(true), false));
                int num = 0;
                if (orderInfo.LineItems != null && orderInfo.LineItems.Count > 0)
                {
                    num = orderInfo.LineItems.Values.Sum((LineItemInfo i) => i.ShipmentQuantity);
                }
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(num, false));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(orderInfo.Remark, true));
                StringBuilder stringBuilder3 = new StringBuilder();
                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                {
                    stringBuilder3.Append(value.ItemDescription.ToNullString());
                    stringBuilder3.Append("[" + value.Quantity.ToNullString() + "]");
                    if (!string.IsNullOrEmpty(value.SKUContent))
                    {
                        stringBuilder3.Append("[" + value.SKUContent + "]");
                    }
                    if (!string.IsNullOrEmpty(value.PromotionName))
                    {
                        stringBuilder3.Append("(" + value.PromotionName + ")");
                    }
                    stringBuilder3.Append(";");
                }
                foreach (OrderGiftInfo gift in orderInfo.Gifts)
                {
                    stringBuilder3.Append(gift.GiftName.ToNullString());
                    stringBuilder3.Append("[" + gift.Quantity.ToNullString() + "]");
                    stringBuilder3.Append(";");
                }
                stringBuilder2.AppendFormat("<td>{0}</td>", stringBuilder3.ToString());
                if (HiContext.Current.SiteSettings.IsOpenCertification)
                {
                    string argFields = string.Empty;
                    if (!string.IsNullOrWhiteSpace(orderInfo.IDNumber) && orderInfo.IsincludeCrossBorderGoods)
                    {
                        try
                        {
                            argFields = HiCryptographer.Decrypt(orderInfo.IDNumber);
                        }
                        catch
                        {
                        }
                    }
                    stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(argFields, true));
                }
                UserInvoiceDataInfo userInvoiceDataInfo = orderInfo.InvoiceInfo;
                if (userInvoiceDataInfo == null)
                {
                    userInvoiceDataInfo = new UserInvoiceDataInfo
                    {
                        InvoiceType           = orderInfo.InvoiceType,
                        InvoiceTitle          = orderInfo.InvoiceTitle,
                        InvoiceTaxpayerNumber = orderInfo.InvoiceTaxpayerNumber
                    };
                }
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(string.IsNullOrEmpty(userInvoiceDataInfo.InvoiceTitle.ToNullString()) ? "" : userInvoiceDataInfo.InvoceTypeText.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.InvoiceTitle.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.InvoiceTaxpayerNumber.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.RegisterAddress.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.RegisterTel.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.OpenBank.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.BankAccount.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.ReceiveName.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.ReceivePhone.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.ReceiveEmail.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.ReceiveRegionName.ToNullString(), true));
                stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(userInvoiceDataInfo.ReceiveAddress.ToNullString(), true));
                stringBuilder2.Append("</tr>");
            }
            stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString());
            StringWriter stringWriter = new StringWriter();

            stringWriter.Write(stringBuilder);
            DownloadHelper.DownloadFile(context.Response, stringWriter.GetStringBuilder(), "StoreOrderList" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls");
            stringWriter.Close();
            context.Response.End();
        }
        protected override void AttachChildControls()
        {
            this.hidHasTradePassword = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            this.orderId              = this.Page.Request.QueryString["orderId"];
            this.spandemo             = (HtmlGenericControl)this.FindControl("spandemo");
            this.litBalanceAmount     = (Literal)this.FindControl("litBalanceAmount");
            this.liBalanceAmount      = (HtmlGenericControl)this.FindControl("liBalanceAmount");
            this.hidExpressStatus     = (HtmlInputHidden)this.FindControl("hidExpressStatus");
            this.litInvoiceType       = (Literal)this.FindControl("litInvoiceType");
            this.litRegisterAddress   = (Literal)this.FindControl("litRegisterAddress");
            this.litRegisterTel       = (Literal)this.FindControl("litRegisterTel");
            this.litOpenBank          = (Literal)this.FindControl("litOpenBank");
            this.litBankName          = (Literal)this.FindControl("litBankName");
            this.litReceiveName       = (Literal)this.FindControl("litReceiveName");
            this.litReceiveMobbile    = (Literal)this.FindControl("litReceiveMobbile");
            this.litReceiveEmail      = (Literal)this.FindControl("litReceiveEmail");
            this.litReceiveRegionName = (Literal)this.FindControl("litReceiveRegionName");
            this.litReceiveAddress    = (Literal)this.FindControl("litReceiveAddress");
            this.spandemo.Visible     = masterSettings.IsDemoSite;
            this.LoadAllControls();
            this.order = ShoppingProcessor.GetOrderInfo(this.orderId);
            if (this.order == null || this.order.UserId != HiContext.Current.UserId)
            {
                base.GotoResourceNotFound("此订单已不存在");
            }
            if (this.order.ParentOrderId != "0" && this.order.ParentOrderId != "-1" && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
            {
                this.order   = ShoppingProcessor.GetOrderInfo(this.order.ParentOrderId);
                this.orderId = this.order.OrderId;
            }
            if (this.hidHasTradePassword != null && HiContext.Current.User.UserId > 0)
            {
                this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(HiContext.Current.User.TradePassword) ? "0" : "1");
            }
            else
            {
                this.hidHasTradePassword.Value = "0";
            }
            if ((this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) && this.order.ShippingModeId != -2)
            {
                if (!string.IsNullOrEmpty(this.order.ExpressCompanyAbb) && !string.IsNullOrEmpty(this.order.ShipOrderNumber))
                {
                    this.hidExpressStatus.Value = "2";
                }
                else
                {
                    this.hidExpressStatus.Value = "1";
                }
            }
            this.BindOrderInfo();
            if (!masterSettings.OpenMultStore && masterSettings.IsOpenPickeupInStore && this.order.SupplierId == 0 && this.order.ShippingModeId == -2)
            {
                this.litGetGoodsRemark.Text  = masterSettings.PickeupInStoreRemark;
                this.divStoreAddress.Visible = false;
            }
            else
            {
                this.divPickUpRemark.Visible = false;
            }
            if (this.order.CountDownBuyId > 0)
            {
                this.paymenttypeselect.OrderSalesPromotion = Common_AppPaymentTypeSelect.EnumOrderSalesPromotion.CountDownBuy;
            }
            if (!string.IsNullOrEmpty(this.order.InvoiceTitle))
            {
                UserInvoiceDataInfo userInvoiceDataInfo = this.order.InvoiceInfo;
                if (userInvoiceDataInfo == null)
                {
                    userInvoiceDataInfo = new UserInvoiceDataInfo
                    {
                        InvoiceType           = this.order.InvoiceType,
                        InvoiceTaxpayerNumber = this.order.InvoiceTaxpayerNumber,
                        InvoiceTitle          = this.order.InvoiceTitle
                    };
                }
                this.litInvoiceType.SetWhenIsNotNull(EnumDescription.GetEnumDescription((Enum)(object)this.order.InvoiceType, 0));
                this.litRegisterAddress.SetWhenIsNotNull(userInvoiceDataInfo.RegisterAddress.ToNullString());
                this.litRegisterTel.SetWhenIsNotNull(userInvoiceDataInfo.RegisterTel.ToNullString());
                this.litOpenBank.SetWhenIsNotNull(userInvoiceDataInfo.OpenBank.ToNullString());
                this.litBankName.SetWhenIsNotNull(userInvoiceDataInfo.BankAccount.ToNullString());
                this.litReceiveName.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveName.ToNullString());
                if (this.order.InvoiceType != InvoiceType.Enterprise)
                {
                    this.litReceiveMobbile.SetWhenIsNotNull(userInvoiceDataInfo.ReceivePhone.ToNullString());
                    if (this.order.InvoiceType != InvoiceType.VATInvoice)
                    {
                        this.litReceiveEmail.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveEmail.ToNullString());
                    }
                }
                this.litReceiveRegionName.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveRegionName.ToNullString());
                this.litReceiveAddress.SetWhenIsNotNull(userInvoiceDataInfo.ReceiveAddress.ToNullString());
            }
            this.paymenttypeselect.IsFireGroup  = (this.order.FightGroupId > 0);
            this.litFightGroupStatusLabel.Order = this.order;
            this.SetOperatorsStatus();
            this.BindStoreInfo();
            this.rptOrderProducts = (Common_MemberOrderProducts)this.FindControl("Common_MemberOrderProducts");
            this.rptOrderProducts.ItemDataBound += this.rptOrderProducts_ItemDataBound;
            var dataSource = (from i in (from i in this.order.LineItems.Values
                                         select new
            {
                i.SupplierId,
                i.SupplierName
            }).Distinct()
                              orderby i.SupplierId
                              select i).ToList();

            this.rptOrderProducts.DataSource = dataSource;
            this.rptOrderProducts.orderInfo  = this.order;
            this.rptOrderProducts.DataBind();
            IList <OrderGiftInfo> gifts = this.order.Gifts;

            if (gifts.Count() > 0)
            {
                this.rptCartGifts.DataSource = gifts;
                this.rptCartGifts.DataBind();
            }
            else
            {
                this.divGifts.Visible = false;
            }
            this.divProducts.Visible          = (this.order.LineItems.Count > 0);
            this.rptPromotionGifts.DataSource = from a in this.order.Gifts
                                                where a.PromoteType > 0
                                                select a;

            this.rptPromotionGifts.DataBind();
            PageTitle.AddSiteNameTitle("订单详情");
        }