Click here to Skip to main content
14,971,742 members
Articles / Desktop Programming / Windows Forms
Posted 1 Mar 2007


56 bookmarked

Multi User Contact Management System using Three Tier Architecture

Rate me:
Please Sign up or sign in to vote.
4.04/5 (17 votes)
1 Mar 2007CPOL3 min read
A Simple Multi User Contact Management System that will help programmers to use some tricks
Screenshot - multicontact.gif


Life is like a connection of strings. We stitch each and every thread to make the small bits and bytes of our life. Now and then, we all like to keep in contact with our friends, families, colleagues, partners and least of all, our enemies.

From the very beginning, many people have discovered numerous ways to remember contacts. Some used brains, some used paper and pencil and some used computers to do this simple task. Many contact management software are available out in the net that you have already figured out what there will be in this project. But do not stop reading. You might find something useful.

I thought it would be nice to share some useful tricks and trade for developers. So, I came up with a very simple contact management program in C#. I started with the design, development and last of all, implementation.

Everyone likes to invent. Some people copy, some people use previous experience, some people like to start with something to get something out of something. I used all of them.

It is a way of many programmers to get things done quickly. But doing something quickly ends up in more and more debugging and more errors come out from all over the program.

I tried to show a simple way of getting things done in an easy and understandable way. For these, I have three kinds of classes:

1. Info Classes

These classes hold the general information and properties about the classes.

2. Data Access Classes

The Objects of these Classes deal with databases which use Info & Business Objects to do a specific work.

3. Business Classes

The objects of these classes define what Info Objects are supposed to do. Maybe Insert Some Data. It does not know how to deal with databases.

So, what's the point of making the above classes. The answer is to make like easier. There is a common sentence that is used is to KISS which means, Keep It Simple Stupid.

The basic thing is to define some info classes. Make a list of works that these can do and make some business classes and let the data classes define how to deal with the databases to set and get data.

Point of Interests

  • Using Business Objects/Data Access/User Interface Layer
  • Using the Reporting with parameter values
  • Implementing to restrict users from using the software for specified days
  • Sending Emails via POP

Interesting and Useful

Invoking a Business class to populate an ArrayList:

public void PopulateContacts(ListView lvw, int contactType)
        BusinessLayerContacts b = new BusinessLayerContacts();
        ArrayList al = new ArrayList();
        Contacts c = new Contacts();
        c.ContactType = contactType;
        c.UserID = this.UserID;
        al = b.GetContacts(c);lvw.Columns.Add("Name", 300);
        lvwChoosen.Columns.Add("Name", 300);
        for (int i = 0; i < al.Count; i++)
               Contacts ct = new Contacts();
               ct.ID = ((Contacts)al[i]).ID;
               ct.Name = ((Contacts)al[i]).Name;
               ct.Telephone = ((Contacts)al[i]).Telephone;
               ct.UserID = this.UserID;
               ListViewItem lvi = new ListViewItem();
               lvi.Tag = ct.ID.ToString();
               lvi.Text = ct.Name;

Sending Parameters to the Report

Many times, new programmers find difficulties to send parameters to the report or bind the report at runtime. Here is a way to do it.


// instantiate the report
Envelope ex = new Envelope();

// Connect to Datasource at runtime
CrystalDecisions.CrystalReports.Engine.ReportDocument r = 
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
TableLogOnInfo t = new TableLogOnInfo();
t.ConnectionInfo.ServerName = Application.StartupPath + "\\ZSContacts.mdb";
r.FileName = Application.StartupPath + "\\" + "Envelope.rpt";
// set datasource
// set report source
crvReport.ReportSource = r;

// report has one discrete value
ParameterDiscreteValue d = new ParameterDiscreteValue();
d.Value = this.userid;

// report has discrete with multiple values
ParameterValues currentParameterValues = new ParameterValues();
for (int i = 0; i < al.Count; i++)
    ParameterDiscreteValue dd = new ParameterDiscreteValue();
        dd.Value = ct.ID = ((Contacts)al[i]).ID; ;
crvReport.ParameterFieldInfo["contactId"].CurrentValues = currentParameterValues;


Implementing a Simple License Trick

Simple registry entry can help you do the licensing if you want to make your product run as a shareware.

ArrayList al = new ArrayList();
al.Add("AV32 FGHG RE23 FGHT ASW34");
al.Add("AV32 FDFG RE23 FEHT ASW34");
al.Add("AV32 FFHH RE43 FFHT ASW34");
al.Add("AV32 FFHG RER3 FGHT ASW34");
bool registerd = false;
for (int i = 0; i < al.Count; i++)
    if (txtLicense.Text == al[i].ToString())
        RegistryKey rk = 
         Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("ZakaSoft", true);
        if (rk == null)
            RegistryKey main = Registry.LocalMachine.OpenSubKey("Software", true);
            RegistryKey x = main.CreateSubKey("ZakaSoft");
            x.SetValue("STATUS", txtName.Text);
            rk.SetValue("STATUS", txtName.Text.ToString());
            MessageBox.Show("Thanks for Registering!");
            frm.btnRegister.Visible = false;
            frm.lblUsed.Text = "This Software is Registerd to " + txtName.Text;
            registerd = true;
