Example #1
0
        /// <summary>
        /// Description: This method calculates weekly payments to restaurants
        /// </summary>
        /// <returns>Object with data</returns>
        public MeaningfulCalcUtil GetAllCalc()
        {
            // Instantiate objects
            RestaurantDAL      lRestaurantDAL = new RestaurantDAL();
            Calculation        lCalculation   = new Calculation();
            MeaningfulCalcUtil lCalcUtil      = new MeaningfulCalcUtil();

            // populate restaurant list
            //List<RestaurantDBO> RestaurantList = this.GetAllRestaurants("");
            // Get average ratings for all restaurants
            //lCalcUtil.RatingList = new List<double>();
            //foreach (RestaurantDBO each in RestaurantList.Where(item => item.IsActive == 1).ToList())
            //{
            //    lCalcUtil.RatingList.Add(each.AverageRating);
            //}

            // Get all weeks since the oldest registration date of active restaurant
            lCalcUtil.WeekList = this.GetAllWeeks();

            // Get All Active restaurant
            lCalcUtil.RestaurantList = this.GetAllRestaurants("").Where(restaurant => restaurant.IsActive == 1).ToList();

            // Get All food items ordered from the date (WeekList[0][0] is the first date)
            List <UserOrderDBO> lFoodOrderList = lRestaurantDAL.GetAllFoodItemsOrderedByDate(lCalcUtil.WeekList[0][0]);

            // Get Total for each restaurant
            lCalcUtil.WeeklyTotal = this.GetTotalForEachRestaurant(lCalcUtil.RestaurantList, lFoodOrderList, lCalcUtil.WeekList);

            return(lCalcUtil);
        }
Example #2
0
        public ActionResult RestaurantPayment()
        {
            // Instantiate objects
            RestaurantBLL lRestaurantBLL = new RestaurantBLL();

            // Do calculations
            MeaningfulCalcUtil lCalcUtil = lRestaurantBLL.GetAllCalc();

            // return the weeks and show on the left menu bar
            return(View(lCalcUtil));
        }