Ejemplo n.º 1
0
        public DataTable SearchItemById(Item item)
        {
            string        commandString = @"SELECT * FROM Items WHERE ID = '" + item.ID + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 2
0
        public DataTable Display()
        {
            string        commandString = @"SELECT * FROM Items";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 3
0
        public DataTable SearchOrderById(Order order)
        {
            string        commandString = @"SELECT o.ID, c.Name AS Customer, i.Name AS Item, Quantity, TotalPrice FROM Orders AS o LEFT JOIN Customers AS c ON c.ID = o.CustomerID LEFT JOIN Items AS i ON i.ID = o.ItemID WHERE CustomerId = '" + order.CustomerId + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 4
0
        public DataTable SearchOrderByName(Order order)
        {
            string        commandString = @"SELECT * FROM Orders WHERE Name = '" + order.CustomerId + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 5
0
        public DataTable CustomerCombo()
        {
            string        commandString = @"SELECT ID, Name FROM Customers";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 6
0
        public DataTable SearchCustomerById(Customer customer)
        {
            string        commandString = @"SELECT * FROM Customers WHERE ID = '" + customer.ID + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable dataTable = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            return(dataTable);
        }
Ejemplo n.º 7
0
        public bool IsItemExist(Item item)
        {
            string        commandString = @"SELECT * FROM Items WHERE Name='" + item.Name + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable result = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            if (result.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 8
0
        public bool IsOrderExist(Order order)
        {
            string        commandString = @"SELECT * FROM Orders WHERE ID='" + order.ID + "'";
            SqlConnection sqlConnection = null;

            ConnectionClass connectionClass = new ConnectionClass();

            sqlConnection = connectionClass.CreateConnection();

            sqlConnection.Open();

            DataTable result = connectionClass.ExcecuteDataAdapter(commandString);

            sqlConnection.Close();

            if (result.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }