Ejemplo n.º 1
0
        /// <summary>
        /// Laura Simmonds
        /// Created on 2017/02/20
        ///
        /// Retrieves a product from the database
        /// </summary>
        /// <param name="productID"></param>
        /// <returns>product</returns>
        public DataObjects.Product RetrieveProductById(int productId)
        {
            Product products = null;

            try
            {
                products = ProductAccessor.RetrieveProduct(productId);
            }
            catch (Exception ex)
            {
                throw new ApplicationException("There was a problem retrieving the product details.", ex);
            }
            return(products);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Robert Forbes
        /// 2017/04/13
        /// </summary>
        /// <param name="driverId"></param>
        /// <returns></returns>
        public List <Pickup> RetrievePickupsForDriver(int?driverId)
        {
            List <Pickup> pickups = new List <Pickup>();

            try
            {
                pickups = PickupAccessor.RetrievePickupsForDriver(driverId);
                foreach (Pickup p in pickups)
                {
                    p.PickupLineList = PickupLineAccessor.RetrievePickupLinesForPickup(p.PickupId);
                    foreach (PickupLine line in p.PickupLineList)
                    {
                        line.productName = ProductAccessor.RetrieveProduct((int)line.ProductId).Name;
                    }
                    p.address = SupplierAccessor.RetrieveUserAddressBySupplier(p.SupplierId);
                }
            }
            catch
            {
                throw;
            }

            return(pickups);
        }