private string GetOrderItemListData(string itemlist, string orderid)
        {
            StringBuilder builder = new StringBuilder();
            int           id      = 0;

            if (!string.IsNullOrEmpty(itemlist) && !string.IsNullOrEmpty(orderid))
            {
                foreach (string str in itemlist.Split(new char[] { ',' }))
                {
                    id = Globals.ToNum(str);
                    if (id > 0)
                    {
                        LineItemInfo lineItemInfo = OrderSplitHelper.GetLineItemInfo(id, orderid);
                        if (lineItemInfo != null)
                        {
                            builder.Append(string.Concat(new object[] {
                                ",{\"ID\":\"", lineItemInfo.ID, "\",\"ProductID\":\"", lineItemInfo.ProductId.ToString(), "\",\"SkuID\":\"", lineItemInfo.SkuId, "\",\"Quantity\":\"", lineItemInfo.Quantity.ToString(), "\",\"ItemListPrice\":\"", lineItemInfo.ItemListPrice.ToString("F2"), "\",\"SKUContent\":\"", Globals.String2Json(lineItemInfo.SKUContent), "\",\"ThumbnailsUrl\":\"", Globals.String2Json(lineItemInfo.ThumbnailsUrl), "\",\"OrderItemsStatus\":\"", this.GetItemStateName(lineItemInfo.OrderItemsStatus),
                                "\",\"ItemDescription\":\"", Globals.String2Json(lineItemInfo.ItemDescription), "\"}"
                            }));
                        }
                    }
                }
            }
            return(builder.ToString().Trim(new char[] { ',' }));
        }
