示例#1
0
        /// <summary>
        /// 门店发货处理(问题:无法获取管理员ID。扩展此方法来处理)
        /// </summary>
        public static bool SendGoodsEx(OrderInfo order, string userName)
        {
            //ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                flag = dao.UpdateOrder(order, null);
                string str = "";
                if (!flag)
                {
                    return(flag);
                }
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    if ((info.OrderItemsStatus == OrderStatus.BuyerAlreadyPaid) || (info.OrderItemsStatus == OrderStatus.WaitBuyerPay))
                    {
                        str = str + "'" + info.SkuId + "',";
                    }
                }
                if (!string.IsNullOrEmpty(str))
                {
                    dao.UpdateItemsStatus(order.OrderId, 3, str.Substring(0, str.Length - 1));
                }
                if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                {
                    dao.UpdatePayOrderStock(order.OrderId);
                    foreach (LineItemInfo info2 in order.LineItems.Values)
                    {
                        str = str + info2.SkuId + ",";
                        ProductDao  dao2           = new ProductDao();
                        ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                        productDetails.SaleCounts     += info2.Quantity;
                        productDetails.ShowSaleCounts += info2.Quantity;
                        dao2.UpdateProduct(productDetails, null);
                    }
                    UpdateUserAccount(order);
                }
                EventLogs.WriteOperationLogEx(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId }),
                                              userName);
            }
            return(flag);
        }