Click here to Skip to main content
15,904,155 members
Articles / Programming Languages / C#
Article

User Controls for Addresses - Change Management

Rate me:
Please Sign up or sign in to vote.
1.50/5 (7 votes)
18 Oct 20033 min read 38K   669   14  
Input addresses, contacts to SQL Server table and provides change management from there.

Introduction

With this example, we start out with address and contact information and then proceed to actual program management using the following design attributes:

Windows Forms, DataGrid, Windows User Controls, Printing, SQL Database/Table design, by using presentation layer and data access layer.

I realize you need a business object layer but this demonstration isn't for commercial release and the business object layer would pass the data straight through to the presentation layer anyways. So best practice would include a business object layer - yes, nice to have, but this is a *demo* for all intents and purposes.

The project starts with Addresses, and contains the projects AddressUserControl and AddressContactUserControl. These are Windows User control projects so you need to add them to your Visual Studio Toolbox or you'll get compilation errors. The project is for my company, named Information Control Systems LLC, so you'll see that in the path in the zip file. For example: \ics\addresses, \ics\addressusercontrol, \ics\addresscontactusercontrol are the paths relatively speaking.

You start with \ics\addresses and the Transact-SQL file \ics\addresses\create_sql_tables.sql for obvious reasons. Your database will be held in addresses and the SQL has been run with the command line: osql -E -i \ics\addresses\create_sql_tables.sql so you should have access to a SQL Server 2000. There is a drop_sql_tables.sql provided if you so desire to remove the database/tables created by \ics\addresses\create_sql_tables.sql from your SQL Server.

One note: edit \ics\addresses\create_sql_tables.sql to change the path from \sqldata\addresses.mdf and \sqldata\addresses.ldf or you will not succeed in your endeavor here. Or you could create c:\sqldata and you're good to go with the provided SQL. Oh yes, usually you need to create your .ldf file separate from your .mdf file, so make the appropriate modifications to the create database statement for your DBA hat wearing with this project, if you are in an environment where it's all backed up...

After that the Windows forms are using this design philosophy: presentation and edit windows off of the main menu which is an MDI. Presentation layers use combo-boxes and DataGrids extensively and the theory here is read-only DataGrids. Do everything in the edit window to edit the current row, update the database if needed when the window is closed, and refresh your DataGrid. This is a time-tested method I've been using for years (it was initially implemented in Microsoft Access and Visual Basic 6.0) to input my assignments from my users.

After you create your SQL database and compile it, a release version is included in the zip file but you have to have integrated, or mixed mode, authentication with your SQL Server 2000. Modify \ics\addresses\dal.cs to change the provided DSN property or the constructors would be in your list of todo items if you need to add additional security.

You end up with File\Exit, Address Types, Addresses, Issues and Reports on your main menu. I have not finished all of the Reports but this is a *demo*, so please keep that in mind. I have completed the Addresses and Program Issues report but they're just functional printouts (i.e. print all rows and what is in the fields only, not cross reference of tables for descriptions from the lookup tables, etc.) and I haven't added a user selection of what should or could be printed from the tables being referenced.

My goal in this demonstration was: SQL Server tables that hold information important to me as a contractor. Who, what, where, when and how is up to me, the contractor to implement. I used this in the past in my day job and the corporate users I had to work with started using it to ask for work (we provide initial request, change request and problem found) and all I had to do was print out the Open and In Process requests to show the management, what was on my plate that day.

If you have any questions, please direct your questions at me at rdevalco@infoctrlsys.com and I'll be happy to answer your questions.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
MCAD for .Net
MCSD for .Net
MCDBA for Sql Server 2000
B.S. Computer Science and Mathematics

Comments and Discussions

 
-- There are no messages in this forum --