Пример #1
0
        private string GetProductStockInformation(string productID, bool showAll)
        {
            StockListItem stockListItem = storeLogic.GetStockListItembyProductID(productID);

            if (stockListItem == null)
            {
                MarketLog.Log("storeCenter", "product not exists");
                throw new StoreException(StoreEnum.ProductNotFound, "product " + productID + " does not exist in Stock");
            }
            if (stockListItem.PurchaseWay == PurchaseEnum.Lottery && !showAll)
            {
                LotterySaleManagmentTicket managmentTicket =
                    storeLogic.GetLotteryByProductID((productID));
                StockListItem sli = storeLogic.GetStockListItembyProductID(productID);
                if ((managmentTicket.EndDate < MarketYard.MarketDate) ||
                    (managmentTicket.StartDate > MarketYard.MarketDate) ||
                    ((managmentTicket.TotalMoneyPayed == managmentTicket.ProductNormalPrice) && sli.Quantity == 0))
                {
                    return("");
                }
            }
            Discount totalDiscount  = stockListItem.CalcTotalDiscount(_storeName);
            string   discountString = " Discount: {";
            string   product        = stockListItem.Product.ToString();

            if (totalDiscount != null)
            {
                discountString += totalDiscount;
            }
            else
            {
                discountString += "null";
            }
            discountString += "}";
            string purchaseWay = " Purchase Way: " + EnumStringConverter.PrintEnum(stockListItem.PurchaseWay);
            string quanitity   = " Quantity: " + stockListItem.Quantity;
            string result      = product + discountString + purchaseWay + quanitity;

            return(result);
        }