コード例 #1
0
        // return List<t> of CartItems
        /// <summary>
        /// GetCartItems()
        /// </summary>
        /// <returns></returns>
        public OrderDetails GetOrderItems(int movieID, int timeScreeningID, int orderID, int hallChairID)
        {
            var orderInfoDetails = new CimenaCityProject.ViewModels.OrderDetails();

            orderInfoDetails.Movie = from m in db.Movies
                                     where m.MovieID == movieID
                                     select m ;

            orderInfoDetails.TimeScreening = from t in db.TimeScreening
                                         where t.TimeScreeningID == timeScreeningID
                                         select t;

            foreach (var item in db.HallChairs)
            {
                if (item.HallChairsID == hallChairID)
                {
                    orderDetails.ChairsOrderd++;
                }
            }

            orderInfoDetails.Order = db.Orders.Where(o => Convert.ToInt16(o.OrderID) == orderID);

            return orderInfoDetails;
        }
コード例 #2
0
        // get total cart price
        /// <summary>
        /// GetTotal()
        /// </summary>
        /// <returns></returns>
        public decimal GetTotal(int timeScreeningID,int hallChairID)
        {
            ShoppingCartId = GetCartId();
            decimal? total = decimal.Zero;

            var orderInfoDetails = new CimenaCityProject.ViewModels.OrderDetails();

            orderInfoDetails.TimeScreening = from t in db.TimeScreening
                                             where t.TimeScreeningID == timeScreeningID
                                             select t;

            foreach (var item in db.HallChairs)
            {
                if (item.HallChairsID == hallChairID)
                {
                    orderDetails.ChairsOrderd++;
                }
            }

            total = (decimal?)
                    ( orderDetails.ChairsOrderd * orderDetails.TimeScreening.Where(t => t.TimeScreeningID == timeScreeningID).SingleOrDefault().Price);

            return total ?? decimal.Zero;
        }