Exemplo n.º 1
0
        //internal static void SupplierProc(IDataReader dr, FieldDictionary Fields, object Param)
        //{
        //    SupplierCollection coll = Param as SupplierCollection;
        //    Supplier item = Mapper.ReadSupplier(dr, Fields);
        //    coll.Add(item);
        //}



        public CustomerCollection GetAllCustomers()
        {
            string     str = @"select CustomerID, CompanyName, ContactName, ContactTitle, Address, City,
				Region, PostalCode, Country, Phone, Fax from Customers"                ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            CustomerCollection cc = new CustomerCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(CustomerProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 2
0
        public OrderDetailCollection GetAllOrderDetails()
        {
            string     str = @"select OrderID, ProductID, UnitPrice, Quantity, Discount
							from [Order Details]"                            ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            OrderDetailCollection cc = new OrderDetailCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(OrderDetailProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 3
0
        public OrderCollection GetAllOrders()
        {
            string     str = @"select OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate,
							ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry
							from Orders"                            ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            OrderCollection cc = new OrderCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(OrderProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 4
0
        public ProductCollection GetAllProducts()
        {
            string     str = @"select ProductID, ProductName, SupplierID, CategoryID, 
						QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, 
						ReorderLevel, Discontinued
						from Products"                        ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            ProductCollection cc = new ProductCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(ProductProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 5
0
        public CustomerCollection GetCustomerByCustomerId(string CustomerId)
        {
            string     str = @"select CustomerID, CompanyName, ContactName, ContactTitle, Address, City,
				Region, PostalCode, Country, Phone, Fax from Customers where CustomerID = @CustomerId"                ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            cmd.Parameters.Add("@CustomerId", SqlDbType.NChar, 0, "CustomerId");
            cmd.Parameters[0].Value = CustomerId;

            CustomerCollection cc = new CustomerCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(CustomerProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 6
0
        public OrderDetailCollection GetOrderDetailsByOrderId(int OrderId)
        {
            string     str = @"select OrderID, ProductID, UnitPrice, Quantity, Discount
							from [Order Details] where OrderId = @OrderId"                            ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            cmd.Parameters.Add("@OrderId", SqlDbType.Int, 0, "OrderId");
            cmd.Parameters[0].Value = OrderId;

            OrderDetailCollection cc = new OrderDetailCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(OrderDetailProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemplo n.º 7
0
        public ProductCollection GetProductByProductId(int ProductId)
        {
            string     str = @"select ProductID, ProductName, SupplierID, CategoryID, 
						QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, 
						ReorderLevel, Discontinued
						from Products where ProductId=@ProductId"                        ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            cmd.Parameters.Add("@ProductId", SqlDbType.Int, 0, "ProductId");
            cmd.Parameters[0].Value = ProductId;

            ProductCollection cc = new ProductCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(ProductProc), cc);
            cc.AcceptChanges();
            return(cc);
        }