示例#2
0
        protected override void AttachChildControls()
        {
            this.hidOrderStatus = (HtmlInputHidden)this.FindControl("OrderStatus");
            this.hidskuid       = (HtmlInputHidden)this.FindControl("skuid");
            this.hidorderid     = (HtmlInputHidden)this.FindControl("orderid");
            this.hidorderitemid = (HtmlInputHidden)this.FindControl("orderitemid");
            this.hidproductid   = (HtmlInputHidden)this.FindControl("productid");
            this.orderId        = this.Page.Request.QueryString["orderId"].Trim();
            this.SKuId          = Globals.RequestQueryStr("skuid").Trim();
            if (string.IsNullOrEmpty(this.SKuId))
            {
                int          id           = Globals.RequestQueryNum("ID");
                LineItemInfo lineItemInfo = OrderSplitHelper.GetLineItemInfo(id, this.orderId);
                if (lineItemInfo != null)
                {
                    this.SKuId = lineItemInfo.SkuId;
                    this.hidorderitemid.Value = id.ToString();
                }
            }
            this.hidorderid.Value     = this.orderId;
            this.hidskuid.Value       = this.SKuId;
            this.litimage             = (Literal)this.FindControl("litimage");
            this.litname              = (Literal)this.FindControl("litname");
            this.litItemAdjustedPrice = (Literal)this.FindControl("litItemAdjustedPrice");
            this.litQuantity          = (Literal)this.FindControl("litQuantity");
            this.rptOrderProducts     = (VshopTemplatedRepeater)this.FindControl("rptOrderProducts");
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            this.hidOrderStatus.Value = ((int)orderInfo.OrderStatus).ToString();
            if (orderInfo == null)
            {
                base.GotoResourceNotFound("此订单已不存在");
            }
            bool flag = false;

            foreach (LineItemInfo info3 in orderInfo.LineItems.Values)
            {
                if (info3.SkuId.ToString() == this.SKuId)
                {
                    this.litimage.Text             = "<image src=\"" + info3.ThumbnailsUrl + "\"></image>";
                    this.litname.Text              = info3.ItemDescription;
                    this.litItemAdjustedPrice.Text = info3.ItemAdjustedPrice.ToString("0.00");
                    this.litQuantity.Text          = info3.Quantity.ToString();
                    this.hidproductid.Value        = info3.ProductId.ToString();
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                base.GotoResourceNotFound("此订单商品不存在");
            }
            PageTitle.AddSiteNameTitle("申请退货");
        }
示例#3
0
 private string GetOrderItemListData(string itemlist, string orderid)
 {
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     if (!string.IsNullOrEmpty(itemlist) && !string.IsNullOrEmpty(orderid))
     {
         string[] array = itemlist.Split(new char[]
         {
             ','
         });
         string[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             string s   = array2[i];
             int    num = Globals.ToNum(s);
             if (num > 0)
             {
                 LineItemInfo lineItemInfo = OrderSplitHelper.GetLineItemInfo(num, orderid);
                 if (lineItemInfo != null)
                 {
                     stringBuilder.Append(string.Concat(new object[]
                     {
                         ",{\"ID\":\"",
                         lineItemInfo.ID,
                         "\",\"ProductID\":\"",
                         lineItemInfo.ProductId.ToString(),
                         "\",\"SkuID\":\"",
                         lineItemInfo.SkuId,
                         "\",\"Quantity\":\"",
                         lineItemInfo.Quantity.ToString(),
                         "\",\"ItemListPrice\":\"",
                         lineItemInfo.ItemListPrice.ToString("F2"),
                         "\",\"SKUContent\":\"",
                         Globals.String2Json(lineItemInfo.SKUContent),
                         "\",\"ThumbnailsUrl\":\"",
                         Globals.String2Json(lineItemInfo.ThumbnailsUrl),
                         "\",\"OrderItemsStatus\":\"",
                         this.GetItemStateName(lineItemInfo.OrderItemsStatus),
                         "\",\"ItemDescription\":\"",
                         Globals.String2Json(lineItemInfo.ItemDescription),
                         "\"}"
                     }));
                 }
             }
         }
     }
     return(stringBuilder.ToString().Trim(new char[]
     {
         ','
     }));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str2;
            string str4;
            int    num2;
            string str = Globals.RequestFormStr("posttype");

            if (string.IsNullOrEmpty(this.reUrl))
            {
                this.reUrl = "manageorder.aspx";
            }
            switch (str)
            {
            case "getordersplit":
            {
                base.Response.ContentType = "application/json";
                str2         = "[]";
                this.orderId = Globals.RequestFormStr("orderid");
                IList <OrderSplitInfo> orderSplitItems = OrderSplitHelper.GetOrderSplitItems(this.orderId);
                if (orderSplitItems.Count <= 0)
                {
                    OrderInfo     orderInfo = OrderHelper.GetOrderInfo(this.orderId);
                    StringBuilder builder2  = new StringBuilder();
                    if (orderInfo != null)
                    {
                        if (orderInfo.SplitState > 0)
                        {
                            builder2.Append("{\"id\":\"splited\"}");
                        }
                        else
                        {
                            builder2.Append("[");
                            if (orderInfo != null)
                            {
                                builder2.Append("{\"id\":0,\"orderid\":\"" + orderInfo.OrderId + "\",\"adjustedfreight\":" + orderInfo.AdjustedFreight.ToString("F2") + ",\"data\":[" + this.GetOrderItemListByOrder(orderInfo) + "]}");
                            }
                            builder2.Append("]");
                        }
                    }
                    str2 = builder2.ToString();
                    break;
                }
                StringBuilder builder = new StringBuilder();
                builder.Append("[");
                int num = 0;
                foreach (OrderSplitInfo info in orderSplitItems)
                {
                    if (num != 0)
                    {
                        builder.Append(",");
                    }
                    num++;
                    builder.Append(string.Concat(new object[] { "{\"id\":", info.Id, ",\"orderid\":\"", this.FormatNewOrderID(info.OldOrderId, info.OrderIDNum.ToString()), "\",\"adjustedfreight\":", info.AdjustedFreight.ToString("F2"), ",\"data\":[", this.GetOrderItemListData(info.ItemList, info.OldOrderId), "]}" }));
                }
                builder.Append("]");
                str2 = builder.ToString();
                break;
            }

            case "savesplit":
            {
                base.Response.ContentType = "application/json";
                string neworderid = Globals.RequestFormStr("toorderid");
                str4 = Globals.RequestFormStr("fromorderid");
                num2 = Globals.RequestFormNum("itemid");
                string skuid = Globals.RequestFormStr("fromskuid");
                str2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                OrderInfo oldOrderInfo = OrderHelper.GetOrderInfo(str4);
                if (oldOrderInfo != null)
                {
                    if ((oldOrderInfo.OrderStatus != OrderStatus.WaitBuyerPay) && (oldOrderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid))
                    {
                        OrderSplitHelper.DelOrderSplitByOrderID(str4, null);
                        str2 = "{\"type\":\"3\",\"tips\":\"当前订单状态不允许拆分!\"}";
                    }
                    else
                    {
                        decimal num3 = oldOrderInfo.GetTotal() - oldOrderInfo.AdjustedFreight;
                        decimal num4 = 0M;
                        foreach (LineItemInfo info4 in oldOrderInfo.LineItems.Values)
                        {
                            if (info4.ID == num2)
                            {
                                if (info4.Type != 1)
                                {
                                    num4 = ((info4.ItemAdjustedPrice * info4.Quantity) - info4.ItemAdjustedCommssion) - info4.DiscountAverage;
                                }
                                break;
                            }
                        }
                        if (num4 >= num3)
                        {
                            str2 = "{\"type\":\"0\",\"tips\":\"订单拆分后,原订单的价格将不大于0!\"}";
                        }
                        else if ((num4 == 0M) && (neworderid == "0"))
                        {
                            str2 = "{\"type\":\"0\",\"tips\":\"订单拆分后,新订单的价格必须大于0!\"}";
                        }
                        else
                        {
                            string str10 = OrderSplitHelper.OrderSplitToTemp(oldOrderInfo, skuid, neworderid, num2);
                            if (str10 != null)
                            {
                                if (!(str10 == "1"))
                                {
                                    if (str10 == "-1")
                                    {
                                        str2 = "{\"type\":\"0\",\"tips\":\"订单只有一条记录,不允许拆分!\"}";
                                    }
                                    else if (str10 == "-2")
                                    {
                                        str2 = "{\"type\":\"0\",\"tips\":\"非法数据!\"}";
                                    }
                                    else if (str10 == "-3")
                                    {
                                        str2 = "{\"type\":\"0\",\"tips\":\"拆分出去的订单价格必须大于0!\"}";
                                    }
                                }
                                else
                                {
                                    str2 = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                                }
                            }
                        }
                    }
                }
                base.Response.Write(str2);
                base.Response.End();
                return;
            }

            case "cancelordersplit":
            {
                string str11;
                base.Response.ContentType = "application/json";
                str4 = Globals.RequestFormStr("fromorderid");
                num2 = Globals.RequestFormNum("itemid");
                int fromsplitid = Globals.RequestFormNum("fromsplitid");
                str2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                if ((((OrderHelper.GetOrderInfo(str4) != null) && (num2 > 0)) && ((fromsplitid > 0) && ((str11 = OrderSplitHelper.CancelSplitOrderByID(str4, fromsplitid, num2)) != null))) && (str11 == "1"))
                {
                    str2 = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                }
                base.Response.Write(str2);
                base.Response.End();
                return;
            }

            case "editfright":
            {
                base.Response.ContentType = "application/json";
                str2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                int     id     = Globals.RequestFormNum("id");
                decimal result = 0M;
                decimal.TryParse(Globals.RequestFormStr("val"), out result);
                if (result >= 0M)
                {
                    OrderSplitInfo orderSplitInfo = OrderSplitHelper.GetOrderSplitInfo(id);
                    if (orderSplitInfo != null)
                    {
                        orderSplitInfo.AdjustedFreight = result;
                        if (OrderSplitHelper.UpdateOrderSplitFright(orderSplitInfo))
                        {
                            str2 = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                        }
                    }
                }
                base.Response.Write(str2);
                base.Response.End();
                return;
            }

            case "cancelsplittoorder":
                base.Response.ContentType = "application/json";
                str2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                if (OrderSplitHelper.DelOrderSplitByOrderID(Globals.RequestFormStr("fromorderid"), null))
                {
                    str2 = "{\"type\":\"1\",\"tips\":\"取消成功!\"}";
                }
                base.Response.Write(str2);
                base.Response.End();
                return;

            case "savesplittoorder":
            {
                base.Response.ContentType = "application/json";
                str2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                str4 = Globals.RequestFormStr("fromorderid");
                IList <OrderSplitInfo> infoList = OrderSplitHelper.GetOrderSplitItems(str4);
                if (infoList.Count <= 1)
                {
                    str2 = "{\"type\":\"0\",\"tips\":\"订单未拆分,不能保存!\"}";
                }
                else
                {
                    OrderInfo oldorderinfo = OrderHelper.GetOrderInfo(str4);
                    if (oldorderinfo == null)
                    {
                        str2 = "{\"type\":\"0\",\"tips\":\"主订单已不存在,不能保存!\"}";
                    }
                    else if ((oldorderinfo.OrderStatus != OrderStatus.WaitBuyerPay) && (oldorderinfo.OrderStatus != OrderStatus.BuyerAlreadyPaid))
                    {
                        str2 = "{\"type\":\"0\",\"tips\":\"待付款和待发货状态的订单才允许拆分!\"}";
                    }
                    else
                    {
                        string str8 = OrderSplitHelper.UpdateAndCreateOrderByOrderSplitInfo(infoList, oldorderinfo);
                        if (str8 == "1")
                        {
                            str2 = "{\"type\":\"1\",\"tips\":\"订单拆分成功!\"}";
                        }
                        else
                        {
                            str2 = "{\"type\":\"0\",\"tips\":\"订单拆分失败,原因是" + str8 + "!\"}";
                        }
                    }
                }
                base.Response.Write(str2);
                base.Response.End();
                return;
            }

            default:
                return;
            }
            base.Response.Write(str2);
            base.Response.End();
        }
示例#5
0
        protected void btnAgreeConfirm_Click(object sender, EventArgs e)
        {
            decimal result = 0M;

            decimal.TryParse(this.txtMoney.Text.Trim(), out result);
            decimal balancePayMoneyTotal = 0M;
            int     num3      = 0;
            int     num4      = Globals.ToNum(this.hdProductID.Value);
            int     returnsid = Globals.ToNum(this.hdReturnsId.Value);

            this.hdSkuID.Value.Trim();
            if (num4 <= 0)
            {
                this.ShowMsg("服务器错误,请刷新页面重试!", false);
            }
            else
            {
                decimal num6 = 0M;
                decimal.TryParse(Globals.RequestFormStr("ctl00$ContentPlaceHolder1$hdBalance"), out num6);
                RefundInfo orderReturnsByReturnsID = RefundHelper.GetOrderReturnsByReturnsID(returnsid);
                if (orderReturnsByReturnsID != null)
                {
                    orderReturnsByReturnsID.AdminRemark  = this.txtMemo.Text.Trim();
                    orderReturnsByReturnsID.HandleTime   = DateTime.Now;
                    orderReturnsByReturnsID.RefundTime   = DateTime.Now.ToString();
                    orderReturnsByReturnsID.HandleStatus = RefundInfo.Handlestatus.Refunded;
                    orderReturnsByReturnsID.Operator     = Globals.GetCurrentManagerUserId().ToString();
                    if (result < 0M)
                    {
                        this.ShowMsg("输入的金额格式不正确", false);
                    }
                    else
                    {
                        orderReturnsByReturnsID.RefundMoney        = result;
                        orderReturnsByReturnsID.RefundId           = orderReturnsByReturnsID.ReturnsId;
                        orderReturnsByReturnsID.BalanceReturnMoney = num6;
                        if (RefundHelper.UpdateByReturnsId(orderReturnsByReturnsID))
                        {
                            OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderReturnsByReturnsID.OrderId);
                            balancePayMoneyTotal = orderInfo.BalancePayMoneyTotal;
                            if (result > orderInfo.BalancePayMoneyTotal)
                            {
                                orderInfo.BalancePayMoneyTotal        = 0M;
                                orderInfo.BalancePayFreightMoneyTotal = 0M;
                                foreach (LineItemInfo info3 in orderInfo.LineItems.Values)
                                {
                                    info3.BalancePayMoney = 0M;
                                }
                            }
                            else if ((result >= num6) && (result <= orderInfo.BalancePayMoneyTotal))
                            {
                                orderInfo.BalancePayMoneyTotal       -= result;
                                orderInfo.BalancePayFreightMoneyTotal = ((orderInfo.BalancePayFreightMoneyTotal - (result - num6)) <= 0M) ? 0M : (orderInfo.BalancePayFreightMoneyTotal - (result - num6));
                                decimal num7 = (((result - num6) - orderInfo.BalancePayFreightMoneyTotal) <= 0M) ? 0M : ((result - num6) - orderInfo.BalancePayFreightMoneyTotal);
                                foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                                {
                                    if ((!string.IsNullOrEmpty(orderReturnsByReturnsID.SkuId) && (info4.SkuId == orderReturnsByReturnsID.SkuId)) || ((info4.ProductId == orderReturnsByReturnsID.ProductId) && string.IsNullOrEmpty(info4.SkuId)))
                                    {
                                        info4.BalancePayMoney = 0M;
                                    }
                                    else if ((num7 > 0M) && (info4.BalancePayMoney > 0M))
                                    {
                                        info4.BalancePayMoney = (info4.BalancePayMoney <= num7) ? 0M : (info4.BalancePayMoney - num7);
                                        num7 -= info4.BalancePayMoney;
                                    }
                                }
                            }
                            else if (result < num6)
                            {
                                orderInfo.BalancePayMoneyTotal -= result;
                                foreach (LineItemInfo info5 in orderInfo.LineItems.Values)
                                {
                                    if ((!string.IsNullOrEmpty(orderReturnsByReturnsID.SkuId) && (info5.SkuId == orderReturnsByReturnsID.SkuId)) || ((info5.ProductId == orderReturnsByReturnsID.ProductId) && string.IsNullOrEmpty(info5.SkuId)))
                                    {
                                        info5.BalancePayMoney -= result;
                                    }
                                }
                            }
                            string skuid = null;
                            string stock = null;
                            foreach (LineItemInfo info6 in orderInfo.LineItems.Values)
                            {
                                if ((!string.IsNullOrEmpty(orderReturnsByReturnsID.SkuId) && (info6.SkuId == orderReturnsByReturnsID.SkuId)) || ((info6.ProductId == orderReturnsByReturnsID.ProductId) && string.IsNullOrEmpty(info6.SkuId)))
                                {
                                    skuid = info6.SkuId;
                                    stock = info6.Quantity.ToString();
                                    info6.OrderItemsStatus = OrderStatus.Refunded;
                                    break;
                                }
                            }
                            if (!RefundHelper.UpdateOrderGoodStatu(this.hdfOrderID.Value, skuid, 9, orderReturnsByReturnsID.OrderItemID))
                            {
                                return;
                            }
                            RefundHelper.UpdateRefundOrderStock(stock, skuid);
                            foreach (LineItemInfo info7 in orderInfo.LineItems.Values)
                            {
                                if ((info7.OrderItemsStatus.ToString() == OrderStatus.Refunded.ToString()) || (info7.OrderItemsStatus.ToString() == OrderStatus.Returned.ToString()))
                                {
                                    num3++;
                                }
                            }
                            OrderHelper.UpdateOrderAmount(orderInfo);
                            if (orderInfo.LineItems.Values.Count == num3)
                            {
                                this.CloseOrder(this.hdfOrderID.Value);
                                orderInfo.OrderStatus = OrderStatus.Closed;
                            }
                            OrderHelper.UpdateCalculadtionCommission(this.hdfOrderID.Value);
                            int     orderItemID = orderReturnsByReturnsID.OrderItemID;
                            decimal d           = 0M;
                            if (orderItemID > 0)
                            {
                                if (OrderSplitHelper.GetLineItemInfo(orderItemID, "") != null)
                                {
                                    d = (result > balancePayMoneyTotal) ? balancePayMoneyTotal : result;
                                }
                                if (d > 0M)
                                {
                                    orderReturnsByReturnsID = RefundHelper.GetOrderReturnsByReturnsID(returnsid);
                                    RefundHelper.UpdateByReturnsId(orderReturnsByReturnsID);
                                    OrderHelper.MemberAmountAddByRefund(MemberHelper.GetMember(orderInfo.UserId), decimal.Round(d, 2), this.hdfOrderID.Value);
                                    OrderHelper.UpdateOrder(orderInfo);
                                    OrderHelper.UpdateOrderItems(orderInfo);
                                }
                            }
                            try
                            {
                                Messenger.SendWeiXinMsg_RefundSuccess(orderReturnsByReturnsID);
                            }
                            catch (Exception exception)
                            {
                                Globals.Debuglog("订单退款成功提醒消息异常" + exception.ToString(), "_DebuglogSendMsgRefund.txt");
                            }
                            this.ShowMsgAndReUrl("同意退款成功!", true, "OrderDetails.aspx?OrderId=" + this.hdfOrderID.Value + "&t=" + DateTime.Now.ToString("HHmmss"));
                            try
                            {
                                this.myNotifier.updateAction  = UpdateAction.OrderUpdate;
                                this.myNotifier.actionDesc    = "同意退款成功";
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.HasValue ? orderInfo.PayDate.Value : DateTime.Today;
                                this.myNotifier.DataUpdated  += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                                this.myNotifier.UpdateDB();
                                return;
                            }
                            catch (Exception exception2)
                            {
                                Globals.Debuglog(exception2.Message, "_Debuglog.txt");
                                return;
                            }
                        }
                        this.ShowMsg("退款失败,请重试。", false);
                    }
                }
            }
        }
