public bool UpdateProduct(
        // new parameter values
        string productName, decimal?unitPrice, int productID,

        // original parameter values
        string original_productName, decimal?original_unitPrice, int original_productID)
    {
        NorthwindOptimisticConcurrency.ProductsOptimisticConcurrencyDataTable products = Adapter.GetProductByProductID(original_productID);
        if (products.Count == 0)
        {
            // no matching record found, return false
            return(false);
        }

        NorthwindOptimisticConcurrency.ProductsOptimisticConcurrencyRow product = products[0];

        // Assign the original values to the product instance
        product.ProductName = original_productName;
        if (original_unitPrice == null)
        {
            product.SetUnitPriceNull();
        }
        else
        {
            product.UnitPrice = original_unitPrice.Value;
        }

        // Accept the changes
        product.AcceptChanges();

        // Assign the new values to the product instance
        product.ProductName = productName;
        if (unitPrice == null)
        {
            product.SetUnitPriceNull();
        }
        else
        {
            product.UnitPrice = unitPrice.Value;
        }

        // Update the product record
        int rowsAffected = Adapter.Update(product);

        // Return true if precisely one row was updated, otherwise false
        return(rowsAffected == 1);
    }
    public bool UpdateProduct(
        // new parameter values
        string productName, int?supplierID, int?categoryID, string quantityPerUnit,
        decimal?unitPrice, short?unitsInStock, short?unitsOnOrder, short?reorderLevel,
        bool discontinued, int productID,

        // original parameter values
        string original_productName, int?original_supplierID, int?original_categoryID,
        string original_quantityPerUnit, decimal?original_unitPrice, short?original_unitsInStock,
        short?original_unitsOnOrder, short?original_reorderLevel, bool original_discontinued,
        int original_productID)
    {
        // STEP 1: Read in the current database product information
        NorthwindOptimisticConcurrency.ProductsOptimisticConcurrencyDataTable products = Adapter.GetProductByProductID(original_productID);
        if (products.Count == 0)
        {
            // no matching record found, return false
            return(false);
        }

        NorthwindOptimisticConcurrency.ProductsOptimisticConcurrencyRow product = products[0];

        // STEP 2: Assign the original values to the product instance
        AssignAllProductValues(product, original_productName, original_supplierID,
                               original_categoryID, original_quantityPerUnit, original_unitPrice,
                               original_unitsInStock, original_unitsOnOrder, original_reorderLevel,
                               original_discontinued);

        // STEP 3: Accept the changes
        product.AcceptChanges();

        // STEP 4: Assign the new values to the product instance
        AssignAllProductValues(product, productName, supplierID, categoryID, quantityPerUnit, unitPrice,
                               unitsInStock, unitsOnOrder, reorderLevel, discontinued);

        // STEP 5: Update the product record
        int rowsAffected = Adapter.Update(product);

        // Return true if precisely one row was updated, otherwise false
        return(rowsAffected == 1);
    }