MS SQL – C# – Entity Framework Project (import Data from XML, export to PDF)

In this project you’ll see how to use Entity Framework with MS SQL, parse data from XML file and export PDF with data from a database.

The project is about “Music store” where you have XML file with data about music albums. You should parse the date and fill it into database. Then you can make queries and get the results in PDF all done by C#.


The source files


If you try to start the project you’ll need Visual Studio and MS SQL Server.
Don’t forget to change the connection string in all App.config files (If you are using SQL Server Express, change the ‘.’ in “source=.”, with ‘.\SQLEXPRESS’).

I’ve created a simple database (use the music_store_db.sql script to generate the tables) and using Entity Framework (db first), C#, XPath and ItextSharp I’m parsing data from .xml file and I’m filling the data into db tables, then I’m exporting some data into .pdf.

The XMLParser.cs parse the date from XML and calls the Method “AddAlbumToDB” (MusicStoreDAL.cs) which fills the database tables with the parsed data.
The PDFExporter.cs makes a query to the database, makes PDF file and fills the data into it.
The Executor.cs calls XMLParser and PDFExporter (for ease).

The Pdf


SQL Diagram

diagram

XMLParser.cs

MusicStoreDAL.cs

PDFExporter.cs

Sublime Text 2 Installation On Windows 7 Plus Package Control And Node.js

In this video you can see how to install Sublime text 2 on Windows 7. In addition I’ll show you how to add extensions (packages) directly from the interface with the help of “Package control”, how to add option to the windows context menu “Open folder as Sublime project”, and how to install and integrate node.js which can build javaScript code and show log massages in the Sublime’s console.

Download Sublime text 2

Download and install package control for sublime

Sublime text 2 context menu windows

Download Node.js

Snippet for node.js (build system) –

(save it as javascript.sublime-build)

Tagged ,