// update order information protected void updateButton_Click(object sender, EventArgs e) { // Store the new order details in an OrderInfo object OrderInfo orderInfo = new OrderInfo(); string orderId = Request.QueryString["OrderID"]; orderInfo.OrderID = Int32.Parse(orderId); orderInfo.DateCreated = dateCreatedTextBox.Text; orderInfo.DateShipped = dateShippedTextBox.Text; orderInfo.Verified = verifiedCheck.Checked; orderInfo.Completed = completedCheck.Checked; orderInfo.Canceled = canceledCheck.Checked; orderInfo.Comments = commentsTextBox.Text; orderInfo.CustomerName = customerNameTextBox.Text; orderInfo.ShippingAddress = shippingAddressTextBox.Text; orderInfo.CustomerEmail = customerEmailTextBox.Text; // try to update the order try { // Update the order OrdersAccess.Update(orderInfo); } catch (Exception) { // In case of an error, we simply ignore it } // Exit edit mode SetEditMode(false); // Update the form PopulateControls(orderId); }
public BasketValidationResults(OrderInfo order, IOrderService orderService) { _order = order; _orderService = orderService; }
protected void Page_Load(object sender, EventArgs e) { // Register the dialog script ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ScriptHelper.NEWWINDOW_SCRIPT_KEY, ScriptHelper.NewWindowScript); lblInvoiceNumber.Text = GetString("order_invoice.lblInvoiceNumber"); btnGenerate.Text = GetString("order_invoice.btnGenerate"); btnPrintPreview.Text = GetString("order_invoice.btnPrintPreview"); if (QueryHelper.GetInteger("orderid", 0) != 0) { orderId = QueryHelper.GetInteger("orderid", 0); } order = OrderInfoProvider.GetOrderInfo(orderId); if (order == null) { btnGenerate.Enabled = false; btnPrintPreview.Enabled = false; return; } else { // Check order site ID CheckOrderSiteID(order.OrderSiteID); } ltlScript.Text = ScriptHelper.GetScript("function showPrintPreview() { NewWindow('Order_Edit_InvoicePrint.aspx?orderid=" + orderId + "', 'InvoicePrint', 650, 700);}"); if (!RequestHelper.IsPostBack()) { txtInvoiceNumber.Text = order.OrderInvoiceNumber; lblInvoice.Text = URLHelper.MakeLinksAbsolute(order.OrderInvoice); } }
private static Transaction.TransactionStatus RequestTransactionStatus(string transactionId, OrderInfo order) { try { var connector = new Connector(); // Override MerchantId loaded from configuration //connector.MerchantId = "025152899"; var transaction = connector.RequestTransactionStatus(transactionId); var acquirerId = transaction.AcquirerId; var status = transaction.Status; var consumerName = transaction.ConsumerName; var fingerprint = transaction.Fingerprint; var consumerIBAN = transaction.ConsumerIBAN; var consumerBIC = transaction.ConsumerBIC; var amount = transaction.Amount; var currency = transaction.Currency; var signatureString = ByteArrayToHexString(transaction.SignatureValue); // Place newlines in Hex String for (int i = 256; i > 0; i -= 32) signatureString = signatureString.Substring(0, i) + "<br />" + signatureString.Substring(i); var signatureValue = signatureString; return status; } catch (IDealException ex) { Log.Instance.LogError("ING Advanced PaymentRequestHander: " + ex); } return Transaction.TransactionStatus.Failure; }
public static bool ConfirmPay(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay); bool flag = false; if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { OrderDao dao = new OrderDao(); order.OrderStatus = OrderStatus.BuyerAlreadyPaid; order.PayDate = new DateTime?(DateTime.Now); flag = dao.UpdateOrder(order, null); if (!flag) { return flag; } dao.UpdatePayOrderStock(order.OrderId); foreach (LineItemInfo info in order.LineItems.Values) { ProductDao dao2 = new ProductDao(); ProductInfo productDetails = dao2.GetProductDetails(info.ProductId); productDetails.SaleCounts += info.Quantity; productDetails.ShowSaleCounts += info.Quantity; dao2.UpdateProduct(productDetails, null); } UpdateUserAccount(order); Messenger.OrderPayment(new MemberDao().GetMember(order.UserId), order.OrderId, order.GetTotal()); EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId })); } return flag; }
public void Update(ShippingProviderMethod shippingProviderMethod, OrderInfo orderInfo) { if (orderInfo != null) { // your logic here, and set the price at the end like this: Log.Instance.LogDebug("Hoeveelheid artikelen totaal: " + orderInfo.OrderLines.Sum(x => x.ProductInfo.ItemCount)); Log.Instance.LogDebug("Hoeveel eerste artikel in mandje: " + orderInfo.OrderLines.First().ProductInfo.ItemCount); // CALCULATE SHIPPING PRICE int priceInCents; var itemCount = orderInfo.OrderLines.Sum(line => line.ProductInfo.ItemCount.GetValueOrDefault(1)); if (itemCount == 1) priceInCents = 500; else if (itemCount == 2) priceInCents = 400; else priceInCents = 0; shippingProviderMethod.PriceInCents = priceInCents; shippingProviderMethod.PriceInCents = 500; } }
/// <summary> /// /// </summary> public OrdersInformationUpdateResponseMessage(AccountInfo accountInfo, OrderInfo[] orderInformations, ActiveOrder.UpdateTypeEnum[] ordersUpdates, bool operationResult) : base(accountInfo, operationResult) { _ordersUpdates = ordersUpdates; _orderInformations = orderInformations; }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Page.Request.QueryString["OrderId"])) { base.GotoResourceNotFound(); } else { this.orderId = this.Page.Request.QueryString["OrderId"]; this.btnUpdateOrderAmount.Click += new EventHandler(this.btnUpdateOrderAmount_Click); this.grdProducts.RowDeleting += new GridViewDeleteEventHandler(this.grdProducts_RowDeleting); this.grdProducts.RowCommand += new GridViewCommandEventHandler(this.grdProducts_RowCommand); this.order = OrderHelper.GetOrderInfo(this.orderId); if (!this.Page.IsPostBack) { if (this.order == null) { base.GotoResourceNotFound(); } else { this.BindProductList(this.order); this.BindOtherAmount(this.order); this.BindTatolAmount(this.order); } } } }
internal string GenerateOrderNumber(Store store, OrderInfo orderInfo, out int lastOrderReferenceNumber) { lastOrderReferenceNumber = 0; var currentHighestOrderNumber = UwebshopConfiguration.Current.ShareBasketBetweenStores ? _orderRepository.GetHighestOrderNumber(ref lastOrderReferenceNumber) : _orderRepository.GetHighestOrderNumberForStore(store.Alias, ref lastOrderReferenceNumber); Log.Instance.LogDebug("GenerateOrderNumber currentHighestOrderNumber: " + currentHighestOrderNumber + " lastOrderReferenceNumber: " + lastOrderReferenceNumber); var orderNumberPrefix = store.OrderNumberPrefix; if (lastOrderReferenceNumber <= 0) { if (!string.IsNullOrEmpty(currentHighestOrderNumber) && currentHighestOrderNumber.Length >= orderNumberPrefix.Length) int.TryParse(currentHighestOrderNumber.Substring(orderNumberPrefix.Length, currentHighestOrderNumber.Length - orderNumberPrefix.Length), out lastOrderReferenceNumber); else int.TryParse(currentHighestOrderNumber, out lastOrderReferenceNumber); } lastOrderReferenceNumber++; lastOrderReferenceNumber = Math.Max(lastOrderReferenceNumber, store.OrderNumberStartNumber); orderInfo.StoreOrderReferenceId = lastOrderReferenceNumber; Log.Instance.LogDebug("GenerateOrderNumber lastOrderReferenceNumber: " + lastOrderReferenceNumber); return GenerateOrderNumber(store, orderInfo, lastOrderReferenceNumber, orderNumberPrefix); }
public Domain.OrderLine ToOrderLine(OrderInfo orderInfo) { var productInfo = new ProductInfo(); productInfo.Id = OriginalProductId; productInfo.ItemCount = Quantity; productInfo.Title = Title; productInfo.SKU = SKU; productInfo.Tags = Tags ?? new string[0]; productInfo.Weight = Weight; productInfo.Length = Length; productInfo.Height = Height; productInfo.Width = Width; productInfo.OriginalPriceInCents = OriginalPrice; productInfo.RangesString = RangesString; productInfo.Vat = Vat; productInfo.DiscountId = DiscountId; productInfo.ProductVariants = ProductVariants ?? new List<ProductVariantInfo>(); productInfo.DiscountPercentage = DiscountPercentage; productInfo.DiscountAmountInCents = DiscountAmount; productInfo.DiscountExcludingVariants = ExcludingVariants; productInfo.DocTypeAlias = DocTypeAlias; return new Domain.OrderLine(productInfo, orderInfo) {OrderLineId = OrderLineId, _customData = _customData}; }
public void Setup() { IOC.IntegrationTest(); _orderInfo = DefaultFactoriesAndSharedFunctionality.CreateIncompleteOrderInfo(DefaultFactoriesAndSharedFunctionality.CreateProductInfo(1000, 1)); _orderDiscount = DefaultFactoriesAndSharedFunctionality.CreateDefaultOrderDiscountWithAmount(195, DiscountOrderCondition.None, 0); }
public void GenerateAndPersistOrderNumber(OrderInfo order) { using (var t = GetTransaction(order)) { t.Generate(); t.Persist(); } }
public void VerifyOrderTotalItemCount() { var order = new OrderInfo(); order.OrderLines = new List<OrderLine> {new OrderLine(_product, order), new OrderLine(_product, order)}; _product.Order = order; Assert.AreEqual(10, _variant.OrderTotalItemCount); }
private static OrderInfo CreateOrder(string countryCode) { var order = new OrderInfo(); var xElement = new XElement(CustomerDatatypes.Customer.ToString()); xElement.AddFirst(new XElement("customerCountry", new XCData(""))); order.CustomerInfo.customerInformation = new XDocument(xElement); order.CustomerCountry = countryCode; return order; }
private void BindUpdateSippingAddress(OrderInfo order) { this.txtShipTo.Text = order.ShipTo; this.dropRegions.SetSelectedRegionId(new int?(order.RegionId)); this.txtAddress.Text = order.Address; this.txtZipcode.Text = order.ZipCode; this.txtTelPhone.Text = order.TelPhone; this.txtCellPhone.Text = order.CellPhone; }
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo) { var orderId = HttpContext.Current.Request.QueryString["orderid"] ?? ""; if (paymentProvider == null || string.IsNullOrEmpty(orderId)) { return null; } orderInfo = OrderHelper.GetOrder(orderId); if (orderInfo != null) { var localizedPaymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); var secret = paymentProvider.GetSetting("secret"); var amount = HttpContext.Current.Request.QueryString["amount"] ?? "0"; var validated = true; if (secret != string.Empty) { var sb = new StringBuilder(); foreach (var key in HttpContext.Current.Request.QueryString.AllKeys) { if (key != "hash") { sb.Append(HttpContext.Current.Request.QueryString[key]); } } var calculated = ePayPaymentBase.MD5(sb.ToString() + secret).ToUpperInvariant(); var incoming = (HttpContext.Current.Request.QueryString["hash"] ?? "").ToUpperInvariant(); validated = calculated == incoming; if (!validated) { //checksum error Log.Instance.LogError("Payment provider (ePay) error : Orderid " + orderId + " - incoming hash " + incoming + " - calculated hash " + calculated); } } if (validated && (amount == orderInfo.ChargedAmountInCents.ToString())) { orderInfo.Paid = true; orderInfo.Status = OrderStatus.ReadyForDispatch; orderInfo.Save(); } else { orderInfo.Paid = false; orderInfo.Status = OrderStatus.PaymentFailed; orderInfo.Save(); if (validated) { //checksum already logged, must be problem with amount Log.Instance.LogError("Payment provider (ePay) error : Orderid " + orderId + " - incoming amount " + amount.ToString() + " - order amount " + orderInfo.ChargedAmountInCents.ToString()); } } } HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write("OK"); HttpContext.Current.Response.Flush(); return orderInfo; }
public void Setup() { IOC.UnitTest(); _discountCalculationService = IOC.DiscountCalculationService.Actual().Resolve(); _product = DefaultFactoriesAndSharedFunctionality.CreateProductInfo(1000, 1); _product.Tags = new [] { "schoen" }; _order = DefaultFactoriesAndSharedFunctionality.CreateIncompleteOrderInfo(_product); }
private static string GenerateOrderNumber(Store store, OrderInfo orderInfo, int lastOrderReferenceNumber, string orderNumberPrefix) { if (string.IsNullOrEmpty(store.OrderNumberTemplate)) { return string.Format("{0}{1}", orderNumberPrefix, lastOrderReferenceNumber.ToString("0000")); } var template = store.OrderNumberTemplate; return template.Replace("#orderId#", lastOrderReferenceNumber.ToString()).Replace("#orderIdPadded#", lastOrderReferenceNumber.ToString("0000")).Replace("#storeAlias#", store.Alias).Replace("#day#", orderInfo.ConfirmDate.GetValueOrDefault().Day.ToString()).Replace("#month#", orderInfo.ConfirmDate.GetValueOrDefault().Month.ToString()).Replace("#year#", orderInfo.ConfirmDate.GetValueOrDefault().Year.ToString()); }
public void Setup() { IOC.UnitTest(); _stockServiceMock = IOC.StockService.SetupNewMock(); var productInfo = DefaultFactoriesAndSharedFunctionality.CreateProductInfo(12990, 1); productInfo.Id = TestProductService.ProductId1; _order = DefaultFactoriesAndSharedFunctionality.CreateIncompleteOrderInfo(productInfo); _order.StoreInfo.Alias = StoreHelper.GetCurrentStore().Alias; }
public void SendOrderCancelled(OrderInfo order) { var builder = new StringBuilder(); builder.Append("Your Event #"); builder.Append(order._id); builder.Append(" was cancelled."); builder.Append(" The amount of $"); builder.Append(order._currentAmmount); builder.Append(" will be refunded."); smsAgent.sendSMS(order._customerPhoneNumber, builder.ToString()); }
public void SendOrderRegistered(OrderInfo order) { var builder = new StringBuilder(); builder.Append("Your Event #"); builder.Append(order._id); builder.Append(" was registered."); builder.Append(" Total amount: $"); builder.Append(order._cost); smsAgent.sendSMS(order._customerPhoneNumber, builder.ToString()); }
/// <summary> /// Deletes all the assigned attendees to Events as products. /// </summary> /// <param name="orderObj">Order object.</param> protected override void DeleteOrderInfoInternal(OrderInfo orderObj) { if (orderObj != null) { // Delete all attendees that are connected with the given order CustomEventHelper.DeleteAttendees(orderObj.OrderID); // Delete the order base.DeleteOrderInfoInternal(orderObj); } }
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo order) { order.Paid = true; order.Status = OrderStatus.ReadyForDispatch; order.Save(); // if success then succes, otherwise error (todo) order.RedirectUrl = paymentProvider.SuccessUrl(); return order; }
public static Customer GetOrderReciever(OrderInfo orderInfo) { if (Random.Next(0, 10) % 5 == 0) { var customerPool = CustomersRepository.LoadCustomersFromDb().Where(c => c.Address.Country == "US"); return customerPool.ElementAt(Random.Next(0, customerPool.Count() - 1)); } return orderInfo.Customer; }
/// <summary> /// Creates a payment request for this payment provider /// </summary> /// <param name="orderInfo"> </param> /// <returns>Payment request</returns> public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); #region build urls var returnUrl = paymentProvider.SuccessUrl(); var reportUrl = paymentProvider.ReportUrl(); var testMode = paymentProvider.TestMode; //currently we don't have a testmode for easy-ideal this var is unused #endregion #region config helper var merchantId = paymentProvider.GetSetting("merchantId"); var merchantKey = paymentProvider.GetSetting("merchantKey"); var merchantSecret = paymentProvider.GetSetting("merchantSecret"); var url = paymentProvider.GetSetting("url"); #endregion var args = new SortedList<string, string>(); var ci = new CultureInfo("en-US"); args.Add("Amount", orderInfo.ChargedAmount.ToString("G", ci)); args.Add("Currency", "EUR"); args.Add("Bank", orderInfo.PaymentInfo.MethodId); args.Add("Description", orderInfo.OrderNumber); args.Add("Return", reportUrl); var xmlRequest = GetXml(IDEAL_EXECUTE, args, merchantId, merchantKey, merchantSecret); XDocument xmlResponse = XDocument.Parse(PostXml(xmlRequest, url)); var responseStatus = xmlResponse.Element("Response").Element("Status").FirstNode.ToString(); var transactionId = xmlResponse.Element("Response").Element("Response").Element("TransactionID").FirstNode.ToString(); var transactionCode = xmlResponse.Element("Response").Element("Response").Element("Code").FirstNode.ToString(); var bankUrl = HttpUtility.HtmlDecode(xmlResponse.Element("Response").Element("Response").Element("BankURL").FirstNode.ToString()); orderInfo.PaymentInfo.Url = bankUrl; PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); //transactionCode hierin verwerken?? //IO.Container.Resolve<IOrderUpdatingService>().AddCustomerFields(order, new Dictionary<string, string>({ "extraBilling", value }), CustomerDatatypes.Extra); orderInfo.AddCustomerFields(new Dictionary<string, string> { { "extraTransactionCode", transactionCode } }, Common.CustomerDatatypes.Extra); orderInfo.Save(); return new PaymentRequest(); }
public void ShipOrder(OrderInfo orderInfo, Order order) { var reciever = OrderRepository.GetOrderReciever(orderInfo); if (reciever.Id != orderInfo.Customer.Id) { orderInfo.Customer = reciever; } _shippingService.SendOrder(orderInfo.Customer, order).Wait(); }
/// <summary> /// /// </summary> public OrdersInformationUpdateResponseMessage(AccountInfo accountInfo, OrderInfo[] orderInformations, bool operationResult) : base(accountInfo, operationResult) { _orderInformations = orderInformations; _ordersUpdates = new Order.UpdateTypeEnum[_orderInformations.Length]; for (int i = 0; i < _orderInformations.Length; i++) { _ordersUpdates[i] = Order.UpdateTypeEnum.Update; } }
public ShippingMethodFulfillmentAdaptor(ShippingProviderMethod shippingProviderMethod, bool pricesIncludingVat, ILocalization localization, OrderInfo order) { _shippingProviderMethod = shippingProviderMethod; _pricesIncludingVat = pricesIncludingVat; _localization = localization; _order = order; Id = shippingProviderMethod.Id; Title = shippingProviderMethod.Title; Description = shippingProviderMethod.Description; Name = shippingProviderMethod.Name; Disabled = shippingProviderMethod.Disabled; }
public void Setup() { IOC.UnitTest(); IOC.VATCheckService.Mock(out _vatCheckerMock); _incompleteOrderInfo = DefaultFactoriesAndSharedFunctionality.CreateIncompleteOrderInfo(); _incompleteOrderInfo.CustomerInfo.CountryCode = "GB"; _incompleteOrderInfo.VATCheckService = _vatCheckerMock.Object; _incompleteOrderInfo.CustomerInfo.VATNumber = "something"; _confirmedOrderInfo = DefaultFactoriesAndSharedFunctionality.CreateOrderInfo(); _confirmedOrderInfo.VATCheckService = _vatCheckerMock.Object; _confirmedOrderInfo.CustomerInfo.CountryCode = "GB"; }
public void Setup() { IOC.UnitTest(); IOC.SettingsService.InclVat(); _discountCalculationService = IOC.DiscountCalculationService.Actual().Resolve(); _discount = DefaultFactoriesAndSharedFunctionality.CreateDefaultOrderDiscountWithPercentage(50); _discount.MemberGroups = new List<string> {"testGroup"}; _orderInfo = DefaultFactoriesAndSharedFunctionality.CreateOrderInfo( DefaultFactoriesAndSharedFunctionality.CreateProductInfo(1000, 1)); DefaultFactoriesAndSharedFunctionality.SetDiscountsOnOrderInfo(_orderInfo, _discount); _mock = IOC.AuthenticationProvider.SetupNewMock(); }
private void btnGetAndSendGoods_Click(object sender, EventArgs e) { int replaceId = this.Page.Request["replaceId"].ToInt(0); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); if (replaceInfo == null) { this.ShowMsg("错误的换货信息", false); } else { string arg = "自己门店"; if (this.UserStoreId == 0) { arg = "平台"; } if (replaceInfo.StoreId != this.UserStoreId && replaceInfo.StoreId >= 0) { this.ShowMsg(string.Format("只能由发货的店铺或者平台处理", arg), false); } else if (replaceInfo.HandleStatus != ReplaceStatus.UserDelivery) { this.ShowMsg("错误的售后状态", false); } else { string text = ""; string text2 = ""; ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressDropDownList.SelectedValue); if (expressCompanyInfo != null) { text = expressCompanyInfo.Kuaidi100Code; text2 = expressCompanyInfo.Name; string text3 = this.txtShipOrderNumber.Text; if (string.IsNullOrEmpty(text3) || text3.Length > 20) { this.ShowMsg("请输入运单编号,长度在1-20位之间", false); } else if (TradeHelper.ReplaceShopSendGoods(replaceId, text, text2, text3, replaceInfo.OrderId, replaceInfo.SkuId)) { if (text.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(text, text3); } OrderInfo orderInfo = OrderHelper.GetOrderInfo(replaceInfo.OrderId); MemberInfo user = Users.GetUser(orderInfo.UserId); replaceInfo.HandleStatus = ReplaceStatus.MerchantsDelivery; Messenger.AfterSaleDeal(user, orderInfo, null, replaceInfo); this.ShowMsg("换货发货成功!", true, HttpContext.Current.Request.Url.ToString()); } else { this.ShowMsg("换货发货失败,原因未知", false); } } else { this.ShowMsg("请选择快递公司", false); } } } }
//public static bool UpdateOrderItemStatus(string OrderId) //{ // OrderInfo orderInfo = GetOrderInfo(OrderId); // if (orderInfo == null) // { // return false; // } // Dictionary<string, LineItemInfo> lineItems = orderInfo.LineItems; // OrderItemStatus nomarl = OrderItemStatus.Nomarl; // if (lineItems.Count > 0) // { // if ((orderInfo.RefunedCount + orderInfo.ReturnedCount) == lineItems.Count) // { // nomarl = OrderItemStatus.AllRefunedOrReturned; // } // if (orderInfo.ItemRefundCount == lineItems.Count) // { // nomarl = OrderItemStatus.HasRefund; // } // if (orderInfo.ItemReturnsCount == lineItems.Count) // { // nomarl = OrderItemStatus.HasReturn; // } // if (orderInfo.ItemReplaceCount == lineItems.Count) // { // nomarl = OrderItemStatus.HasReplace; // } // if ((((orderInfo.ItemRefundCount + orderInfo.ItemReplaceCount) + orderInfo.ItemReturnsCount) >= lineItems.Count) && (lineItems.Count > 1)) // { // nomarl = OrderItemStatus.AllInAfterSales; // } // if ((((orderInfo.ItemRefundCount >= 1) && ((orderInfo.ItemReplaceCount + orderInfo.ItemReturnsCount) > 0)) || ((orderInfo.ItemReplaceCount >= 1) && ((orderInfo.ItemRefundCount + orderInfo.ItemReturnsCount) > 0))) || ((orderInfo.ItemReturnsCount >= 1) && ((orderInfo.ItemRefundCount + orderInfo.ItemReplaceCount) > 0))) // { // nomarl = OrderItemStatus.HasRefundOrReturnOrReplace; // } // if (orderInfo.ItemRefundCount >= 1) // { // nomarl = OrderItemStatus.HasRefund; // } // if (orderInfo.ItemReplaceCount >= 1) // { // nomarl = OrderItemStatus.HasReplace; // } // if (orderInfo.ItemReturnsCount >= 1) // { // nomarl = OrderItemStatus.HasReturn; // } // } // return new OrderDao().UpdateOrderItemStatus(orderInfo.OrderId, nomarl); //} public static bool UpdateOrderPaymentType(OrderInfo order) { return(order.CheckAction(OrderActions.SELLER_MODIFY_TRADE) && new OrderDao().UpdateOrder(order, null)); }
protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { Repeater repeater = (Repeater)e.Item.FindControl("rptSubList"); OrderInfo orderInfo = OrderHelper.GetOrderInfo(DataBinder.Eval(e.Item.DataItem, "OrderID").ToString()); if ((orderInfo != null) && (orderInfo.LineItems.Count > 0)) { repeater.DataSource = orderInfo.LineItems.Values; repeater.DataBind(); } OrderStatus status = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus"); string str = ""; if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull)) { str = (string)DataBinder.Eval(e.Item.DataItem, "Gateway"); } if (DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != DBNull.Value) { int num1 = (int)DataBinder.Eval(e.Item.DataItem, "GroupBuyId"); } HtmlInputButton button = (HtmlInputButton)e.Item.FindControl("btnModifyPrice"); HtmlInputButton button1 = (HtmlInputButton)e.Item.FindControl("btnSendGoods"); Button button2 = (Button)e.Item.FindControl("btnPayOrder"); HtmlInputButton button3 = (HtmlInputButton)e.Item.FindControl("btnCloseOrderClient"); HtmlAnchor anchor1 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund"); HtmlAnchor anchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn"); HtmlAnchor anchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace"); Literal literal = (Literal)e.Item.FindControl("WeiXinNickName"); Literal literal2 = (Literal)e.Item.FindControl("litOtherInfo"); int totalPointNumber = orderInfo.GetTotalPointNumber(); MemberInfo member = MemberProcessor.GetMember(orderInfo.UserId, true); if (member != null) { literal.Text = "买家:" + member.UserName; } StringBuilder builder = new StringBuilder(); decimal total = orderInfo.GetTotal(); if (total > 0M) { builder.Append("<strong>¥" + total.ToString("F2") + "</strong>"); builder.Append("<small>(含运费¥" + orderInfo.AdjustedFreight.ToString("F2") + ")</small>"); } if (totalPointNumber > 0) { builder.Append("<small>" + totalPointNumber.ToString() + "积分</small>"); } if (orderInfo.PaymentType == "货到付款") { builder.Append("<span class=\"setColor bl\"><strong>货到付款</strong></span>"); } if (string.IsNullOrEmpty(builder.ToString())) { builder.Append("<strong>¥" + total.ToString("F2") + "</strong>"); } literal2.Text = builder.ToString(); if (status == OrderStatus.WaitBuyerPay) { button.Visible = true; button.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)"); button3.Attributes.Add("onclick", "CloseOrderFun('" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "')"); button3.Visible = true; if (str != "hishop.plugins.payment.podrequest") { button2.Visible = true; } } } }
public async Task <IRequest <IOrder> > PostNewOrder(OrderInfo orderInfo) { if (orderInfo.Amount <= 0) { throw new InvalidOperationException("Amount should be > 0"); } if (orderInfo.Amount <= 0) { return new MarketRequest <IOrder>(RequestStatus.Failed, null) { ErrorInfo = "Order amount is zero or negative" } } ; if (orderInfo.Type == OrderType.Market) { lock (LockObject) { var feed = SymbolsFeeds[orderInfo.Symbol]; var price = orderInfo.Direction == TradeDirection.Buy ? feed.Ask : feed.Bid; var order = new Order( this.MarketName, orderInfo.Symbol, Time, orderInfo.Direction, orderInfo.Type, orderInfo.Amount, (decimal)price, orderInfo.ClientOrderId); var(result, error) = RegisterOrder(order); if (!result) { return new MarketRequest <IOrder>(RequestStatus.Failed, null) { ErrorInfo = error } } ; var trade = new Trade( this.MarketName, order.Symbol, this.Time, order.TradeType, (decimal)price, order.Amount, order); RegisterTrade(feed, trade, isTaker: true); this.ClosedOrders.Add(order); return(new MarketRequest <IOrder>(RequestStatus.Completed, order) { }); } } else { var order = new Order( this.MarketName, orderInfo.Symbol, Time, orderInfo.Direction, orderInfo.Type, orderInfo.Amount, orderInfo.Price.Value, orderInfo.ClientOrderId); var res = RegisterOrder(order); if (res.result) { lock (LockObject) this.PendingOrders.Add(order); return(new MarketRequest <IOrder>(RequestStatus.Completed, order) { }); } else { return(new MarketRequest <IOrder>(RequestStatus.Failed, null) { ErrorInfo = res.error }); } } }
private void btnSendGoods_Click(object sender, EventArgs e) { if (this.grdOrderGoods.Rows.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { DropdownColumn column = (DropdownColumn)this.grdOrderGoods.Columns[4]; ListItemCollection selectedItems = column.SelectedItems; DropdownColumn column2 = (DropdownColumn)this.grdOrderGoods.Columns[5]; ListItemCollection items2 = column2.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string orderId = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value; TextBox box = (TextBox)this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); ListItem item = selectedItems[i]; ListItem item2 = items2[i]; int result = 0; int.TryParse(item.Value, out result); if ((!string.IsNullOrEmpty(box.Text.Trim()) && !string.IsNullOrEmpty(item.Value)) && ((int.Parse(item.Value) > 0) && !string.IsNullOrEmpty(item2.Value))) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if ((((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) && (orderInfo.Gateway == "hishop.plugins.payment.podrequest")) || (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid))) && (((result > 0) && !string.IsNullOrEmpty(box.Text.Trim())) && (box.Text.Trim().Length <= 20))) { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(result, true); orderInfo.RealShippingModeId = shippingMode.ModeId; orderInfo.RealModeName = shippingMode.Name; orderInfo.ExpressCompanyAbb = item2.Value; orderInfo.ExpressCompanyName = item2.Text; orderInfo.ShipOrderNumber = box.Text; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo info3 = new SendNoteInfo(); info3.NoteId = Globals.GetGenerateId() + num; info3.OrderId = orderId; info3.Operator = ManagerHelper.GetCurrentManager().UserName; info3.Remark = "后台" + info3.Operator + "发货成功"; OrderHelper.SaveSendNote(info3); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid); PayClient client = new PayClient(wid, masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); DeliverInfo deliver = new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }; client.DeliverNotify(deliver); } } orderInfo.OnDeliver(); num++; } } } } if (num == 0) { this.ShowMsg("批量发货失败!", false); } else if (num > 0) { this.BindData(); this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true); } } }
public abstract bool UpdateOrderAmount(OrderInfo order, DbTransaction dbTran);
public abstract int SendGoods(OrderInfo order);
public abstract bool SaveShippingAddress(OrderInfo order);
public abstract bool SaveRemark(OrderInfo order);
public async Task <IActionResult> List(OrderInfo orderInfo) { var data = await orderService.List(orderInfo); return(JsonDate(data)); }
public void bindReplaceInfo() { int replaceId = this.Page.Request["replaceId"].ToInt(0); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); if (replaceInfo == null) { this.ShowMsg("换货信息错误!", false); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId); HiddenField hiddenField = this.hidReplaceStatus; int num = (int)replaceInfo.HandleStatus; hiddenField.Value = num.ToString(); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else { if (string.IsNullOrEmpty(replaceInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == replaceInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.txtAdminRemark.Text = replaceInfo.AdminRemark; this.listPrducts.DataBind(); this.litOrderId.Text = orderInfo.PayOrderId; this.litOrderTotal.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.litRefundReason.Text = replaceInfo.ReplaceReason; this.litRemark.Text = replaceInfo.UserRemark; Literal literal = this.litReturnQuantity; num = replaceInfo.Quantity; literal.Text = num.ToString(); string userCredentials = replaceInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (orderInfo.StoreId <= 0) { if (replaceInfo.HandleStatus == ReplaceStatus.Applied) { this.btnAcceptReplace.Visible = true; this.btnRefuseReplace.Visible = true; } else if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnGetAndSendGoods.Visible = true; } } if (replaceInfo.HandleStatus != 0) { this.txtAdminCellPhone.Visible = false; this.txtAdminShipAddress.Visible = false; this.txtAdminShipTo.Visible = false; this.litAdminCellPhone.Visible = true; this.litAdminShipAddrss.Visible = true; this.litAdminShipTo.Visible = true; this.litAdminCellPhone.Text = replaceInfo.AdminCellPhone; this.litAdminShipTo.Text = replaceInfo.AdminShipTo; this.litAdminShipAddrss.Text = replaceInfo.AdminShipAddress; } else if (orderInfo.SupplierId > 0) { ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId); if (defaultGetGoodsShipperBysupplierId != null) { Literal literal2 = this.litAdminShipAddrss; TextBox textBox = this.txtAdminShipAddress; string text3 = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address); Literal literal3 = this.litAdminShipTo; TextBox textBox2 = this.txtAdminShipTo; text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName)); Literal literal4 = this.litAdminCellPhone; TextBox textBox3 = this.txtAdminCellPhone; text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone)); } } else if (orderInfo.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); if (storeById != null) { Literal literal5 = this.litAdminShipAddrss; TextBox textBox4 = this.txtAdminShipAddress; string text3 = literal5.Text = (textBox4.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); Literal literal6 = this.litAdminShipTo; TextBox textBox5 = this.txtAdminShipTo; text3 = (literal6.Text = (textBox5.Text = storeById.ContactMan)); Literal literal7 = this.litAdminCellPhone; TextBox textBox6 = this.txtAdminCellPhone; text3 = (literal7.Text = (textBox6.Text = storeById.Tel)); } } else { ShippersInfo defaultOrFirstGetGoodShipper = TradeHelper.GetDefaultOrFirstGetGoodShipper(); if (defaultOrFirstGetGoodShipper != null) { Literal literal8 = this.litAdminShipAddrss; TextBox textBox7 = this.txtAdminShipAddress; string text3 = literal8.Text = (textBox7.Text = RegionHelper.GetFullRegion(defaultOrFirstGetGoodShipper.RegionId, " ", true, 0) + " " + defaultOrFirstGetGoodShipper.Address); Literal literal9 = this.litAdminShipTo; TextBox textBox8 = this.txtAdminShipTo; text3 = (literal9.Text = (textBox8.Text = defaultOrFirstGetGoodShipper.ShipperName)); Literal literal10 = this.litAdminCellPhone; TextBox textBox9 = this.txtAdminCellPhone; text3 = (literal10.Text = (textBox9.Text = defaultOrFirstGetGoodShipper.CellPhone)); } } if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnViewUserLogistic.Visible = true; AttributeCollection attributes = this.btnViewUserLogistic.Attributes; num = replaceInfo.ReplaceId; attributes.Add("replaceid", num.ToString()); this.btnViewUserLogistic.Attributes.Add("expresscompanyname", replaceInfo.UserExpressCompanyName.ToString()); this.btnViewUserLogistic.Attributes.Add("shipordernumber", replaceInfo.UserShipOrderNumber.ToString()); } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.btnViewMallLogistic.Visible = true; AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes; num = replaceInfo.ReplaceId; attributes2.Add("replaceid", num.ToString()); this.btnViewMallLogistic.Attributes.Add("expresscompanyname", replaceInfo.ExpressCompanyName.ToString()); this.btnViewMallLogistic.Attributes.Add("shipordernumber", replaceInfo.ShipOrderNumber.ToString()); } string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")"); str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address; this.litUserAddress.Text = str2; this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0); Literal literal11 = this.txtAfterSaleId; num = replaceInfo.ReplaceId; literal11.Text = num.ToString(); if (orderInfo.SupplierId > 0) { this.btnGetAndSendGoods.Visible = false; } } } }
protected void btnAcceptReturns_Click(object sender, System.EventArgs e) { ManagerHelper.CheckPrivilege(Privilege.OrderReturnsApplyAccept); decimal num; if (!decimal.TryParse(this.hidRefundMoney.Value, out num)) { this.ShowMsg("退款金额需为数字格式!", false); return; } decimal d; decimal.TryParse(this.hidOrderTotal.Value, out d); if (num > d) { this.ShowMsg("退款金额不能大于订单金额!", false); return; } decimal customsClearanceFee; if (!decimal.TryParse(this.hidCustomsClearanceFee.Value, out customsClearanceFee)) { this.ShowMsg("清关费需为数字格式!", false); return; } decimal expressFee; if (!decimal.TryParse(this.hidExpressFee.Value, out expressFee)) { this.ShowMsg("快递费需为数字格式!", false); return; } int feeAffiliation; if (!int.TryParse(hidFeeAffiliation.Value, out feeAffiliation)) { this.ShowMsg("请选择快递费用归属!", false); return; } string Affiliation; switch (feeAffiliation) { case 1: Affiliation = "客户承担"; break; case 2: Affiliation = "公司承担"; break; case 3: Affiliation = "供应商承担"; break; default: this.ShowMsg("快递费用归属选择错误!", false); return; } OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.hidOrderId.Value); OrderHelper.CheckReturn(orderInfo, HiContext.Current.User.Username, num, expressFee, customsClearanceFee, Affiliation, this.hidAdminRemark.Value, int.Parse(this.hidRefundType.Value), true); this.BindReturns(); this.ShowMsg("成功的确认了订单退货", true); }
protected void Page_Load(object sender, System.EventArgs e) { this.stype = Globals.RequestQueryNum("stype"); string a = Globals.RequestFormStr("isCallback"); if (a == "true") { if (string.IsNullOrEmpty(base.Request["ReturnsId"])) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } OrderInfo orderInfo = OrderHelper.GetOrderInfo(base.Request["orderId"]); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); int num; string text; if (base.Request["type"] == "refund") { RefundHelper.GetRefundType(base.Request["orderId"], out num, out text); } else { num = 0; text = ""; } string arg; if (num == 1) { arg = "退到预存款"; } else { arg = "银行转帐"; } stringBuilder.AppendFormat(",\"OrderTotal\":\"{0}\"", Globals.FormatMoney(orderInfo.GetTotal())); if (!(base.Request["type"] == "replace")) { stringBuilder.AppendFormat(",\"RefundType\":\"{0}\"", num); stringBuilder.AppendFormat(",\"RefundTypeStr\":\"{0}\"", arg); } stringBuilder.AppendFormat(",\"Contacts\":\"{0}\"", orderInfo.ShipTo); stringBuilder.AppendFormat(",\"Email\":\"{0}\"", orderInfo.EmailAddress); stringBuilder.AppendFormat(",\"Telephone\":\"{0}\"", (orderInfo.TelPhone + " " + orderInfo.CellPhone).Trim()); stringBuilder.AppendFormat(",\"Address\":\"{0}\"", orderInfo.Address); stringBuilder.AppendFormat(",\"Remark\":\"{0}\"", text.Replace("\r\n", "")); stringBuilder.AppendFormat(",\"PostCode\":\"{0}\"", orderInfo.ZipCode); stringBuilder.AppendFormat(",\"GroupBuyId\":\"{0}\"", (orderInfo.GroupBuyId > 0) ? orderInfo.GroupBuyId : 0); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + stringBuilder.ToString() + "}"); base.Response.End(); } else if (a == "GetOrdersStates") { base.Response.ContentType = "application/json"; System.Data.DataTable allOrderID = OrderHelper.GetAllOrderID(); int num2 = allOrderID.Select("OrderStatus=" + 5).Length; int num3 = allOrderID.Select("OrderStatus=" + 5 + " and Gateway = 'hishop.plugins.payment.podrequest'").Length; string s = string.Concat(new object[] { "{\"type\":\"1\",\"finishedcount\":", num2, ",\"count1\":", num3, "}" }); base.Response.Write(s); base.Response.End(); } this.Reurl = base.Request.Url.ToString(); if (!this.Reurl.Contains("?")) { this.Reurl += "?pageindex=1"; } this.Reurl = System.Text.RegularExpressions.Regex.Replace(this.Reurl, "&t=(\\d+)", ""); this.Reurl = System.Text.RegularExpressions.Regex.Replace(this.Reurl, "(\\?)t=(\\d+)", "?"); this.btnSearchButton.Click += new System.EventHandler(this.btnSearchButton_Click); this.btnRemark.Click += new System.EventHandler(this.btnRemark_Click); this.btnCloseOrder.Click += new System.EventHandler(this.btnCloseOrder_Click); this.btnDeleteCheck.Click += new System.EventHandler(this.btnDeleteCheck_Click); this.btnProductGoods.Click += new System.EventHandler(this.btnProductGoods_Click); this.btnOrderGoods.Click += new System.EventHandler(this.btnOrderGoods_Click); if (!this.Page.IsPostBack) { this.bindOrderType(); this.BindOrders(); } }
public abstract bool UpdateOrderPaymentType(OrderInfo order);
protected void Page_Load(object sender, System.EventArgs e) { string a = Globals.RequestFormStr("posttype"); if (string.IsNullOrEmpty(this.ReUrl)) { this.ReUrl = "manageorder.aspx"; } if (a == "updateorder") { string value = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"修改失败!\"}"; JArray jArray = (JArray)JsonConvert.DeserializeObject(value); OrderInfo orderInfo = null; using (System.Collections.Generic.IEnumerator <JToken> enumerator = jArray.GetEnumerator()) { while (enumerator.MoveNext()) { JObject jObject = (JObject)enumerator.Current; string text = jObject["o"].ToString(); decimal num = decimal.Parse(jObject["f"].ToString()); JArray jArray2 = (JArray)jObject["data"]; if (jArray2.Count > 0) { string itemid = string.Empty; if (!string.IsNullOrEmpty(text)) { orderInfo = OrderHelper.GetOrderInfo(text); if (orderInfo != null && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { using (System.Collections.Generic.IEnumerator <JToken> enumerator2 = jArray2.GetEnumerator()) { while (enumerator2.MoveNext()) { JObject jObject2 = (JObject)enumerator2.Current; itemid = jObject2["skuid"].ToString(); decimal d = decimal.Parse(jObject2["adjustedcommssion"].ToString()); OrderHelper.UpdateAdjustCommssions(text, itemid, d * -1m); } } if (num >= 0m && orderInfo != null && orderInfo.AdjustedFreight != num) { orderInfo.AdjustedFreight = num; OrderHelper.UpdateOrder(orderInfo); } OrderHelper.UpdateCalculadtionCommission(text); s = "{\"type\":\"1\",\"tips\":\"订单价格修改成功!\"}"; } else { s = "{\"type\":\"0\",\"tips\":\"当前订单状态不允许修改价格!\"}"; } } } } } base.Response.Write(s); base.Response.End(); return; } this.orderId = Globals.RequestQueryStr("OrderId"); if (string.IsNullOrEmpty(this.orderId)) { base.GotoResourceNotFound(); return; } this.order = OrderHelper.GetOrderInfo(this.orderId); if (this.order == null) { base.GotoResourceNotFound(); return; } this.rptItemList.DataSource = this.order.LineItems.Values; this.rptItemList.DataBind(); this.litLogistic.Text = (string.IsNullOrEmpty(this.order.RealModeName) ? this.order.ModeName : this.order.RealModeName); this.txtAdjustedFreight.Text = this.order.AdjustedFreight.ToString("F", System.Globalization.CultureInfo.InvariantCulture); decimal num2 = 0m; if (!string.IsNullOrEmpty(this.order.ActivitiesName)) { num2 += this.order.DiscountAmount; } if (!string.IsNullOrEmpty(this.order.ReducedPromotionName)) { num2 += this.order.ReducedPromotionAmount; } if (!string.IsNullOrEmpty(this.order.CouponName)) { num2 += this.order.CouponAmount; } if (!string.IsNullOrEmpty(this.order.RedPagerActivityName)) { num2 += this.order.RedPagerAmount; } if (this.order.PointToCash > 0m) { num2 += this.order.PointToCash; } this.litOrderGoodsTotalPrice.Text = (this.litItemTotalPrice.Text = this.order.GetAmount().ToString("F2")); this.litAdjustedCommssion.Text = this.order.GetTotalDiscountAverage().ToString("F2"); this.litOrderTotal.Text = (this.order.GetAmount() - num2).ToString("F", System.Globalization.CultureInfo.InvariantCulture); }
protected void Page_Load(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "page load"); if (Page.IsPostBack) { return; } /*******************请求参数验证 start*****************************************************************/ int orderRefundId = RequestHelper.GetQueryString <int>("order_refund_id"); var orderRefund = OrderRefundBLL.Read(orderRefundId); if (orderRefund.Id < 1) { Response.Write("<p style=\"margin-left:130px\">无效的退款服务工单</p>"); Response.End(); } decimal refundMoney = orderRefund.RefundMoney; if (refundMoney <= 0) { Response.Write("<p style=\"margin-left:130px\">无效的退款金额,退款金额必须大于0</p>"); Response.End(); } if (orderRefund.Status == (int)OrderRefundStatus.HasReturn) { Response.Write("<p style=\"margin-left:130px\">无效的退款请求,该服务工单已处理退款</p>"); Response.End(); } if (orderRefund.Status != (int)OrderRefundStatus.Returning) { Response.Write("<p style=\"margin-left:130px\">无效的退款请求,请等待管理员审核</p>"); Response.End(); } var order = OrderBLL.Read(orderRefund.OrderId); if (order.Id < 1) { Response.Write("<p style=\"margin-left:130px\">无效的订单</p>"); Response.End(); } string tradeNo = order.WxPayTradeNo; if (string.IsNullOrEmpty(tradeNo)) { Response.Write("<p style=\"margin-left:130px\">无效的微信支付交易号</p>"); Response.End(); } decimal totalMoney = order.ProductMoney - order.FavorableMoney + order.ShippingMoney + order.OtherMoney - order.Balance - order.CouponMoney - order.PointMoney; if (refundMoney > totalMoney) { Response.Write("<p style=\"margin-left:130px\">退款金额不能超过订单金额</p>"); Response.End(); } //商户退款单号 //商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 string batch_no = orderRefund.BatchNo; if (string.IsNullOrEmpty(batch_no)) { batch_no = DateTime.Now.ToString("yyyyMMddhhmmssfff"); //记录退款批次号存入订单退款表 OrderRefundBLL.UpdateBatchNo(orderRefundId, batch_no); } /*******************请求参数验证 end*****************************************************************/ //订单总金额 string total_fee = Convert.ToInt32(totalMoney * 100).ToString(); //退款金额 string refund_fee = Convert.ToInt32(refundMoney * 100).ToString(); //申请退款 /*** * 申请退款完整业务流程逻辑 * @param transaction_id 微信订单号(优先使用) * @param out_trade_no 商户订单号 * @param out_refund_no 商户退款单号 * @param total_fee 订单总金额 * @param refund_fee 退款金额 * @return 退款结果(xml格式) */ string result = ""; try { result = RefundBusiness.Run(tradeNo, "", batch_no, total_fee, refund_fee); //退款成功 bool isSuccess = true; string msg = ""; //退款到余额 if (orderRefund.RefundBalance > 0) { //在这里写自己的逻辑 } if (isSuccess) { orderRefund.Remark = "退款完成"; #region 发送订单退款成功通知 int isSendNotice = ShopConfig.ReadConfigInfo().RefundOrder; int isSendEmail = ShopConfig.ReadConfigInfo().RefundOrderEmail; int isSendMessage = ShopConfig.ReadConfigInfo().RefundOrderMsg; string key = "RefundOrder"; OrderInfo order = OrderBLL.Read(orderRefund.OrderId); if (isSendNotice == (int)BoolType.True && key != string.Empty) { if (isSendEmail == (int)BoolType.True) {//发邮件 try { EmailContentInfo emailContent = EmailContentHelper.ReadSystemEmailContent(key); EmailSendRecordInfo emailSendRecord = new EmailSendRecordInfo(); emailSendRecord.Title = emailContent.EmailTitle; emailSendRecord.Content = emailContent.EmailContent.Replace("$UserName$", order.UserName).Replace("$OrderNumber$", order.OrderNumber).Replace("$PayName$", order.PayName).Replace("$ShippingName$", ShippingBLL.Read(order.ShippingId).Name).Replace("$ShippingNumber$", order.ShippingNumber).Replace("$ShippingDate$", order.ShippingDate.ToString("yyyy-MM-dd")); emailSendRecord.IsSystem = (int)BoolType.True; emailSendRecord.EmailList = order.Email; emailSendRecord.IsStatisticsOpendEmail = (int)BoolType.False; emailSendRecord.SendStatus = (int)SendStatus.No; emailSendRecord.AddDate = RequestHelper.DateNow; emailSendRecord.SendDate = RequestHelper.DateNow; emailSendRecord.ID = EmailSendRecordBLL.AddEmailSendRecord(emailSendRecord); EmailSendRecordBLL.SendEmail(emailSendRecord); //result = "通知邮件已发送。"; } catch { //result = "未发送通知邮件。"; } } if (isSendMessage == (int)BoolType.True) {//发短信 //result += "未发送通知短信。"; } } #endregion } else { orderRefund.Remark = orderRefund.RefundPayKey + " 已退款完成,余额退款失败,失败信息:" + msg + ",请线下处理。"; } orderRefund.Status = (int)OrderRefundStatus.HasReturn; orderRefund.TmRefund = DateTime.Now; OrderRefundBLL.Update(orderRefund); OrderRefundActionBLL.Add(new OrderRefundActionInfo { OrderRefundId = orderRefund.Id, Status = isSuccess ? 1 : 0, Tm = DateTime.Now, UserType = 2, UserId = 0, UserName = "******", Remark = orderRefund.Remark }); Response.Redirect("/Admin/OrderRefundAdd.aspx?Id=" + orderRefundId); } catch { Response.Write("<p style=\"margin-left:130px\">退款遇到问题</p>"); } //Response.Write(result); }
private void AddBankroll(int paymentLogId) { if (!BankrollItem.ExistsPaymentLog(paymentLogId)) { PaymentLogInfo paymentLogById = PaymentLog.GetPaymentLogById(paymentLogId); if (!paymentLogById.IsNull) { IEncourageStrategy <decimal> strategy = new UserMoney(); int userId = 0; UserInfo usersByUserName = new UserInfo(true); if (!string.IsNullOrEmpty(paymentLogById.UserName)) { usersByUserName = Users.GetUsersByUserName(paymentLogById.UserName); userId = usersByUserName.UserId; if (userId > 0) { strategy.IncreaseForUsers(userId.ToString(), paymentLogById.MoneyPay, "", false, ""); BankrollItemInfo bankrollItemInfo = new BankrollItemInfo(); bankrollItemInfo.UserName = paymentLogById.UserName; bankrollItemInfo.Money = paymentLogById.MoneyPay; bankrollItemInfo.MoneyType = 3; bankrollItemInfo.EBankId = paymentLogById.PlatformId; bankrollItemInfo.OrderId = paymentLogById.OrderId; bankrollItemInfo.PaymentId = paymentLogId; bankrollItemInfo.Remark = "在线支付单号:" + paymentLogById.PaymentNum; bankrollItemInfo.DateAndTime = DateTime.Now; bankrollItemInfo.CurrencyType = 1; bankrollItemInfo.ClientId = usersByUserName.ClientId; BankrollItem.Add(bankrollItemInfo); } } if (paymentLogById.OrderId > 0) { OrderInfo orderById = Order.GetOrderById(paymentLogById.OrderId); if (!orderById.IsNull) { decimal d = 0M; if (orderById.MoneyTotal > orderById.MoneyReceipt) { if ((orderById.MoneyTotal - orderById.MoneyReceipt) > paymentLogById.MoneyPay) { if (SiteConfig.ShopConfig.EnablePartPay) { d = paymentLogById.MoneyPay; orderById.MoneyReceipt += paymentLogById.MoneyPay; } } else { d = orderById.MoneyTotal - orderById.MoneyReceipt; orderById.MoneyReceipt = orderById.MoneyTotal; } orderById.Status = OrderStatus.Confirmed; Order.Update(orderById); } if (d > 0M) { strategy.IncreaseForUsers(userId.ToString(), -d, "", false, ""); BankrollItemInfo info5 = new BankrollItemInfo(); info5.UserName = usersByUserName.UserName; info5.ClientId = usersByUserName.ClientId; info5.Money = -d; info5.MoneyType = 4; info5.EBankId = 0; info5.OrderId = orderById.OrderId; info5.PaymentId = 0; info5.Remark = "支付订单费用,订单号:" + orderById.OrderNum; info5.DateAndTime = DateTime.Now; info5.CurrencyType = 1; BankrollItem.Add(info5); } } } else if (paymentLogById.Point > 0) { IEncourageStrategy <int> strategy2 = new UserPoint(); strategy2.IncreaseForUsers(userId.ToString(), paymentLogById.Point, "购买" + SiteConfig.UserConfig.PointName, true, ""); BankrollItemInfo info6 = new BankrollItemInfo(); info6.UserName = usersByUserName.UserName; info6.ClientId = usersByUserName.ClientId; info6.Money = (paymentLogById.MoneyPay > 0M) ? (-1M * paymentLogById.MoneyPay) : paymentLogById.MoneyPay; info6.MoneyType = 4; info6.EBankId = 0; info6.OrderId = 0; info6.PaymentId = 0; info6.Remark = "购买" + SiteConfig.UserConfig.PointName + ",购买数:" + paymentLogById.Point.ToString() + SiteConfig.UserConfig.PointUnit; info6.DateAndTime = new DateTime?(DateTime.Now); info6.CurrencyType = 1; BankrollItem.Add(info6); if (usersByUserName.UserId > 0) { strategy.IncreaseForUsers(usersByUserName.UserId.ToString(), -(paymentLogById.MoneyPay), "", false, ""); } } } } }
public static bool UserPayOrder(OrderInfo order) { OrderDao dao = new OrderDao(); order.OrderStatus = OrderStatus.BuyerAlreadyPaid; order.PayDate = new DateTime?(DateTime.Now); bool flag = dao.UpdateOrder(order, null); if (flag) { dao.UpdatePayOrderStock(order.OrderId); foreach (LineItemInfo info in order.LineItems.Values) { ProductDao dao2 = new ProductDao(); ProductInfo productDetails = dao2.GetProductDetails(info.ProductId); productDetails.SaleCounts += info.Quantity; productDetails.ShowSaleCounts += info.Quantity; dao2.UpdateProduct(productDetails, null); } MemberInfo member = GetMember(order.UserId); if (member == null) { return(flag); } MemberDao dao3 = new MemberDao(); PointDetailInfo point = new PointDetailInfo { OrderId = order.OrderId, UserId = member.UserId, TradeDate = DateTime.Now, TradeType = PointTradeType.Bounty, Increased = new int?(order.Points), Points = order.Points + member.Points }; if ((point.Points > 0x7fffffff) || (point.Points < 0)) { point.Points = 0x7fffffff; } PointDetailDao dao4 = new PointDetailDao(); dao4.AddPointDetail(point); member.Expenditure += order.GetTotal(); member.OrderNumber++; dao3.Update(member); Messenger.OrderPayment(member, order.OrderId, order.GetTotal()); int historyPoint = dao4.GetHistoryPoint(member.UserId); List <MemberGradeInfo> memberGrades = new MemberGradeDao().GetMemberGrades() as List <MemberGradeInfo>; foreach (MemberGradeInfo info5 in from item in memberGrades orderby item.Points descending select item) { if (member.GradeId == info5.GradeId) { return(flag); } if (info5.Points <= historyPoint) { member.GradeId = info5.GradeId; dao3.Update(member); return(flag); } } } return(flag); }
private void btnRemark_Click(object sender, System.EventArgs e) { if (this.hidOrderId.Value == "0") { string text = Globals.RequestFormStr("CheckBoxGroup"); if (text.Length <= 0) { this.ShowMsg("请先选择要批量备注的订单", false); return; } if (this.txtRemark.Text.Length > 300) { this.ShowMsg("备注长度限制在300个字符以内", false); return; } string[] array = text.Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; if (!string.IsNullOrEmpty(text2)) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(text2); orderInfo.OrderId = text2; if (this.orderRemarkImageForRemark.SelectedItem != null) { orderInfo.ManagerMark = this.orderRemarkImageForRemark.SelectedValue; } orderInfo.ManagerRemark = Globals.HtmlEncode(this.txtRemark.Text); OrderHelper.SaveRemark(orderInfo); } } this.ShowMsg("批量保存备注成功", true); this.BindOrders(); return; } else { if (this.txtRemark.Text.Length > 300) { this.ShowMsg("备注长度限制在300个字符以内", false); return; } OrderInfo orderInfo2 = OrderHelper.GetOrderInfo(this.hidOrderId.Value); orderInfo2.OrderId = this.hidOrderId.Value; if (this.orderRemarkImageForRemark.SelectedItem != null) { orderInfo2.ManagerMark = this.orderRemarkImageForRemark.SelectedValue; } orderInfo2.ManagerRemark = Globals.HtmlEncode(this.txtRemark.Text); if (OrderHelper.SaveRemark(orderInfo2)) { this.BindOrders(); this.ShowMsg("保存备注成功", true); return; } this.ShowMsg("保存失败", false); return; } }
public IEnumerable <Tuple <Order, bool, bool> > ProcessOrderMessage(Order order, Security security, ExecutionMessage message, long transactionId, out Tuple <Portfolio, bool, bool> pfInfo) { if (security == null) { throw new ArgumentNullException(nameof(security)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } if (message.Error != null) { throw new ArgumentException(LocalizedStrings.Str714Params.PutEx(message)); } var securityData = GetData(security); if (transactionId == 0 && message.OrderId == null && message.OrderStringId.IsEmpty()) { throw new ArgumentException(LocalizedStrings.Str719); } pfInfo = null; var orders = securityData.Orders; if (transactionId == 0) { var info = orders.CachedValues.FirstOrDefault(i => { if (order != null) { return(i.Order == order); } if (message.OrderId != null) { return(i.Order.Id == message.OrderId); } else { return(i.Order.StringId.CompareIgnoreCase(message.OrderStringId)); } }); if (info == null) { return(null); //throw new InvalidOperationException(LocalizedStrings.Str1156Params.Put(orderId.To<string>() ?? orderStringId)); } var orderInfo = info.ApplyChanges(message, false); UpdateOrderIds(info.Order, securityData); return(new[] { orderInfo }); } else { var cancelKey = CreateOrderKey(message.OrderType, transactionId, true); var registerKey = CreateOrderKey(message.OrderType, transactionId, false); var cancelledInfo = orders.TryGetValue(cancelKey); var registetedInfo = orders.TryGetValue(registerKey); // проверяем не отмененная ли заявка пришла if (cancelledInfo != null) // && (cancelledOrder.Id == orderId || (!cancelledOrder.StringId.IsEmpty() && cancelledOrder.StringId.CompareIgnoreCase(orderStringId)))) { var cancellationOrder = cancelledInfo.Order; if (registetedInfo == null) { var i = cancelledInfo.ApplyChanges(message, true); UpdateOrderIds(cancellationOrder, securityData); return(new[] { i }); } var retVal = new List <Tuple <Order, bool, bool> >(); var orderState = message.OrderState; if (orderState != null && cancellationOrder.State != OrderStates.Done && orderState != OrderStates.None && orderState != OrderStates.Pending) { cancellationOrder.State = cancellationOrder.State.CheckModification(OrderStates.Done); if (message.Latency != null) { cancellationOrder.LatencyCancellation = message.Latency.Value; } retVal.Add(Tuple.Create(cancellationOrder, false, true)); } var isCancelOrder = (message.OrderId != null && message.OrderId == cancellationOrder.Id) || (message.OrderStringId != null && message.OrderStringId == cancellationOrder.StringId) || (message.OrderBoardId != null && message.OrderBoardId == cancellationOrder.BoardId); var regOrder = registetedInfo.Order; if (!isCancelOrder) { var replacedInfo = registetedInfo.ApplyChanges(message, false); UpdateOrderIds(regOrder, securityData); retVal.Add(replacedInfo); } return(retVal); } if (registetedInfo == null) { var o = EntityFactory.CreateOrder(security, message.OrderType, registerKey.Item1); if (o == null) { throw new InvalidOperationException(LocalizedStrings.Str720Params.Put(registerKey.Item1)); } o.Time = message.ServerTime; o.Price = message.OrderPrice; o.Volume = message.OrderVolume ?? 0; o.Direction = message.Side; o.Comment = message.Comment; o.ExpiryDate = message.ExpiryDate; o.Condition = message.Condition; o.UserOrderId = message.UserOrderId; o.ClientCode = message.ClientCode; o.BrokerCode = message.BrokerCode; if (message.PortfolioName.IsEmpty()) { o.Portfolio = _portfolios.FirstOrDefault().Value; } else { pfInfo = ProcessPortfolio(message.PortfolioName); o.Portfolio = ProcessPortfolio(message.PortfolioName).Item1; } if (o.ExtensionInfo == null) { o.ExtensionInfo = new Dictionary <object, object>(); } AddOrder(o); _allOrdersByTransactionId.Add(Tuple.Create(transactionId, false), o); registetedInfo = new OrderInfo(o); orders.Add(registerKey, registetedInfo); } var orderInfo = registetedInfo.ApplyChanges(message, false); UpdateOrderIds(registetedInfo.Order, securityData); return(new[] { orderInfo }); } }
/// <summary> /// /// </summary> /// <param name="userId"></param> /// <param name="orderInfo"></param> /// <returns></returns> protected abstract bool DoNotify(long userId, OrderInfo orderInfo);
protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { bool flag = false; OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int arg_49_0 = orderInfo.GroupBuyId; if (OrderHelper.ConfirmPay(orderInfo)) { DebitNoteInfo debitNoteInfo = new DebitNoteInfo(); debitNoteInfo.NoteId = Globals.GetGenerateId(); debitNoteInfo.OrderId = e.CommandArgument.ToString(); debitNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName; debitNoteInfo.Remark = "后台" + debitNoteInfo.Operator + "收款成功"; OrderHelper.SaveDebitNote(debitNoteInfo); if (orderInfo.GroupBuyId > 0) { int arg_BE_0 = num + num2; } this.BindOrders(); orderInfo.OnPayment(); this.ShowMsg("成功的确认了订单收款", true); return; } this.ShowMsg("确认订单收款失败", false); return; } else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; LineItemInfo lineItemInfo = new LineItemInfo(); foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems) { lineItemInfo = current.Value; if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns) { flag = true; } } if (!flag) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); DistributorsBrower.UpdateCalculationCommission(orderInfo); foreach (LineItemInfo current2 in orderInfo.LineItems.Values) { if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString()) { RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID); } } this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); return; } else { this.ShowMsg("订单中商品有退货(款)不允许完成!", false); } } } }
protected void Page_Load(object sender, EventArgs e) { switch (Globals.RequestFormStr("isCallback")) { case "true": { int num; string str2; string str3; if (string.IsNullOrEmpty(base.Request["ReturnsId"])) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } OrderInfo orderInfo = OrderHelper.GetOrderInfo(base.Request["orderId"]); StringBuilder builder = new StringBuilder(); if (base.Request["type"] == "refund") { RefundHelper.GetRefundType(base.Request["orderId"], out num, out str3); } else { num = 0; str3 = ""; } if (num == 1) { str2 = "退到预存款"; } else { str2 = "银行转帐"; } builder.AppendFormat(",\"OrderTotal\":\"{0}\"", Globals.FormatMoney(orderInfo.GetTotal())); if (!(base.Request["type"] == "replace")) { builder.AppendFormat(",\"RefundType\":\"{0}\"", num); builder.AppendFormat(",\"RefundTypeStr\":\"{0}\"", str2); } builder.AppendFormat(",\"Contacts\":\"{0}\"", orderInfo.ShipTo); builder.AppendFormat(",\"Email\":\"{0}\"", orderInfo.EmailAddress); builder.AppendFormat(",\"Telephone\":\"{0}\"", (orderInfo.TelPhone + " " + orderInfo.CellPhone).Trim()); builder.AppendFormat(",\"Address\":\"{0}\"", orderInfo.Address); builder.AppendFormat(",\"Remark\":\"{0}\"", str3.Replace("\r\n", "")); builder.AppendFormat(",\"PostCode\":\"{0}\"", orderInfo.ZipCode); builder.AppendFormat(",\"GroupBuyId\":\"{0}\"", (orderInfo.GroupBuyId > 0) ? orderInfo.GroupBuyId : 0); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + builder.ToString() + "}"); base.Response.End(); break; } case "GetOrdersStates": { base.Response.ContentType = "application/json"; DataTable allOrderID = OrderHelper.GetAllOrderID(); int length = allOrderID.Select("OrderStatus=" + 12).Length; int num3 = allOrderID.Select("OrderStatus=" + 1).Length; int num4 = allOrderID.Select(string.Concat(new object[] { "OrderStatus=", 2, " or (OrderStatus=", 1, " AND Gateway = 'hishop.plugins.payment.podrequest')" })).Length; int num5 = allOrderID.Select("OrderStatus=" + 3).Length; int num6 = allOrderID.Select("OrderStatus=" + 5).Length; int num7 = OrderHelper.GetCountOrderIDByStatus((OrderStatus)2, (OrderStatus)6) + OrderHelper.GetCountOrderIDByStatus((OrderStatus)3, (OrderStatus)7); int num8 = allOrderID.Select("OrderStatus=" + 4).Length; string s = string.Concat(new object[] { "{\"type\":\"1\",\"allcount\":", length, ",\"waibuyerpaycount\":", num3, ",\"buyalreadypaidcount\":", num4, ",\"sellalreadysentcount\":", num5, ",\"finishedcount\":", num6, ",\"applyforreturnscount\":", num7, ",\"closedcount\":", num8, "}" }); base.Response.Write(s); base.Response.End(); break; } } this.Reurl = base.Request.Url.ToString(); if (!this.Reurl.Contains("?")) { this.Reurl = this.Reurl + "?pageindex=1"; } this.Reurl = Regex.Replace(this.Reurl, @"&t=(\d+)", ""); this.Reurl = Regex.Replace(this.Reurl, @"(\?)t=(\d+)", "?"); this.btnSearchButton.Click += new EventHandler(this.btnSearchButton_Click); this.btnRemark.Click += new EventHandler(this.btnRemark_Click); this.btnCloseOrder.Click += new EventHandler(this.btnCloseOrder_Click); this.btnDeleteAndUpdateData.Click += new EventHandler(this.btnDeleteAndUpdateData_Click); this.btnProductGoods.Click += new EventHandler(this.btnProductGoods_Click); this.btnOrderGoods.Click += new EventHandler(this.btnOrderGoods_Click); this.btnRestoreCheck.Click += new EventHandler(this.btnRestoreCheck_Click); if (!this.Page.IsPostBack) { this.SetOrderStatusLink(); this.bindOrderType(); this.BindOrders(); } }
protected void rptList_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem) { System.Web.UI.WebControls.Repeater repeater = (System.Web.UI.WebControls.Repeater)e.Item.FindControl("rptSubList"); OrderInfo orderInfo = OrderHelper.GetOrderInfo(System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID").ToString()); if (orderInfo != null && orderInfo.LineItems.Count > 0) { repeater.DataSource = orderInfo.LineItems.Values; repeater.DataBind(); } OrderStatus orderStatus = (OrderStatus)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderStatus"); string a = ""; if (!(System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Gateway") is System.DBNull)) { a = (string)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Gateway"); } int num = (System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != System.DBNull.Value) ? ((int)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyId")) : 0; System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnModifyPrice"); System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton2 = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnSendGoods"); System.Web.UI.WebControls.Button button = (System.Web.UI.WebControls.Button)e.Item.FindControl("btnPayOrder"); System.Web.UI.WebControls.Button button2 = (System.Web.UI.WebControls.Button)e.Item.FindControl("btnConfirmOrder"); System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton3 = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnCloseOrderClient"); System.Web.UI.HtmlControls.HtmlAnchor arg_198_0 = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund"); System.Web.UI.HtmlControls.HtmlAnchor arg_1AE_0 = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn"); System.Web.UI.HtmlControls.HtmlAnchor arg_1C4_0 = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace"); System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Item.FindControl("WeiXinNickName"); System.Web.UI.WebControls.Literal literal2 = (System.Web.UI.WebControls.Literal)e.Item.FindControl("litOtherInfo"); int totalPointNumber = orderInfo.GetTotalPointNumber(); MemberInfo member = MemberProcessor.GetMember(orderInfo.UserId, true); if (member != null) { literal.Text = "买家:" + member.UserName; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); decimal total = orderInfo.GetTotal(); if (total > 0m) { stringBuilder.Append("<strong>¥" + total.ToString("F2") + "</strong>"); stringBuilder.Append("<small>(含运费¥" + orderInfo.AdjustedFreight.ToString("F2") + ")</small>"); } if (totalPointNumber > 0) { stringBuilder.Append("<small>" + totalPointNumber.ToString() + "积分</small>"); } if (orderInfo.PaymentType == "货到付款") { stringBuilder.Append("<span class=\"setColor bl\"><strong>货到付款</strong></span>"); } if (string.IsNullOrEmpty(stringBuilder.ToString())) { stringBuilder.Append("<strong>¥" + total.ToString("F2") + "</strong>"); } literal2.Text = stringBuilder.ToString(); if (orderStatus == OrderStatus.WaitBuyerPay) { htmlInputButton.Visible = true; htmlInputButton.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)"); htmlInputButton3.Attributes.Add("onclick", "CloseOrderFun('" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "')"); htmlInputButton3.Visible = true; if (a != "hishop.plugins.payment.podrequest") { button.Visible = true; } } if (num > 0) { GroupBuyStatus groupBuyStatus = (GroupBuyStatus)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus"); htmlInputButton2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && groupBuyStatus == GroupBuyStatus.Success); } else { htmlInputButton2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid || (orderStatus == OrderStatus.WaitBuyerPay && a == "hishop.plugins.payment.podrequest")); } htmlInputButton2.Attributes.Add("onclick", "DialogFrame('../trade/SendOrderGoods.aspx?OrderId=" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'订单发货',750,220)"); button2.Visible = (orderStatus == OrderStatus.SellerAlreadySent); } }
private void buttonSave_Click(object sender, RoutedEventArgs e) { try { MyContext db = new MyContext(); if (IdDelivery == -1) { Order delnew = new Order(); delnew.Employees = db.Emloyees.FirstOrDefault(x => x.Id == EmployeeId); delnew.Date = DateTime.Now; if (checkBox.IsChecked == true) { delnew.Status = true; } else { delnew.Status = false; } foreach (OrderViewModel delvm in lst) { OrderInfo delinfo = new OrderInfo(); delinfo.Count = delvm.Count; delinfo.Products = db.Product.Find(delvm.ProductsId); delnew.OrderInfos.Add(delinfo); } db.Orders.Add(delnew); } else { Order delnew = db.Orders.Include("OrderInfos").FirstOrDefault(x => x.Id == IdDelivery); delnew.Employees = db.Emloyees.FirstOrDefault(x => x.Id == EmployeeId); delnew.OrderInfos.Clear(); delnew.Date = DateTime.Now; if (checkBox.IsChecked == true) { delnew.Status = true; } else { delnew.Status = false; } delnew.OrderInfos.Clear(); foreach (OrderViewModel delvm in lst) { OrderInfo delinfo = new OrderInfo(); delinfo.Count = delvm.Count; delinfo.Products = db.Product.Find(delvm.ProductsId); delnew.OrderInfos.Add(delinfo); } } foreach (OrderInfo s in db.OrderInfos.ToList()) { if (s.ProductsId == null) { db.OrderInfos.Remove(s); } } db.SaveChanges(); Close(); } catch { MessageBox.Show("Error"); } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; this.litShipTo = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo"); this.litPhone = (System.Web.UI.WebControls.Literal) this.FindControl("litPhone"); this.litAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress"); this.litOrderId = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId"); this.litOrderDate = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderDate"); this.litOrderStatus = (OrderStatusLabel)this.FindControl("litOrderStatus"); this.rptOrderProducts = (WapTemplatedRepeater)this.FindControl("rptOrderProducts"); this.litTotalPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalPrice"); this.litPayTime = (System.Web.UI.WebControls.Literal) this.FindControl("litPayTime"); this.orderStatus = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("orderStatus"); this.txtOrderId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtOrderId"); this.litRemark = (System.Web.UI.WebControls.Literal) this.FindControl("litRemark"); this.litShipToDate = (System.Web.UI.WebControls.Literal) this.FindControl("litShipToDate"); this.litShippingCost = (System.Web.UI.WebControls.Literal) this.FindControl("litShippingCost"); this.litCounponPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litCounponPrice"); this.litBuildPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litBuildPrice"); this.litDisCountPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litDisCountPrice"); this.litActualPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litActualPrice"); this.rptPromotions = (WapTemplatedRepeater)this.FindControl("rptPromotions"); this.litTax = (System.Web.UI.WebControls.Literal) this.FindControl("litTax"); this.litPayCharge = (System.Web.UI.WebControls.Literal) this.FindControl("litPayCharge"); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo == null) { base.GotoResourceNotFound("此订单已不存在"); } this.litShipTo.Text = orderInfo.ShipTo; this.litPhone.Text = orderInfo.CellPhone; this.litAddress.Text = orderInfo.ShippingRegion + orderInfo.Address; this.litOrderId.Text = this.orderId; this.litOrderDate.Text = orderInfo.OrderDate.ToString(); this.litTotalPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2")); this.litOrderStatus.OrderStatusCode = orderInfo.OrderStatus; this.litPayTime.SetWhenIsNotNull((orderInfo.PayDate != System.DateTime.MinValue) ? orderInfo.PayDate.ToString("yyyy-MM-dd HH:mm:ss") : ""); this.orderStatus.SetWhenIsNotNull(((int)orderInfo.OrderStatus).ToString()); this.txtOrderId.SetWhenIsNotNull(this.orderId.ToString()); this.litCounponPrice.SetWhenIsNotNull(orderInfo.CouponValue.ToString("F2")); this.litShippingCost.SetWhenIsNotNull(orderInfo.AdjustedFreight.ToString("F2")); this.litShipToDate.SetWhenIsNotNull(orderInfo.ShipToDate); this.litBuildPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2")); this.litDisCountPrice.SetWhenIsNotNull(orderInfo.AdjustedDiscount.ToString("F2")); this.litActualPrice.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2")); this.litRemark.SetWhenIsNotNull(orderInfo.Remark); this.litTax.SetWhenIsNotNull(orderInfo.Tax.ToString("F2")); this.litPayCharge.SetWhenIsNotNull(orderInfo.PayCharge.ToString("F2")); this.rptOrderProducts.DataSource = orderInfo.LineItems.Values; this.rptOrderProducts.DataBind(); System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> >(); if (orderInfo.IsReduced) { list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.Reduced), orderInfo.ReducedPromotionName + string.Format(" 优惠:{0}", orderInfo.ReducedPromotionAmount.ToString("F2")))); } if (orderInfo.IsFreightFree) { list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentFreight), string.Format("{0}", orderInfo.FreightFreePromotionName))); } if (orderInfo.IsSendTimesPoint) { list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentTimesPoint), string.Format("{0}:送{1}倍", orderInfo.SentTimesPointPromotionName, orderInfo.TimesPoint.ToString("F2")))); } this.rptPromotions.DataSource = list; this.rptPromotions.DataBind(); PageTitle.AddSiteNameTitle("订单详情"); WAPHeadName.AddHeadName("订单详情"); }
/// <summary> /// 该订单是否已付款 /// </summary> public static bool IsHasPayed(DataRow dr) { OrderInfo model = new OrderInfo(dr); return(model.PayStatus >= (int)M_OrderList.PayEnum.HasPayed); }
private void WriteOrderInfo(OrderInfo order, ShippersInfo shipper) { string[] strArray = RegionHelper.GetFullRegion(order.RegionId, ",").Split(new char[] { ',' }); StringBuilder builder = new StringBuilder(); builder.AppendLine("<nodes>"); builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-姓名</name>"); builder.AppendFormat("<rename>{0}</rename>", order.ShipTo); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-电话</name>"); builder.AppendFormat("<rename>{0}</rename>", order.TelPhone + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-手机</name>"); builder.AppendFormat("<rename>{0}</rename>", order.CellPhone + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-邮编</name>"); builder.AppendFormat("<rename>{0}</rename>", order.ZipCode + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-地址</name>"); builder.AppendFormat("<rename>{0}</rename>", order.Address); builder.AppendLine("</item>"); if (strArray.Length > 0) { builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-地区1级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray[0]); builder.AppendLine("</item>"); } if (strArray.Length > 1) { builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-地区2级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray[1]); builder.AppendLine("</item>"); } if (strArray.Length > 2) { builder.AppendLine("<item>"); builder.AppendLine("<name>收货人-地区3级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray[2]); builder.AppendLine("</item>"); } if (shipper != null) { string[] strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, ",").Split(new char[] { ',' }); builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-姓名</name>"); builder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-手机</name>"); builder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-电话</name>"); builder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-地址</name>"); builder.AppendFormat("<rename>{0}</rename>", shipper.Address); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-邮编</name>"); builder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_"); builder.AppendLine("</item>"); if (strArray2.Length > 0) { builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-地区1级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray2[0]); builder.AppendLine("</item>"); } if (strArray2.Length > 1) { builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-地区2级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray2[1]); builder.AppendLine("</item>"); } if (strArray2.Length > 2) { builder.AppendLine("<item>"); builder.AppendLine("<name>发货人-地区3级</name>"); builder.AppendFormat("<rename>{0}</rename>", strArray2[2]); builder.AppendLine("</item>"); } } builder.AppendLine("<item>"); builder.AppendLine("<name>订单-订单号</name>"); builder.AppendFormat("<rename>{0}</rename>", order.OrderId); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>订单-总金额</name>"); builder.AppendFormat("<rename>{0}</rename>", order.GetTotal() + "_"); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>订单-物品总重量</name>"); builder.AppendFormat("<rename>{0}</rename>", order.Weight); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>订单-备注</name>"); builder.AppendFormat("<rename>{0}</rename>", order.ManagerRemark); builder.AppendLine("</item>"); string str3 = ""; if ((order.LineItems != null) && (order.LineItems.Count > 0)) { foreach (LineItemInfo info in order.LineItems.Values) { object obj2 = str3; str3 = string.Concat(new object[] { obj2, "货号 ", info.SKU, " ", info.SKUContent, " \x00d7", info.ShipmentQuantity, "\n" }); } str3 = str3.Replace(";", "").Replace(";", "").Replace(":", ":"); } builder.AppendLine("<item>"); builder.AppendLine("<name>订单-详情</name>"); builder.AppendFormat("<rename>{0}</rename>", str3); builder.AppendLine("</item>"); if (order.ShippingDate == DateTime.Parse("0001-1-1")) { builder.AppendLine("<item>"); builder.AppendLine("<name>订单-送货时间</name>"); builder.AppendFormat("<rename>{0}</rename>", "null"); builder.AppendLine("</item>"); } else { builder.AppendLine("<item>"); builder.AppendLine("<name>订单-送货时间</name>"); builder.AppendFormat("<rename>{0}</rename>", order.ShippingDate); builder.AppendLine("</item>"); } builder.AppendLine("<item>"); builder.AppendLine("<name>网店名称</name>"); builder.AppendFormat("<rename>{0}</rename>", SettingsManager.GetMasterSettings(true).SiteName); builder.AppendLine("</item>"); builder.AppendLine("<item>"); builder.AppendLine("<name>自定义内容</name>"); builder.AppendFormat("<rename>{0}</rename>", "null"); builder.AppendLine("</item>"); builder.AppendLine("</nodes>"); base.Response.Write(builder.ToString()); }
public IContent CreateOrderContent(OrderInfo orderInfo) { var contentTypeService = _contentTypeService; //ApplicationContext.Current.Services.ContentTypeService; var contentService = _contentService; // ApplicationContext.Current.Services.ContentService; if (OpenOrderIfAlreadyExisting(orderInfo)) { return(null); } var orderRepositoryType = contentTypeService.GetContentType(Order.OrderRepositoryNodeAlias); if (orderRepositoryType == null) { return(null); } var orderRepository = contentService.GetContentOfContentType(orderRepositoryType.Id).FirstOrDefault(x => !x.Trashed); if (orderRepository == null) { return(null); } var contentToSaveAndPublish = new List <IContent>(); var storeFolderAliasDic = IO.Container.Resolve <ICMSApplication>().GetDictionaryItem("SharedStoreFoldername"); if (string.IsNullOrEmpty(storeFolderAliasDic)) { storeFolderAliasDic = "Orders"; } var storeFolderName = UwebshopConfiguration.Current.ShareBasketBetweenStores ? storeFolderAliasDic : orderInfo.StoreInfo.Alias; var storeFolder = GetOrCreateChildContentWithName(orderRepository, storeFolderName, contentToSaveAndPublish, OrderStoreFolder.NodeAlias); var disableDateFolders = UwebshopConfiguration.Current.DisableDateFolders; var orderParent = storeFolder; IContent yearNode = null; IContent monthNode = null; IContent dayNode = null; if (!disableDateFolders) { Log.Instance.LogDebug("CreateOrderDocument STEP 7"); var year = orderInfo.ConfirmDate.GetValueOrDefault().ToString("yyyy"); var month = orderInfo.ConfirmDate.GetValueOrDefault().ToString("MM"); var day = orderInfo.ConfirmDate.GetValueOrDefault().ToString("dd"); Log.Instance.LogDebug("CreateOrderDocument STEP 8"); yearNode = GetOrCreateChildContentWithName(storeFolder, year, contentToSaveAndPublish, DateFolder.NodeAlias); Log.Instance.LogDebug("CreateOrderDocument STEP 9"); monthNode = GetOrCreateChildContentWithName(yearNode, month, contentToSaveAndPublish, DateFolder.NodeAlias); Log.Instance.LogDebug("CreateOrderDocument STEP 10"); dayNode = GetOrCreateChildContentWithName(monthNode, day, contentToSaveAndPublish, DateFolder.NodeAlias); Log.Instance.LogDebug("CreateOrderDocument STEP 11"); orderParent = dayNode; } var orderDoc = GetOrCreateChildContentWithName(orderParent, orderInfo.OrderNumber, contentToSaveAndPublish, Order.NodeAlias); if (orderDoc.HasProperty("orderGuid")) { orderDoc.SetValue("orderGuid", orderInfo.UniqueOrderId.ToString()); } if (orderDoc.HasProperty("orderDetails")) { orderDoc.SetValue("orderDetails", orderInfo.UniqueOrderId.ToString()); } if (orderDoc.HasProperty("orderPaid")) { orderDoc.SetValue("orderPaid", orderInfo.Paid); } SetCustomProperties(orderInfo.CustomerInfo.CustomerInformation, orderDoc, "customer"); SetCustomProperties(orderInfo.CustomerInfo.ShippingInformation, orderDoc, "shipping"); SetCustomProperties(orderInfo.CustomerInfo.ExtraInformation, orderDoc, "extra"); foreach (var orderline in orderInfo.OrderLines) { var productInfo = orderline.ProductInfo; var contentTypeAlias = contentTypeService.GetAllContentTypes() .Select(ct => ct.Alias) .FirstOrDefault( alias => productInfo.DocTypeAlias != null && alias == productInfo.DocTypeAlias.Replace(Product.NodeAlias, OrderedProduct.NodeAlias)) ?? OrderedProduct.NodeAlias; var orderedProductDoc = contentService.CreateContent(productInfo.Title, orderDoc, contentTypeAlias); contentToSaveAndPublish.Add(orderedProductDoc); SetProperty(orderedProductDoc, "productId", productInfo.Id); SetProperty(orderedProductDoc, "title", productInfo.Title); SetProperty(orderedProductDoc, "sku", productInfo.SKU); SetProperty(orderedProductDoc, "weight", productInfo.Weight.ToString()); SetProperty(orderedProductDoc, "length", productInfo.Length.ToString()); SetProperty(orderedProductDoc, "height", productInfo.Height.ToString()); SetProperty(orderedProductDoc, "width", productInfo.Width.ToString()); SetProperty(orderedProductDoc, "orderedProductDiscountPercentage", productInfo.DiscountPercentage.ToString()); SetProperty(orderedProductDoc, "orderedProductDiscountAmount", productInfo.DiscountAmountInCents.ToString()); SetProperty(orderedProductDoc, "vat", productInfo.Vat.ToString()); SetProperty(orderedProductDoc, "price", productInfo.OriginalPriceInCents.ToString()); SetProperty(orderedProductDoc, "ranges", productInfo.RangesString ?? string.Empty); SetProperty(orderedProductDoc, "itemCount", productInfo.ItemCount.GetValueOrDefault(1).ToString()); SetCustomProperties(orderline.CustomData, orderedProductDoc, null); foreach (var variant in orderline.ProductInfo.ProductVariants) { var variantContentTypeAlias = contentTypeService.GetAllContentTypes() .Select(ct => ct.Alias) .FirstOrDefault( alias => variant.DocTypeAlias != null && alias == variant.DocTypeAlias.Replace(Product.NodeAlias, OrderedProduct.NodeAlias)) ?? OrderedProductVariant.NodeAlias; var variantDoc = contentService.CreateContent(variant.Title, orderedProductDoc, variantContentTypeAlias); contentToSaveAndPublish.Add(variantDoc); SetProperty(variantDoc, "variantId", variant.Id.ToString()); SetProperty(variantDoc, "title", variant.Title); SetProperty(variantDoc, "group", variant.Group); SetProperty(variantDoc, "sku", variant.SKU); SetProperty(variantDoc, "weight", variant.Weight.ToString()); SetProperty(variantDoc, "price", variant.PriceInCents.ToString()); SetProperty(variantDoc, "ranges", variant.RangesString ?? string.Empty); SetProperty(variantDoc, "discountPercentage", variant.DiscountPercentage.ToString()); SetProperty(variantDoc, "discountAmount", variant.DiscountAmountInCents.ToString()); } } contentService.Save(contentToSaveAndPublish); contentService.Publish(storeFolder); if (!disableDateFolders) { if (yearNode != null) { contentService.Publish(yearNode); if (monthNode != null) { contentService.Publish(monthNode); if (dayNode != null) { contentService.Publish(dayNode); } } } } orderInfo.OrderNodeId = orderDoc.Id; orderInfo.Save(); return(orderDoc); }
/// <summary> /// 创建订单 /// </summary> /// <param name="orderInfo">订单信息</param> /// <param name="isPersistOrderProduct">是否需要持久化订单商品</param> /// <param name="orderProductList">订单商品列表</param> /// <returns>订单id</returns> public int CreateOrder(OrderInfo orderInfo, bool isPersistOrderProduct, List <OrderProductInfo> orderProductList) { DbParameter[] parms = { GenerateInParam("@osn", SqlDbType.Char, 30, orderInfo.OSN), GenerateInParam("@uid", SqlDbType.Int, 4, orderInfo.Uid), GenerateInParam("@orderstate", SqlDbType.TinyInt, 1, orderInfo.OrderState), GenerateInParam("@productamount", SqlDbType.Decimal, 8, orderInfo.ProductAmount), GenerateInParam("@orderamount", SqlDbType.Decimal, 8, orderInfo.OrderAmount), GenerateInParam("@surplusmoney", SqlDbType.Decimal, 8, orderInfo.SurplusMoney), GenerateInParam("@parentid", SqlDbType.Int, 4, orderInfo.ParentId), GenerateInParam("@isreview", SqlDbType.TinyInt, 1, orderInfo.IsReview), GenerateInParam("@addtime", SqlDbType.DateTime, 8, orderInfo.AddTime), GenerateInParam("@shipsn", SqlDbType.Char, 30, orderInfo.ShipSN), GenerateInParam("@shipsystemname", SqlDbType.Char, 20, orderInfo.ShipSystemName), GenerateInParam("@shipfriendname", SqlDbType.NChar, 30, orderInfo.ShipFriendName), GenerateInParam("@shiptime", SqlDbType.DateTime, 8, orderInfo.ShipTime), GenerateInParam("@paysn", SqlDbType.Char, 30, orderInfo.PaySN), GenerateInParam("@paysystemname", SqlDbType.Char, 20, orderInfo.PaySystemName), GenerateInParam("@payfriendname", SqlDbType.NChar, 30, orderInfo.PayFriendName), GenerateInParam("@paymode", SqlDbType.TinyInt, 1, orderInfo.PayMode), GenerateInParam("@paytime", SqlDbType.DateTime, 8, orderInfo.PayTime), GenerateInParam("@regionid", SqlDbType.SmallInt, 2, orderInfo.RegionId), GenerateInParam("@consignee", SqlDbType.NVarChar, 30, orderInfo.Consignee), GenerateInParam("@mobile", SqlDbType.VarChar, 15, orderInfo.Mobile), GenerateInParam("@phone", SqlDbType.VarChar, 12, orderInfo.Phone), GenerateInParam("@email", SqlDbType.VarChar, 50, orderInfo.Email), GenerateInParam("@zipcode", SqlDbType.Char, 6, orderInfo.ZipCode), GenerateInParam("@address", SqlDbType.NVarChar, 150, orderInfo.Address), GenerateInParam("@besttime", SqlDbType.DateTime, 8, orderInfo.BestTime), GenerateInParam("@shipfee", SqlDbType.Decimal, 8, orderInfo.ShipFee), GenerateInParam("@payfee", SqlDbType.Decimal, 8, orderInfo.PayFee), GenerateInParam("@fullcut", SqlDbType.Int, 4, orderInfo.FullCut), GenerateInParam("@discount", SqlDbType.Decimal, 8, orderInfo.Discount), GenerateInParam("@paycreditcount", SqlDbType.Int, 4, orderInfo.PayCreditCount), GenerateInParam("@paycreditmoney", SqlDbType.Decimal, 8, orderInfo.PayCreditMoney), GenerateInParam("@couponmoney", SqlDbType.Int, 4, orderInfo.CouponMoney), GenerateInParam("@weight", SqlDbType.Int, 4, orderInfo.Weight), GenerateInParam("@buyerremark", SqlDbType.NVarChar, 250, orderInfo.BuyerRemark), GenerateInParam("@ip", SqlDbType.VarChar, 15, orderInfo.IP) }; int oid = TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}createorder", RDBSHelper.RDBSTablePre), parms), -1); if (oid > 0) { if (isPersistOrderProduct) { StringBuilder recordIdList = new StringBuilder(); foreach (OrderProductInfo orderProductInfo in orderProductList) { recordIdList.AppendFormat("{0},", orderProductInfo.RecordId); } parms = new DbParameter[] { GenerateInParam("@recordidlist", SqlDbType.NVarChar, 1000, recordIdList.Remove(recordIdList.Length - 1, 1).ToString()), GenerateInParam("@oid", SqlDbType.Int, 4, oid), }; RDBSHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("{0}updateorderproductoid", RDBSHelper.RDBSTablePre), parms); } else { foreach (OrderProductInfo orderProductInfo in orderProductList) { orderProductInfo.Oid = oid; parms = new DbParameter[] { GenerateInParam("@oid", SqlDbType.Int, 4, orderProductInfo.Oid), GenerateInParam("@uid", SqlDbType.Int, 4, orderProductInfo.Uid), GenerateInParam("@sid", SqlDbType.Char, 16, orderProductInfo.Sid), GenerateInParam("@pid", SqlDbType.Int, 4, orderProductInfo.Pid), GenerateInParam("@psn", SqlDbType.Char, 30, orderProductInfo.PSN), GenerateInParam("@cateid", SqlDbType.SmallInt, 2, orderProductInfo.CateId), GenerateInParam("@brandid", SqlDbType.Int, 4, orderProductInfo.BrandId), GenerateInParam("@name", SqlDbType.NVarChar, 200, orderProductInfo.Name), GenerateInParam("@showimg", SqlDbType.NVarChar, 100, orderProductInfo.ShowImg), GenerateInParam("@discountprice", SqlDbType.Decimal, 4, orderProductInfo.DiscountPrice), GenerateInParam("@costprice", SqlDbType.Decimal, 4, orderProductInfo.CostPrice), GenerateInParam("@shopprice", SqlDbType.Decimal, 4, orderProductInfo.ShopPrice), GenerateInParam("@marketprice", SqlDbType.Decimal, 4, orderProductInfo.MarketPrice), GenerateInParam("@weight", SqlDbType.Int, 4, orderProductInfo.Weight), GenerateInParam("@isreview", SqlDbType.TinyInt, 1, orderProductInfo.IsReview), GenerateInParam("@realcount", SqlDbType.Int, 4, orderProductInfo.RealCount), GenerateInParam("@buycount", SqlDbType.Int, 4, orderProductInfo.BuyCount), GenerateInParam("@sendcount", SqlDbType.Int, 4, orderProductInfo.SendCount), GenerateInParam("@type", SqlDbType.TinyInt, 1, orderProductInfo.Type), GenerateInParam("@paycredits", SqlDbType.Int, 4, orderProductInfo.PayCredits), GenerateInParam("@coupontypeid", SqlDbType.Int, 4, orderProductInfo.CouponTypeId), GenerateInParam("@extcode1", SqlDbType.Int, 4, orderProductInfo.ExtCode1), GenerateInParam("@extcode2", SqlDbType.Int, 4, orderProductInfo.ExtCode2), GenerateInParam("@extcode3", SqlDbType.Int, 4, orderProductInfo.ExtCode3), GenerateInParam("@extcode4", SqlDbType.Int, 4, orderProductInfo.ExtCode4), GenerateInParam("@extcode5", SqlDbType.Int, 4, orderProductInfo.ExtCode5), GenerateInParam("@addtime", SqlDbType.DateTime, 8, orderProductInfo.AddTime) }; RDBSHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("{0}addorderproduct", RDBSHelper.RDBSTablePre), parms); } } } return(oid); }