示例#1
0
        public List <Inventory_Management> getInventory_Managements()
        {
            var inventory_management = new List <Inventory_Management>();

            getConnection();
            string        sql = "select * from InventoryManagement";
            SqlCommand    cmd = new SqlCommand(sql, cnn);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                Inventory_Management Inventory_Management = new Inventory_Management();
                Inventory_Management.orderid         = (int)dr["orderid"];
                Inventory_Management.orderitemsid    = (int)dr["id"];
                Inventory_Management.partname        = (string)dr["part name"];
                Inventory_Management.transactiontype = (string)dr["transaction type"];
                Inventory_Management.date            = (DateTime)dr["date"];
                Inventory_Management.amount          = (decimal)dr["amount"];
                Inventory_Management.source          = (string)dr["source"];
                Inventory_Management.destination     = (string)dr["destination"];
                inventory_management.Add(Inventory_Management);
            }
            cnn.Close();
            return(inventory_management);
        }
示例#2
0
        public void delete(Inventory_Management Inventory_Management)
        {
            getConnection();
            string     sql = "delete from OrderItems where orderID = @OrderID";
            SqlCommand cmd = new SqlCommand(sql, cnn);

            cmd.Parameters.AddWithValue("@OrderID", Inventory_Management.orderid);
            cmd.ExecuteNonQuery();
            cnn.Close();
        }