/// <summary>
 /// Gets the product with the specified identifier
 /// </summary>
 public void GetProductById(ProductDS productDS, int productId)
 {
     try
     {
         ProductDALC productDALC = new ProductDALC();
         productDALC.GetProductById(productDS, productId);
     }
     catch (Exception e)
     {
         throw new ApplicationException(ResourceManager.GetString("RES_ExceptionGetProduct"), e);
     }
 }
 /// <summary>
 /// Removes a existing product
 /// </summary>
 public void DeleteProduct(int productId)
 {
     try
     {
         ProductDALC productDALC = new ProductDALC();
         productDALC.DeleteProduct(productId);
     }
     catch (Exception e)
     {
         throw new ApplicationException(ResourceManager.GetString("RES_ExceptionCantDeleteProduct"), e);
     }
 }
 /// <summary>
 /// Gets all products in the catalog
 /// </summary>
 public bool GetAllProducts(ProductDS productDS, int from, int count)
 {
     try
     {
         ProductDALC productDALC = new ProductDALC();
         return(productDALC.GetAllProducts(productDS, from, count));
     }
     catch (Exception e)
     {
         throw new ApplicationException(ResourceManager.GetString("RES_ExceptionGetCatalog"), e);
     }
 }
 /// <summary>
 /// Updates a existing product with the specified data
 /// </summary>
 public void UpdateProduct(int productId, int categoryId, string modelNumber,
                           string modelName, string image, string description, decimal unitCost)
 {
     try
     {
         ProductDALC productDALC = new ProductDALC();
         productDALC.UpdateProduct(productId, categoryId, modelNumber, modelName,
                                   image, description, unitCost);
     }
     catch (Exception e)
     {
         throw new ApplicationException(ResourceManager.GetString("RES_ExceptionCantUpdateProduct"), e);
     }
 }
Example #5
0
        /// <summary>
        /// Creates a new order with the specified params
        /// </summary>
        public int CreateOrderFromCart(int customerId, CartDS.CartItemsDataTable items)
        {
            OrderDALC   orderDALC   = new OrderDALC();
            ProductDALC productDALC = new ProductDALC();

            int orderId = orderDALC.CreateOrder(customerId, DateTime.Now, DateTime.Now.AddDays(2));

            foreach (CartDS.CartItem item in items)
            {
                ProductDS productDS = new ProductDS();
                productDALC.GetProductById(productDS, item.ProductId);

                orderDALC.CreateOrderItem(orderId, item.ProductId, productDS.Products[0].UnitCost, item.Quantity);
            }

            return(orderId);
        }