示例#6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = Globals.RequestFormStr("posttype");

            if (string.IsNullOrEmpty(this.reUrl))
            {
                this.reUrl = "manageorder.aspx";
            }
            string key;

            switch (key = text)
            {
            case "getordersplit":
            {
                base.Response.ContentType = "application/json";
                string s = "[]";
                this.orderId = Globals.RequestFormStr("orderid");
                System.Collections.Generic.IList <OrderSplitInfo> orderSplitItems = OrderSplitHelper.GetOrderSplitItems(this.orderId);
                if (orderSplitItems.Count > 0)
                {
                    System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                    stringBuilder.Append("[");
                    int num2 = 0;
                    foreach (OrderSplitInfo current in orderSplitItems)
                    {
                        if (num2 != 0)
                        {
                            stringBuilder.Append(",");
                        }
                        num2++;
                        stringBuilder.Append(string.Concat(new object[]
                            {
                                "{\"id\":",
                                current.Id,
                                ",\"orderid\":\"",
                                this.FormatNewOrderID(current.OldOrderId, current.OrderIDNum.ToString()),
                                "\",\"adjustedfreight\":",
                                current.AdjustedFreight.ToString("F2"),
                                ",\"data\":[",
                                this.GetOrderItemListData(current.ItemList, current.OldOrderId),
                                "]}"
                            }));
                    }
                    stringBuilder.Append("]");
                    s = stringBuilder.ToString();
                }
                else
                {
                    OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);
                    System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                    if (orderInfo != null)
                    {
                        if (orderInfo.SplitState > 0)
                        {
                            stringBuilder2.Append("{\"id\":\"splited\"}");
                        }
                        else
                        {
                            stringBuilder2.Append("[");
                            if (orderInfo != null)
                            {
                                stringBuilder2.Append(string.Concat(new string[]
                                    {
                                        "{\"id\":0,\"orderid\":\"",
                                        orderInfo.OrderId,
                                        "\",\"adjustedfreight\":",
                                        orderInfo.AdjustedFreight.ToString("F2"),
                                        ",\"data\":[",
                                        this.GetOrderItemListByOrder(orderInfo),
                                        "]}"
                                    }));
                            }
                            stringBuilder2.Append("]");
                        }
                    }
                    s = stringBuilder2.ToString();
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }

            case "savesplit":
            {
                base.Response.ContentType = "application/json";
                string    text2      = Globals.RequestFormStr("toorderid");
                string    text3      = Globals.RequestFormStr("fromorderid");
                int       num3       = Globals.RequestFormNum("itemid");
                string    skuid      = Globals.RequestFormStr("fromskuid");
                string    s          = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                OrderInfo orderInfo2 = OrderHelper.GetOrderInfo(text3);
                if (orderInfo2 != null)
                {
                    if (orderInfo2.OrderStatus == OrderStatus.WaitBuyerPay || orderInfo2.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        decimal d  = orderInfo2.GetTotal() - orderInfo2.AdjustedFreight;
                        decimal d2 = 0m;
                        foreach (LineItemInfo current2 in orderInfo2.LineItems.Values)
                        {
                            if (current2.ID == num3)
                            {
                                if (current2.Type != 1)
                                {
                                    d2 = current2.ItemAdjustedPrice * current2.Quantity - current2.ItemAdjustedCommssion - current2.DiscountAverage;
                                    break;
                                }
                                break;
                            }
                        }
                        if (d2 >= d)
                        {
                            s = "{\"type\":\"0\",\"tips\":\"订单拆分后,原订单的价格将不大于0!\"}";
                        }
                        else if (d2 == 0m && text2 == "0")
                        {
                            s = "{\"type\":\"0\",\"tips\":\"订单拆分后,新订单的价格必须大于0!\"}";
                        }
                        else
                        {
                            string text4 = OrderSplitHelper.OrderSplitToTemp(orderInfo2, skuid, text2, num3);
                            string a;
                            if ((a = text4) != null)
                            {
                                if (!(a == "1"))
                                {
                                    if (!(a == "-1"))
                                    {
                                        if (!(a == "-2"))
                                        {
                                            if (a == "-3")
                                            {
                                                s = "{\"type\":\"0\",\"tips\":\"拆分出去的订单价格必须大于0!\"}";
                                            }
                                        }
                                        else
                                        {
                                            s = "{\"type\":\"0\",\"tips\":\"非法数据!\"}";
                                        }
                                    }
                                    else
                                    {
                                        s = "{\"type\":\"0\",\"tips\":\"订单只有一条记录,不允许拆分!\"}";
                                    }
                                }
                                else
                                {
                                    s = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                                }
                            }
                        }
                    }
                    else
                    {
                        OrderSplitHelper.DelOrderSplitByOrderID(text3, null);
                        s = "{\"type\":\"3\",\"tips\":\"当前订单状态不允许拆分!\"}";
                    }
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }

            case "cancelordersplit":
            {
                base.Response.ContentType = "application/json";
                string    text3      = Globals.RequestFormStr("fromorderid");
                int       num3       = Globals.RequestFormNum("itemid");
                int       num4       = Globals.RequestFormNum("fromsplitid");
                string    s          = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                OrderInfo orderInfo2 = OrderHelper.GetOrderInfo(text3);
                if (orderInfo2 != null && num3 > 0 && num4 > 0)
                {
                    string text5 = OrderSplitHelper.CancelSplitOrderByID(text3, num4, num3);
                    string a2;
                    if ((a2 = text5) != null && a2 == "1")
                    {
                        s = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                    }
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }

            case "editfright":
            {
                base.Response.ContentType = "application/json";
                string  s    = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                int     id   = Globals.RequestFormNum("id");
                decimal num5 = 0m;
                decimal.TryParse(Globals.RequestFormStr("val"), out num5);
                if (num5 >= 0m)
                {
                    OrderSplitInfo orderSplitInfo = OrderSplitHelper.GetOrderSplitInfo(id);
                    if (orderSplitInfo != null)
                    {
                        orderSplitInfo.AdjustedFreight = num5;
                        if (OrderSplitHelper.UpdateOrderSplitFright(orderSplitInfo))
                        {
                            s = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                        }
                    }
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }

            case "cancelsplittoorder":
            {
                base.Response.ContentType = "application/json";
                string s     = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                string text3 = Globals.RequestFormStr("fromorderid");
                if (OrderSplitHelper.DelOrderSplitByOrderID(text3, null))
                {
                    s = "{\"type\":\"1\",\"tips\":\"取消成功!\"}";
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }

            case "savesplittoorder":
            {
                base.Response.ContentType = "application/json";
                string s     = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                string text3 = Globals.RequestFormStr("fromorderid");
                System.Collections.Generic.IList <OrderSplitInfo> orderSplitItems2 = OrderSplitHelper.GetOrderSplitItems(text3);
                if (orderSplitItems2.Count > 1)
                {
                    OrderInfo orderInfo3 = OrderHelper.GetOrderInfo(text3);
                    if (orderInfo3 != null)
                    {
                        if (orderInfo3.OrderStatus == OrderStatus.WaitBuyerPay || orderInfo3.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                        {
                            string text6 = OrderSplitHelper.UpdateAndCreateOrderByOrderSplitInfo(orderSplitItems2, orderInfo3);
                            if (text6 == "1")
                            {
                                s = "{\"type\":\"1\",\"tips\":\"订单拆分成功!\"}";
                            }
                            else
                            {
                                s = "{\"type\":\"0\",\"tips\":\"订单拆分失败,原因是" + text6 + "!\"}";
                            }
                        }
                        else
                        {
                            s = "{\"type\":\"0\",\"tips\":\"待付款和待发货状态的订单才允许拆分!\"}";
                        }
                    }
                    else
                    {
                        s = "{\"type\":\"0\",\"tips\":\"主订单已不存在,不能保存!\"}";
                    }
                }
                else
                {
                    s = "{\"type\":\"0\",\"tips\":\"订单未拆分,不能保存!\"}";
                }
                base.Response.Write(s);
                base.Response.End();
                break;
            }

                return;
            }
        }