Exemplo n.º 1
0
        public void Remove(string barcodeString, SaleStatus status, bool recordHadEditPrice, string recordId)
        {
            var product = OrderList.FirstOrDefault(o => o.RecordId == recordId);

            if (product == null)
            {
                throw new PosException("未找到商品【{0}】的记录", barcodeString);
            }
            //移除商品
            OrderList.Remove(product);

            //重置商品状态为促销运算做准备
            ResetProduct(status);
        }
Exemplo n.º 2
0
        public void DeleteTest()
        {
            OrderList orders = new OrderList();

            orders.Load();

            //Find the order with the description testingorder
            Order order = orders.FirstOrDefault(f => f.PaymentReceipt == "updtTest");

            //Delete it
            int result = order.Delete();

            Assert.IsTrue(result == 1);
        }
Exemplo n.º 3
0
        public void Edit(string barcodeString, decimal number, decimal salePrice, SaleStatus status, bool recordHadEditPrice, string recordId)
        {
            var product = OrderList.FirstOrDefault(o => o.RecordId == recordId);

            if (product == null)
            {
                throw new PosException("未找到商品【{0}】的记录", barcodeString);
            }


            //处理改量
            var editNum = Math.Abs(product.SaleNumber - number) > 0.0001m;

            if (!product.Details.EnableEditNum && editNum)
            {
                throw new SaleException("603", "该商品不允许修改数量!");
            }
            else if (product.Details.EnableEditNum && editNum)
            {
                product.SaleNumber = number;
            }


            //处理改价
            var editPrice = Math.Abs(product.MarketingPrice - salePrice) >= 0.01m;

            if (editPrice && !product.Details.EnableEditPrice)
            {
                throw new SaleException("603", "该商品不允许修改售价!");
            }
            else if (editPrice && product.Details.BuyPrice > salePrice)
            {
                throw new SaleException("603", "改价失败,售价必须大于进价!");
            }
            else if (editPrice && product.Details.EnableEditPrice)
            {
                product.SalePrice       = salePrice;
                product.EnableMarketing = false;
                product.HasEditPrice    = true;
            }
            //重置商品状态为促销运算做准备
            ResetProduct(status);
        }
Exemplo n.º 4
0
 public Task <Order> Get(int orderId)
 {
     return(Task <Order> .FromResult(OrderList.FirstOrDefault(o => (o.Id == orderId) && (!o.Cancelled))));
 }
Exemplo n.º 5
0
        //============================== UNSYNCED ORDERS ===============================

        /// <summary>
        /// Return an order given orderID
        /// </summary>
        /// <param name="orderID"></param>
        /// <returns></returns>
        public static Order GetOrderById(string orderID)
        {
            return(OrderList.FirstOrDefault(x => x.OrderID == orderID));
        }