//訂單列表 帶狀態
        public IEnumerable <AdminOrder> GetOrderList(string Search, ForPaging Paging, int status)
        {
            IEnumerable <AdminOrder> Data;

            if (String.IsNullOrEmpty(Search))
            {
                Data = ordersRepository.GetAll_Admin().Where(x => x.Status == status);
            }
            else
            {
                Data = ordersRepository.SearchById_Admin(Search).Where(x => x.Status == status);
            }

            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
            Paging.SetRightPage();

            return(Data.OrderByDescending(x => x.OrderDate).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum));
        }
Пример #2
0
        // 搜尋產品
        public IEnumerable <ProductsItem> GetSearchProductName(string Search, ForPaging Paging)
        {
            IEnumerable <ProductsItem> Data;

            if (String.IsNullOrEmpty(Search))
            {
                Data           = productsRepository.GetAll();
                Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
                Paging.SetRightPage();
            }
            else
            {
                Data           = productsRepository.SearchByProductName(Search);
                Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
                Paging.SetRightPage();
            }
            return(Data.OrderBy(x => x.ProductID).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum));
        }
        public IEnumerable <Customers> CustomerList(string Search, ForPaging Paging)
        {
            IEnumerable <Customers> Data;

            if (String.IsNullOrEmpty(Search))
            {
                Data           = repository.GetAll();
                Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
                Paging.SetRightPage();
            }
            else
            {
                Data           = repository.SearchById(Search);
                Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
                Paging.SetRightPage();
            }
            return(Data.OrderBy(x => x.CustomerID).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum));
        }
        public IEnumerable <CustomerOrder> GetCustomerOrderList(string customerId, string orderId, ForPaging Paging)
        {
            IEnumerable <CustomerOrder> Data;

            if (String.IsNullOrEmpty(orderId))
            {
                Data = ordersRepository.GetAll_Customer(customerId);
            }
            else
            {
                Data = ordersRepository.SearchById_Customer(customerId, orderId);
            }

            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
            Paging.SetRightPage();

            return(Data.OrderByDescending(x => x.OrderDate).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum));
        }