示例#1
0
    public static void UpdateProduct(int id, int productId, string value, string item)
    {
        ProductImp Imp     = new ProductImp();
        Product    product = Imp.GetProductById(productId);

        //根据修改后的规格型号,检查系统中是否已经存在此商品
        if (item == "name")
        {
            product.Name = value;
        }
        else
        {
            product.Size = value;
        }

        int newId = Imp.GetProductId(product.Name, product.Size, product.Material);

        if (newId == 0)
        {
            //不存在此规格型号的商品时,创建新商品
            newId = Imp.InsertProduct(product);
        }
        PurchaseDetailImp detailImp = new PurchaseDetailImp();

        detailImp.UpdateProductId(id, newId);
    }
示例#2
0
 public Product GetProductById(int id)
 {
     return(imp.GetProductById(id));
 }