if (registerd == false)
    MessageBox.Show("License key not valid!");


Sending Emails from Application

Here is a small snippet on how to send emails from your application:

using System.Net.Mail;
private void SendMail()
    MailAddress from = new MailAddress("");
    MailAddress to = new MailAddress("");
    MailMessage message = new MailMessage(from, to);
    message.Subject = "Using the SmtpClient class.";
    message.Body = @"Using this feature, 
    you can send an e-mail message from an application very easily.";
    SmtpClient client = new SmtpClient("");
    System.Net.NetworkCredential basicAuthenticationInfo = 
    new System.Net.NetworkCredential("", "1234567");
    client.UseDefaultCredentials = false;
    client.Credentials = basicAuthenticationInfo;


I hope you liked this very simple project. I emphasized on using some basic methods and tricks that will help you write and design useful software.


  • 1st March, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Zakaria Bin Abdur Rouf
Bangladesh Bangladesh
Zakaria has a keen interest in developing new solutions and exploring new technologies. He has a wide experience in web technologies and business solutions.

Visit my works @

His latest project includes Library Management System for University of Dhaka using ASP.NET and Sql Server.

Zakaria completed Masters in Information Technology from Institute of Information Technology,
University of Dhaka, had his BSc in Computer Science from AIUB (
School and college from SKBZBIS (

Latest Project :
for Alam Group of Companies, Abu Dhabi

Some of his Completed projects: (The official website of Embassy of the People's Republic of Bangladesh, Abu Dhabi, United Arab Emirates)

Bangla Translation of the Holy Quran (C#/Access)
Library Management System (ASP.NET/C#/SQLServer)
Seat Reservation System (ASP.NET/C#/SQLServer)

Besides programming, he has published his first poetry book (na bola kothamala/Unspoken Words) and in the process of writing several new novels.

Founded ZakaSoft, a division of ZCom, Providing state-of-the-art solutions in United Arab Emirates.

Zakaria Lives in Abu Dhabi and enjoys his spare time in writing and music.

Comments and Discussions

Questionrun Pin
Sanjay Kumawat21-Dec-12 0:47
MemberSanjay Kumawat21-Dec-12 0:47 
Questiondatabase is missing Pin
anuragblp18-Mar-12 2:46
Memberanuragblp18-Mar-12 2:46 
GeneralRe: database is missing Pin
D K PATEL24-Aug-12 6:46
MemberD K PATEL24-Aug-12 6:46 
Questionthree tier architecture Pin
vivekanandhan8718-Mar-09 19:52
Membervivekanandhan8718-Mar-09 19:52 
GeneralLicence key... Pin
neelima devi10-Jan-09 10:37
Memberneelima devi10-Jan-09 10:37 
GeneralRe: Licence key... Pin
Zakaria Bin Abdur Rouf10-Jan-09 19:26
MemberZakaria Bin Abdur Rouf10-Jan-09 19:26 
Generalurgent Pin
aman_mohali1-Oct-08 23:15
Memberaman_mohali1-Oct-08 23:15 
GeneralRe Start Page Pin
saini485-May-07 2:01
Membersaini485-May-07 2:01 
GeneralVB.Net Version Required Pin
Rizwan Tahir17-Apr-07 4:10
MemberRizwan Tahir17-Apr-07 4:10 
QuestionReg: Update option in grid Pin
a_anand_kumar3-Apr-07 22:17
Membera_anand_kumar3-Apr-07 22:17 
AnswerRe: Reg: Update option in grid Pin
Zakaria Bin Abdur Rouf4-Apr-07 4:30
MemberZakaria Bin Abdur Rouf4-Apr-07 4:30 
QuestionRe: Reg: Update option in grid Pin
a_anand_kumar4-Apr-07 5:16
Membera_anand_kumar4-Apr-07 5:16 
GeneralAmazing and Full example! Pin
OneSoftware8-Mar-07 16:13
MemberOneSoftware8-Mar-07 16:13 
Generalgood work body Pin
Pali.Sniper7-Mar-07 21:48
MemberPali.Sniper7-Mar-07 21:48 
GeneralRe: good work body Pin
Zakaria Bin Abdur Rouf7-Mar-07 22:21
MemberZakaria Bin Abdur Rouf7-Mar-07 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.