コード例 #1
0
        public void HighPrintCancel(int orderId)
        {
            var    orderItem = OrderDao.FindById(orderId);
            string procType  = XMLUtil.GetString(orderItem.Content, "PARENTHIGHPRINT", "PROCTYPE");
            int    addPrice  = XMLUtil.GetInt32(orderItem.Content, "PARENTHIGHPRINT", "ADDPRICE");

            if ("NEWGOODS".Equals(procType))
            {
                var highOrder = OrderDao.FIndByHighPrintId(orderItem.Id);
                PrintMadeOrderDao.ChangePrintPriorityByOrderCode(orderItem.Code, "");
                var payInfo = PayInfoDao.FindById(highOrder.Id);
                if (payInfo != null && payInfo.PayType.StartsWith("TELEGRAM"))
                {
                    CancleOrderWithTelegram(highOrder.Id);
                }
                else
                {
                    CancleOrder(highOrder.Id);
                }
            }
            if ("ADDPRICE".Equals(procType))
            {
                string firstItemType = string.Empty;
                int    firstItemId   = 0;
                foreach (var item in PrintMadeOrderDao.FindByOrderId(orderItem.Id))
                {
                    firstItemType = "PRINTMADE";
                    firstItemId   = item.Id;
                    break;
                }
                foreach (var item in ReadyMadeOrderDao.FindByOrderId(orderItem.Id))
                {
                    firstItemType = "READMADE";
                    firstItemId   = item.Id;
                    break;
                }

                if ("PRINTMADE".Equals(firstItemType))
                {
                    var madeItem = PrintMadeOrderDao.FindById(firstItemId);
                    int orgPrice = madeItem.TaxAddedTotalPrice;
                    madeItem.ExtraPrice -= addPrice;
                    PrintMadeOrderDao.Update(madeItem);
                    DeliveryInfoItem DeliveryInfoItem = DeliveryInfoDao.FindById(orderItem.DeliveryInfoId);
                    PayInfoService.UpdateChangeProductCharge(orderItem.PayInfoId, "MINUS", orgPrice, DeliveryInfoItem);
                    PayInfoService.UpdateChangeProductCharge(orderItem.PayInfoId, "PLUS", madeItem.TaxAddedTotalPrice, DeliveryInfoItem);
                }
                else if ("READYMADE".Equals(firstItemType))
                {
                    var madeItem = ReadyMadeOrderDao.FindById(firstItemId);
                    int orgPrice = madeItem.TaxAddedTotalPrice;
                    madeItem.ExtraPrice -= addPrice;
                    ReadyMadeOrderDao.Update(madeItem);
                    DeliveryInfoItem DeliveryInfoItem = DeliveryInfoDao.FindById(orderItem.DeliveryInfoId);
                    PayInfoService.UpdateChangeProductCharge(orderItem.PayInfoId, "MINUS", orgPrice, DeliveryInfoItem);
                    PayInfoService.UpdateChangeProductCharge(orderItem.PayInfoId, "PLUS", madeItem.TaxAddedTotalPrice, DeliveryInfoItem);
                }
            }

            DbParam param = new DbParam();

            param.Add("content", new XDocument());
            OrderDao.Update(param, orderItem.Id);
        }