Exemple #1
0
        public IEnumerable <FindOrderdetaiByOrderIDModel> FindOrderdetaiByOrderID(int orderid)
        {
            var command = Command("dbo.FindOrderdetaiByOrderID");

            command.Parameters.Add(new SqlParameter("@orderid", orderid));
            command.Connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            var           FindOrderdetaiByOrderIDs = new List <FindOrderdetaiByOrderIDModel>();

            while (reader.Read())
            {
                var FindOrderdetaiByOrderID = new FindOrderdetaiByOrderIDModel();
                FindOrderdetaiByOrderID = DbReaderModelBinder <FindOrderdetaiByOrderIDModel> .Bind(reader);

                FindOrderdetaiByOrderIDs.Add(FindOrderdetaiByOrderID);
            }
            command.Connection.Close();
            return(FindOrderdetaiByOrderIDs);
        }
Exemple #2
0
        public IEnumerable <GetBuyerOrderModel> GetBuyerOrder(string memberID)
        {
            var command = Command("dbo.GetBuyerOrder");

            command.Parameters.Add(new SqlParameter("@memberID", memberID));
            command.Connection.Open();
            SqlDataReader reader         = command.ExecuteReader();
            var           GetBuyerOrders = new List <GetBuyerOrderModel>();

            while (reader.Read())
            {
                var GetBuyerOrder = new GetBuyerOrderModel();
                GetBuyerOrder = DbReaderModelBinder <GetBuyerOrderModel> .Bind(reader);

                GetBuyerOrders.Add(GetBuyerOrder);
            }
            command.Connection.Close();
            return(GetBuyerOrders);
        }
Exemple #3
0
        public IEnumerable <FindIndexProducts> FindMoneyBetween(decimal lower, decimal higher)
        {
            var command = Command("dbo.FindMoneyBetween");

            command.Parameters.Add(new SqlParameter("@lower", lower));
            command.Parameters.Add(new SqlParameter("@higher", higher));
            command.Connection.Open();
            SqlDataReader reader           = command.ExecuteReader();
            var           FindMoneyBetween = new List <FindIndexProducts>();

            while (reader.Read())
            {
                var GetBetween = new FindIndexProducts();
                GetBetween = DbReaderModelBinder <FindIndexProducts> .Bind(reader);

                FindMoneyBetween.Add(GetBetween);
            }
            command.Connection.Close();
            return(FindMoneyBetween);
        }
Exemple #4
0
        public IEnumerable <FindFormatIDByProductIDCS> GetFormatIDByProductIDCS(int productid, string size, string color)
        {
            var command = Command("dbo.FindFormatIDByProductIDCS");

            command.Parameters.Add(new SqlParameter("@productid", productid));
            command.Parameters.Add(new SqlParameter("@color", color));
            command.Parameters.Add(new SqlParameter("@size", size));
            command.Connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            var           GetFormatIDByProductIDCS = new List <FindFormatIDByProductIDCS>();

            while (reader.Read())
            {
                var GetProductFormatID = new FindFormatIDByProductIDCS();
                GetProductFormatID = DbReaderModelBinder <FindFormatIDByProductIDCS> .Bind(reader);

                GetFormatIDByProductIDCS.Add(GetProductFormatID);
            }
            command.Connection.Close();
            return(GetFormatIDByProductIDCS);
        }
Exemple #5
0
        public IEnumerable <Orders> GetAll() //ok
        //()內不用給直 因為傳整個表格
        {
            SqlConnection connection = new SqlConnection(source.connectcloud);
            var           sql        = "SELECT * FROM  Orders";
            SqlCommand    command    = new SqlCommand(sql, connection);
            var           list       = new List <Orders>();
            var           orders     = new Orders();

            connection.Open();
            var reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            while (reader.Read())
            {
                orders = DbReaderModelBinder <Orders> .Bind(reader);

                list.Add(orders);
            }
            reader.Close();
            connection.Close();
            return(list);
        }
Exemple #6
0
        public IEnumerable <Orders> GetByOrderID(int OrderID) //ok
        {
            SqlConnection connection = new SqlConnection(source.connectcloud);
            var           sql        = "SELECT * FROM Orders Where OrderID = @OrderID";
            var           list       = new List <Orders>();
            SqlCommand    command    = new SqlCommand(sql, connection);

            command.Parameters.AddWithValue("@OrderID", OrderID);
            connection.Open();
            var orders = new Orders();
            var reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            while (reader.Read())
            {
                orders = DbReaderModelBinder <Orders> .Bind(reader);

                list.Add(orders);
            }
            reader.Close();
            connection.Close();

            return(list); //?
        }
        public IEnumerable <OrderDetail> GetAll() //()內不用給直 因為傳整個表格
        {
            SqlConnection connection = new SqlConnection(source.connectcloud);

            var        sql     = "SELECT * FROM  OrderDetail";
            SqlCommand command = new SqlCommand(sql, connection);

            connection.Open();

            var reader      = command.ExecuteReader();
            var list        = new List <OrderDetail>();
            var orderDetail = new OrderDetail();

            while (reader.Read())
            {
                orderDetail = DbReaderModelBinder <OrderDetail> .Bind(reader);

                list.Add(orderDetail);
            }
            reader.Close();
            connection.Close();

            return(list);
        }
Exemple #8
0
        public IEnumerable <Discounts> OrderByDiscountDESC()
        {
            //找到所有產品,並用折扣排序
            SqlConnection connection = new SqlConnection(source.connectcloud);
            var           sql        = "SELECT p.ProductID, p.Category, p.Name, p.UnitPrice FROM Products p INNER JOIN Discounts d ON d.ProductID = p.ProductID WHERE d.ProductID = p.ProductID ORDER BY d.Discount DESC";
            SqlCommand    command    = new SqlCommand(sql, connection);

            connection.Open();

            var reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            var list   = new List <Discounts>();

            while (reader.Read())
            {
                var discount = new Discounts();
                discount = DbReaderModelBinder <Discounts> .Bind(reader);

                list.Add(discount);
            }

            reader.Close();
            connection.Close();
            return(list);
        }
Exemple #9
0
        /// <summary>
        /// Get All Discount
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Discounts> GetAll()
        {
            SqlConnection connection = new SqlConnection(source.connectcloud);
            var           sql        = "SELECT * FROM Discounts";

            SqlCommand command = new SqlCommand(sql, connection);

            connection.Open();

            var reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            var list   = new List <Discounts>();

            while (reader.Read())
            {
                var discount = new Discounts();
                discount = DbReaderModelBinder <Discounts> .Bind(reader);

                list.Add(discount);
            }

            reader.Close();
            connection.Close();
            return(list);
        }
Exemple #10
0
        public IEnumerable <Products> _GetAll()
        {
            SqlConnection connection = new SqlConnection(source.connectcloud);
            var           sql        = "SELECT * FROM Products";

            SqlCommand command = new SqlCommand(sql, connection);

            connection.Open();

            var      reader   = command.ExecuteReader();
            var      list     = new List <Products>();
            Products products = new Products();

            while (reader.Read())
            {
                products = DbReaderModelBinder <Products> .Bind(reader);

                list.Add(products);
            }

            reader.Close();
            connection.Close();
            return(list);
        }