Example #1
0
        private bool ShowCardInfo(StringBuilder payOnlineMessage, bool doUpdate, bool isok)
        {
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;
            bool flag4 = false;
            bool flag5 = false;
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(this.m_OrderInfo.OrderId);
            int  stockId          = 0;
            bool isFirstStockItem = true;

            foreach (OrderItemInfo info in infoListByOrderId)
            {
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Card))
                {
                    flag5 = ProcessCards(payOnlineMessage, doUpdate, info, ref isFirstStockItem, ref stockId);
                    flag4 = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Service))
                {
                    flag2 = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Download))
                {
                    flag3 = true;
                }
            }
            if (!isFirstStockItem)
            {
                StockInfo stockInfo = new StockInfo();
                stockInfo.Inputer   = PEContext.Current.Admin.AdminName;
                stockInfo.InputTime = DateTime.Now;
                stockInfo.Remark    = "交付点卡";
                stockInfo.StockId   = StockManage.GetMaxId() + 1;
                stockInfo.StockNum  = StockItem.GetShipmentNum();
                stockInfo.StockType = StockType.Shipment;
                StockManage.Add(stockInfo);
            }
            if (doUpdate && !flag)
            {
                if ((flag3 && !flag4) && !flag2)
                {
                    Order.Recieve(this.m_OrderInfo.OrderId);
                    return(isok);
                }
                if (!flag5)
                {
                    this.m_OrderInfo.DeliverStatus = DeliverStatus.Consignment;
                    isok = Order.Update(this.m_OrderInfo);
                }
            }
            return(isok);
        }
Example #2
0
        public static bool SendCard(int orderId)
        {
            bool                  flag              = true;
            bool                  flag2             = false;
            StringBuilder         content           = new StringBuilder();
            StringBuilder         builder2          = new StringBuilder();
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(orderId);
            int       num       = 0;
            StockInfo stockInfo = new StockInfo();

            stockInfo.Inputer   = PEContext.Current.Admin.AdminName;
            stockInfo.InputTime = DateTime.Now;
            stockInfo.Remark    = "交付点卡";
            stockInfo.StockId   = StockManage.GetMaxId() + 1;
            stockInfo.StockNum  = StockItem.GetShipmentNum();
            stockInfo.StockType = StockType.Shipment;
            foreach (OrderItemInfo info2 in infoListByOrderId)
            {
                if (Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Card) && Cards.GetCardByOrderItemId(info2.ProductId, info2.TableName, info2.ItemId).IsNull)
                {
                    IList <CardInfo> list2 = Cards.GetUnsoldCard(info2.TableName, info2.ProductId, info2.Amount);
                    if (list2.Count < info2.Amount)
                    {
                        builder2.Append("<li>" + info2.ProductName + "的充值卡数量已经不够交付!请先去充值卡管理中添加有关充值卡!</li>");
                        flag = false;
                    }
                    else
                    {
                        foreach (CardInfo info4 in list2)
                        {
                            info4.OrderItemId = info2.ItemId;
                            if (!Cards.Update(info4))
                            {
                                return(false);
                            }
                            GetMessageOrMailofCard(content, info4, info2.ProductName);
                        }
                        AddStockItemBySendCard(stockInfo.StockId, info2);
                        num++;
                    }
                }
                if (!flag2 && Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag2 = true;
                }
            }
            if (num > 0)
            {
                StockManage.Add(stockInfo);
            }
            if (flag)
            {
                if (!flag2)
                {
                    OrderInfo orderById = GetOrderById(orderId);
                    if (!orderById.IsNull)
                    {
                        orderById.DeliverStatus = DeliverStatus.Consignment;
                        Update(orderById);
                    }
                }
            }
            else
            {
                CustomException.ThrowBllException(builder2.ToString());
            }
            s_MessgeOrMailContentOfCard = GetMessageOrMailofCard(content.ToString()).ToString();
            return(flag);
        }
Example #3
0
        public static bool Add(DeliverItemInfo deliverItemInfo)
        {
            bool flag = false;
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(deliverItemInfo.OrderId);
            DeliverStatus         preparative       = DeliverStatus.Preparative;
            int num = 0;
            IList <StockItemInfo> infoList = new List <StockItemInfo>();
            bool flag2 = true;

            foreach (OrderItemInfo info in infoListByOrderId)
            {
                bool flag3 = false;
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag3 = true;
                }
                else if ((deliverItemInfo.DeliverDirection != 1) && Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Card))
                {
                    flag3 = true;
                }
                if (flag3)
                {
                    if (flag2)
                    {
                        num   = StockManage.GetMaxId() + 1;
                        flag2 = false;
                    }
                    int amount = info.Amount;
                    if (deliverItemInfo.DeliverDirection == 1)
                    {
                        amount = -amount;
                        Product.AddBuyTimes(info.ProductId, info.TableName);
                    }
                    if (string.IsNullOrEmpty(info.TableName))
                    {
                        Present.AddStocks(info.ProductId, amount);
                    }
                    else
                    {
                        Product.AddStocks(info.ProductId, amount, info.Property);
                    }
                    StockItemInfo item = new StockItemInfo();
                    item.Amount      = Math.Abs(amount);
                    item.ItemId      = StockItem.GetMaxId() + 1;
                    item.Price       = info.TruePrice;
                    item.ProductId   = info.ProductId;
                    item.TableName   = info.TableName;
                    item.Property    = info.Property;
                    item.ProductName = info.ProductName;
                    item.ProductNum  = "";
                    item.StockId     = num;
                    item.Unit        = info.Unit;
                    infoList.Add(item);
                    Product.AddOrderNum(info.ProductId, info.TableName, info.Property, amount);
                }
            }
            if (!flag2)
            {
                StockInfo stockInfo = new StockInfo();
                stockInfo.Inputer   = deliverItemInfo.HandlerName;
                stockInfo.InputTime = deliverItemInfo.DeliverDate;
                stockInfo.Remark    = "退货";
                stockInfo.StockId   = num;
                if (deliverItemInfo.DeliverDirection == 1)
                {
                    stockInfo.StockNum  = StockItem.GetShipmentNum();
                    stockInfo.StockType = StockType.Shipment;
                    stockInfo.Remark    = "订单" + deliverItemInfo.OrderNum + "发货";
                    preparative         = DeliverStatus.Consignment;
                }
                else
                {
                    stockInfo.StockNum  = StockItem.GetInStockNum();
                    stockInfo.StockType = StockType.InStock;
                    stockInfo.Remark    = "订单" + deliverItemInfo.OrderNum + "退货";
                }
                if (StockManage.Add(stockInfo))
                {
                    StockItem.Add(infoList, stockInfo.StockId);
                }
            }
            if (Order.UpdateDeliverStatus(deliverItemInfo.OrderId, preparative))
            {
                flag = dal.Add(deliverItemInfo);
            }
            return(flag);
        }