Documente Academic
Documente Profesional
Documente Cultură
INTRODUCTION
1.2 Objectives :
It could reduce expenses involved in setting up & staffing polling sites etc.
The system is designed in a way so that a voter can vote only once so preventing
multiple voting by a single voter.
It also prevent people with wrong identification or without CNIC to cast vote to
maintain transparency.
There is no any problem of transporting ballots as they are readily stored on the
official site computers.
It also helps in increasing voter count as woman who can not go out due to their
house hold activities & people who are physically disable can cast their votes right
from their homes if they have internet facility.
2|Page
CHAPTER TWO
TOOLS
&
TECHNOLOGIES
CHAPTER 2
3|Page
TOOLS AND TECHNOLOGIES
4|Page
you can use them to offer a service that could be used in a distributed system of
interconnected services. For example, Microsoft's Passport web service offers identification
and authentication of web users you could then use in your own web application
All of your work in VS .NET is organized into projects. Projects contain the source and executable files
for your program, among other items.
C# dot net:
5|Page
Although C# borrows from Java, C++, C, and even Visual Basic and Pascal, it is a
truly new language—and, in the opinion of this author, quite wondrous. Since C# is new, and
since language and syntax are the blocks on which programs are built, it's especially
important to pay attention to the rules of the language
With all of the emphasis on distributed applications that only appear on the Internet, it's easy to
forget that not every application ever created appears on someone's website. While distributed
application development is extremely important, the desktop application hasn't gone away and
it's unlikely to go away in the near future. The simple fact is that desktop applications serve the
needs of many computer users who don't need access to the Internet, much less access to a
business partner's network.
You can create a vast assortment of application types with C#, including desktop applications.
This chapter is going to build on your knowledge of desktop applications and show you how to
create several application types including dialog-based, Single Document Interface (SDI), and
Multiple Document Interface (MDI).
Identifiers
Identifiers are names used to denote variables, constants, types, methods, objects, and so on. An
identifier begins with a letter or an underscore and ends with the character just before the
next white space.
C# identifiers are case sensitive. For example, the three variables deeFlat, DeeFlat, and
DEEFLAT are all different, as running this click procedure will show:
ADO.NET
6|Page
ADO.NET allows you to interact with a database directly using objects of the managed provider
classes. These objects allow you to connect to the database and execute SQL statements while
directly connected to the database. Objects like the DataReader allow you to connect to a
database directly and read the rows from a table in a forward-only direction.ADO.NET also
allow you to work in a disconnected manner. When doing this, you store information from a
database locally in the memory of the computer on which your program is running. You store
that information using objects of the data set classes. Once you have that information in the
memory, you can then read and manipulate that information. For example, you can display the
columns for the rows, add new rows, modify rows, and delete rows. Periodically, you'll
reconnect to the database to synchronize your changes you've made locally with the database.
This disconnected model allows you to write applications that run on the Internet, as well as for
devices that aren't always connected to the database—PDAs such as the Palm and the Pocket PC.
It also gives you a complete C# program that connects to a database, stores the rows locally,
disconnects from the database, and then reads the contents of those local rows while
disconnected from the database. This capability to store a local copy of rows retrieved from the
database is one of the main strengths of ADO.NET. The example program illustrates the basic
ideas of using the ADO.NET disconnected model to read rows from the database and store them
locally in memory. In later chapters, you'll see how to modify data locally and then synchronize
those changes with the database.
7|Page
The Connection Classes
8|Page
to call a stored procedure or retrieve rows from a specific table. You run the command stored in
a Command object using a Connection object.
The Parameter Collection Classes: There are three Parameter Collection classes:
SqlParameter Collection, OleDbParameter Collection, and OdbcParameter Collection. You use a
Parameter Collection object to store multiple Parameter objects for a Command object.
Microsoft® SQL Server™ 2000 extends the performance, reliability, quality, and ease-of-use of
Microsoft SQL Server version 7.0. Microsoft SQL Server 2000 includes several new features
that make it an excellent database platform for large-scale online transactional processing
9|Page
(OLTP), data warehousing, and e-commerce applications Microsoft® SQL Server™ 2000 is a
set of components that work together to meet the data storage and analysis needs of the largest
Web sites and enterprise data processing systems. Relational Database Components The database
component of Microsoft® SQL Server™ 2000 is a Structured Query Language (SQL)–based,
scalable, relational database with integrated Extensible Markup Language (XML) support for
Internet applications. Each of the following terms describes a fundamental part of the
architecture of the SQL Server 2000 database component: The OLAP Services feature available
in SQL Server version 7.0 is now called SQL Server 2000 Analysis Services. The term OLAP
Services has been replaced with the term Analysis Services. Analysis Services also includes a
new data mining component
Database
A database is similar to a data file in that it is a storage place for data. Like a data file, a database
does not present information directly to a user; the user runs an application that accesses data
from the database and presents it to the user in an understandable format. Database systems are
more powerful than data files in that data is more highly organized. In a well-designed database,
there are no duplicate pieces of data that the user or application must update at the same time.
Related pieces of data are grouped together in a single structure or record, and relationships can
be defined between these structures and records. When working with data files, an application
must be coded to work with the specific structure of each data file. In contrast, a database
contains a catalog that applications use to determine how data is organized. Generic database
applications can use the catalog to present users with data from different databases dynamically,
without being tied to a specific data format. A database typically has two main parts: first, the
files holding the physical database and second, the database management system (DBMS)
software that applications use to access data. The DBMS is responsible for enforcing the
database structure, including: Maintaining relationships between data in the database.
• Ensuring that data is stored correctly, and that the rules defining data relationships are not
violated.
10 | P a g e
Relational Database
Although there are different ways to organize data in a database, relational databases are one of
the most effective. Relational database systems are an application of mathematical set theory to
the problem of effectively organizing data. In a relational database, data is collected into tables
(called relations in relational theory). A table represents some class of objects that are important
to an organization. For example, a company may have a database with a table for employees,
another table for customers, and another for stores. Each table is built of columns and rows
(called attributes and tuples in relational theory). Each column represents some attribute of the
object represented by the table. For example, an Employee table would typically have columns
for attributes such as first name, last name, employee ID, department, pay grade, and job title.
Each row represents an instance of the object represented by the table. For example, one row in
the Employee table represents the employee who has employee ID 12345.
When organizing data into tables, you can usually find many different ways to define tables.
Relational database theory defines a process called normalization, which ensures that the set of
tables you define will organize your data effectively.
Scalable
SQL Server 2000 supports having a wide range of users access it at the same time. An instance
of SQL Server 2000 includes the files that make up a set of databases and a copy of the DBMS
software. Applications running on separate computers use a SQL Server 2000 communications
component to transmit commands over a network to the SQL Server 2000 instance. When an
application connects to an instance of SQL Server 2000, it can reference any of the databases in
that instance that the user is authorized to access. The communication component also allows
communication between an instance of SQL Server 2000 and an application running on the same
computer. You can run multiple instances of SQL Server 2000 on a single computer. SQL Server
11 | P a g e
2000 is designed to support the traffic of the largest Web sites or enterprise data processing
systems. Instances of SQL Server 2000 running on large, multiprocessor servers are capable of
supporting connections to thousands of users at the same time. The data in SQL Server tables can
be partitioned across multiple servers, so that several multiprocessor computers can cooperate to
support the database processing requirements of extremely large systems. These groups of
database servers are called federations. Although SQL Server 2000 is designed to work as the
data storage engine for thousands of concurrent users who connect over a network, it is also
capable of working as a stand-alone database directly on the same computer as an application.
The scalability and ease-of-use features of SQL Server 2000 allow it to work efficiently on a
single computer without consuming too many resources or requiring administrative work by the
stand-alone user. The same features allow SQL Server 2000 to dynamically acquire the resources
required to support thousands of users, while minimizing database administration and tuning.
The SQL Server 2000 relational database engine dynamically tunes itself to acquire or free the
appropriate computer resources required to support a varying load of users accessing an instance
of SQL Server 2000 at any specific time. The SQL Server 2000 relational database engine has
features to prevent the logical problems that occur if a user tries to read or modify data currently
used by others.
To work with data in a database, you have to use a set of commands and statements (language)
defined by the DBMS software. Several different languages can be used with relational
databases; the most common is SQL. The American National Standards Institute (ANSI) and the
International Standards Organization (ISO) define software standards, including standards for the
SQL language. SQL Server 2000 supports the Entry Level of SQL-92, the SQL standard
published by ANSI and ISO in 1992. The dialect of SQL supported by Microsoft SQL Server is
called Transact-SQL (T-SQL). T-SQL is the primary language used by Microsoft SQL Server
applications.
12 | P a g e
Extensible Markup Language
XML is the emerging Internet standard for data. XML is a set of tags that can be used to define
the structure of a hypertext document. XML documents can be easily processed by the Hypertext
Markup Language, which is the most important language for displaying Web pages. Although
most SQL statements return their results in a relational, or tabular, result set, the SQL Server
2000 database component supports a FOR XML clause that returns results as an XML document.
SQL Server 2000 also supports Path queries from Internet and intranet applications. XML
documents can be added to SQL Server databases, and the OPENXML clause can be used to
expose data from an XML document as a relational result set.
ODBC Transact-SQL
OLE DB Windows
13 | P a g e
Adobe Photoshop 8.0
With its comprehensive set of retouching, painting, drawing, and Web tools, Photoshop helps
you complete any image-editing task efficiently. And with features like the History palette and
editable layer effects, you can experiment freely without sacrificing efficiency. Photoshop 7.0
rounds out its comprehensive toolset with new capabilities that help you meet every creative
challenge, master every production demand, and handle any image-editing task efficiently. Make
Web page elements transparent in Photoshop and Image Ready by simply clicking on the color
you want to knock out. And with the new dithered transparency option, you can apply partial
transparency to blend Web graphics seamlessly into any background--even patterns--without
having to select a matte color first. If you need to edit the transparent effects later, you can remap
more than one color at a time and easily restore colors to their original settings.
14 | P a g e
CHAPTER THREE
SOURCE CODE
CHAPTER 3
15 | P a g e
SOURCE CODE
3.1 Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
History histry;
private void history_label_Click_1(object sender, EventArgs e)
{
this.Hide();
histry = new History();
histry.Show();
}
Register_Vote reg_vote;
private void Register_Vote_label_Click(object sender,EventArgs e)
{
this.Hide();
reg_vote = new Register_Vote();
16 | P a g e
reg_vote.Show();
}
Help hlp;
private void Help_label_Click(object sender, EventArgs e)
{
this.Hide();
hlp = new Help();
hlp.Show();
}
3.2 About us
17 | P a g e
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class Developer : Form
{
public Developer()
{
InitializeComponent();
}
}
Form1 home_page;
private void home_button_Click(object sender, EventArgs e)
{
this.Hide();
home_page = new Form1();
home_page.Show();
}
}
}
3.3 History
18 | P a g e
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class History : Form
{
public History()
{
InitializeComponent();
}
}
Form1 Home_page;
private void button1_Click_1(object sender, EventArgs e)
{
this.Hide();
Home_page = new Form1();
Home_page.Show();
}
}
}
}
19 | P a g e
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class Register_Vote : Form
{
SqlConnection conn;
SqlDataAdapter adpt;
DataTable dt;
SqlDataAdapter adp;
DataTable dtt;
public Register_Vote()
{
InitializeComponent();
conn = new
SqlConnection("server=.;database=Voting_System;integrated security=true");
}
20 | P a g e
adpt.Fill(dt);
adp = new SqlDataAdapter("select voter_id from voter_record order by voter_id
desc", conn);
dtt = new DataTable();
adp.Fill(dtt);
textBox_ID.DataBindings.Add("text", dtt, "voter_id");
}
catch (Exception ee)
{
MessageBox.Show("Exception is occured" + ee);
}
}
}
else
{
MessageBox.Show(name_textBox.Text + " can't cost vote...");
}
}
else
{
MessageBox.Show("Record not available in nadra...!");
}
}
private bool verifyToNadra(string nic)
{
adpt = new SqlDataAdapter("select*from nadra where CNIC='" + nic + "'", conn);
dt = new DataTable();
adpt.Fill(dt);
if (nic == cnic)
{
MessageBox.Show("Record Availabel in nadra..");
return true;
}
else
{
MessageBox.Show("No Record Available in nadra..");
return false;
}
}
private bool verifyToVoterList(string vericnic)
{
adpt = new SqlDataAdapter("select*from voter_verification where
CNIC='" + vericnic + "'", conn);
dt = new DataTable();
adpt.Fill(dt);
Votername_veri_textBox.DataBindings.Add("text", dt, "CNIC").ToString();
Votername_veri_textBox.DataBindings.Clear();
string cnic = Votername_veri_textBox.Text;
Votername_veri_textBox.Text = "";
if (vericnic == cnic)
21 | P a g e
{
MessageBox.Show("Record Available in Voter List..");
return true;
}
else
{
MessageBox.Show("No Record Available in Voter List..");
return false;
}
}
Form1 home_page;
private void home_button_Click(object sender, EventArgs e)
{
this.Hide();
home_page = new Form1();
home_page.Show();
}
else
{
id = textBox_ID.Text = (Convert.ToString(textBox_ID.Text));
this.Hide();
vt.Show();
}
}
}}
3.5 Voting
using System;
22 | P a g e
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class voting : Form
{
SqlConnection conn;
SqlDataAdapter adpt;
DataTable dt;
SqlDataAdapter adt;
DataTable dt1;
SqlDataAdapter adt2;
DataTable dt2;
public voting()
{
InitializeComponent();
conn = new
SqlConnection("server=.;database=voting_system;integrated security=true");
}
vote_to_comboBox.DisplayMember = "";
vote_to_comboBox.ValueMember = "name";
adt2 = new SqlDataAdapter("select party from candidate_record where name='" +
vote_to_comboBox.Text + "'", conn);
dt2 = new DataTable();
adt2.Fill(dt2);
party_textBox.DataBindings.Add("text", dt2, "Party");
party_textBox.DataBindings.Clear();
if (party_textBox.Equals("PPP"))
{
PPP_pictureBox.Visible = true;
}
else
{
PPP_pictureBox.Visible = false;
}
23 | P a g e
}
Form1 home_page;
private void home_button_Click(object sender, EventArgs e)
{
this.Hide();
home_page = new Form1();
home_page.Show();
}
}
else
{
adpt = new SqlDataAdapter("insert into vote_cast values(" +
voter_id_textBox.Text + ",'" + voter_name_textBox.Text + "','" +
nic_textBox.Text + "','" + vote_to_comboBox.Text + "','" + party_textBox.Text
+ "')", conn);
dt = new DataTable();
adpt.Fill(dt);
MessageBox.Show(voter_name_textBox.Text + " has voted successfully...");
voter_id_textBox.DataBindings.Clear();
voter_name_textBox.DataBindings.Clear();
fname_textBox.DataBindings.Clear();
surname_textBox.DataBindings.Clear();
nic_textBox.DataBindings.Clear();
vote_to_comboBox.Text = "";
}
}
private bool VerifyToCNIC(string nic)
{
if (nic == cnic)
{
return true;
}
else
{
return false;
}
24 | P a g e
private void voter_id_textBox_TextChanged(object sender, EventArgs e)
{
adpt = new SqlDataAdapter("select*from voter_record where Voter_id=" +
voter_id_textBox.Text + "", conn);
dt = new DataTable();
adpt.Fill(dt);
voter_name_textBox.DataBindings.Add("text", dt, "name");
fname_textBox.DataBindings.Add("text", dt, "fname");
surname_textBox.DataBindings.Add("text", dt, "surname");
nic_textBox.DataBindings.Add("text", dt, "CNIC");
voter_id_textBox.DataBindings.Clear();
voter_name_textBox.DataBindings.Clear();
fname_textBox.DataBindings.Clear();
surname_textBox.DataBindings.Clear();
nic_textBox.DataBindings.Clear();
3.6 Help
using System;
using System.Collections.Generic;
25 | P a g e
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class Help : Form
{
public Help()
{
InitializeComponent();
}
Form1 home_page;
private void Home_button_Click(object sender, EventArgs e)
{
this.Hide();
home_page = new Form1();
home_page.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
26 | P a g e
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class AddNominees : Form
{
SqlConnection conn;
SqlDataAdapter adpt;
DataTable dt;
DataSet ds;
public AddNominees()
{
InitializeComponent();
conn = new
SqlConnection("server=.;database=voting_system;integrated security=true");
}
27 | P a g e
bool verified_Nadra = VerifyToCNIC_Nadra(CNIC_maskedTextBox1.Text);
if (verified_Nadra)
{
bool verified= this.verifyFromList(textBox_id.Text);
if (verified)
{
MessageBox.Show("Candidate with "+textBox_id.Text+" is already available...");
}
else
{
bool nic_verify = this.VerifyToCNIC(CNIC_maskedTextBox1.Text);
if (nic_verify)
{
MessageBox.Show("candidate with this CNIC " + CNIC_maskedTextBox1.Text + "
is already exist");
}
else
{
if (MNA_radioButton.Checked)
{
adpt = new SqlDataAdapter("insert into candidate_record values(" +
textBox_id.Text + ",'" + textBox_Name.Text + "','" + CNIC_maskedTextBox1.Text
+ "','" + textBox_Party.Text + "','" +MNA_radioButton.Text + "','" +
textBox_District.Text + "')", conn);
ds = new DataSet();
adpt.Fill(ds);
MessageBox.Show(textBox_Name.Text + " has been added in list of "
+MNA_radioButton.Text+ " catagory");
adpt = new SqlDataAdapter("select name from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
Candidate_comboBox.DataSource = dt;
Candidate_comboBox.ValueMember = "Name";
Candidate_comboBox.Text = "";
adpt = new SqlDataAdapter("select max(candidate_id)as candidate_id from
candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
last_id_textBox.DataBindings.Add("text", dt, "candidate_id");
last_id_textBox.DataBindings.Clear();
last_id_label.Text = last_id_textBox.Text;
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
CNIC_maskedTextBox1.Text = "";
textBox_District.Text = "";
textBox_id.Text = "";
textBox_Name.Text = "";
textBox_Party.Text = "";
}
else if (MPA_radioButton.Checked)
{
adpt = new SqlDataAdapter("insert into candidate_record values(" +
textBox_id.Text + ",'" + textBox_Name.Text + "','" + CNIC_maskedTextBox1.Text
+ "','" + textBox_Party.Text + "','" + MPA_radioButton.Text + "','" +
textBox_District.Text + "')", conn);
28 | P a g e
ds = new DataSet();
adpt.Fill(ds);
MessageBox.Show(textBox_Name.Text + " has been added in list of " +
MPA_radioButton.Text + " catagory");
adpt = new SqlDataAdapter("select name from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
Candidate_comboBox.DataSource = dt;
Candidate_comboBox.ValueMember = "Name";
Candidate_comboBox.Text = "";
adpt = new SqlDataAdapter("select max(candidate_id)as candidate_id from
candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
last_id_textBox.DataBindings.Add("text", dt, "candidate_id");
last_id_textBox.DataBindings.Clear();
last_id_label.Text = last_id_textBox.Text;
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
CNIC_maskedTextBox1.Text = "";
textBox_District.Text = "";
textBox_id.Text = "";
textBox_Name.Text = "";
textBox_Party.Text = "";
}
}
}
}
}
public bool verifyFromList(string id)
{
adpt = new SqlDataAdapter("select * from candidate_Record where Candidate_Id="
+ id + "", conn);
dt = new DataTable();
adpt.Fill(dt);
Verification_textbox.DataBindings.Add("text", dt, "candidate_Id").ToString();
Verification_textbox.DataBindings.Clear();
string veri = Verification_textbox.Text;
Verification_textbox.Text = "";
if (id == veri)
{
return true;
}
else
{
return false;
}
}
private bool VerifyToCNIC(string nic)
{
adpt = new SqlDataAdapter("select *from candidate_record where
candidate_cnic='" + nic + "'", conn);
dt = new DataTable();
adpt.Fill(dt);
29 | P a g e
string cnic = NIC_VERI_textBox.Text;
NIC_VERI_textBox.Text = "";
if (nic == cnic)
{
return true;
}
else
{
return false;
}
}
private bool VerifyToCNIC_Nadra(string nic)
{
adpt = new SqlDataAdapter("select *from nadra where CNIC='" + nic + "'",
conn);
dt = new DataTable();
adpt.Fill(dt);
if (nic == cnic)
{
MessageBox.Show("Record available in NADRA...");
return true;
}
else
{
MessageBox.Show("Sorry ! Indentification not matched..");
return false;
}
}
Form1 Home_page;
private void button_Home_Click(object sender, EventArgs e)
{
this.Hide();
Home_page = new Form1();
Home_page.Show();
}
30 | P a g e
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
CNIC_maskedTextBox1.Text = "";
textBox_District.Text = "";
textBox_id.Text = "";
textBox_Name.Text = "";
textBox_Party.Text = "";
}
}
Admin admin;
private void back_button_Click(object sender, EventArgs e)
{
this.Hide();
admin = new Admin();
admin.Show();
}
31 | P a g e
textBox_Party.Text = "";
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
adpt = new SqlDataAdapter("select max(candidate_id)as
candidate_id from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
last_id_textBox.DataBindings.Add("text", dt, "candidate_id");
last_id_textBox.DataBindings.Clear();
last_id_label.Text = last_id_textBox.Text;
}
else if (MPA_radioButton.Checked)
{
MPA_radioButton.Checked = true;
adpt = new SqlDataAdapter("delete from candidate_record
where name='" + Candidate_comboBox.Text + "'", conn);
ds = new DataSet();
adpt.Fill(ds);
MessageBox.Show(textBox_Name.Text + " has been deleted from MPA_Record...");
adpt = new SqlDataAdapter("select name from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
Candidate_comboBox.DataSource = dt;
Candidate_comboBox.ValueMember = "Name";
Candidate_comboBox.Text = "";
Candidate_comboBox.Text = "";
CNIC_maskedTextBox1.Text = "";
textBox_District.Text = "";
textBox_id.Text = "";
textBox_Name.Text = "";
textBox_Party.Text = "";
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
adpt = new SqlDataAdapter("select max(candidate_id)as
candidate_id from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
last_id_textBox.DataBindings.Add("text", dt, "candidate_id");
last_id_textBox.DataBindings.Clear();
last_id_label.Text = last_id_textBox.Text;
}
else
{
MessageBox.Show("Please chech either MNA or MPA ");
}
}
else
{
MessageBox.Show("There is no record match in nominee list.....");
}
}
private bool VerifyToCNIC_delete(string delete_nic)
{
32 | P a g e
adpt = new SqlDataAdapter("select *from candidate_record where
candidate_cnic='" + delete_nic + "'", conn);
dt = new DataTable();
adpt.Fill(dt);
Update_veri_textBox.DataBindings.Add("text", dt, "candidate_cnic").ToString();
Update_veri_textBox.DataBindings.Clear();
string cnic = Update_veri_textBox.Text;
Update_veri_textBox.Text = "";
if (delete_nic == cnic)
{
return true;
}
else
{
return false;
}
}
33 | P a g e
textBox_Party.Text = "";
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
}
else if (MPA_radioButton.Checked)
{
adpt = new SqlDataAdapter("update candidate_record set candidate_id=" +
textBox_id.Text + ",Candidate_CNIC='" + CNIC_maskedTextBox1.Text + "',Party='"
+ textBox_Party.Text + "',category='" +MPA_radioButton.Text + "',District='"
+ textBox_District.Text + "' where name='" + Candidate_comboBox.Text + "'",
conn);
ds = new DataSet();
adpt.Fill(ds);
MessageBox.Show("Record updated successfully...");
adpt = new SqlDataAdapter("select max(candidate_id)as
candidate_id from candidate_record", conn);
dt = new DataTable();
adpt.Fill(dt);
last_id_textBox.DataBindings.Add("text", dt, "candidate_id");
last_id_textBox.DataBindings.Clear();
last_id_label.Text = last_id_textBox.Text;
Candidate_comboBox.Text = "";
CNIC_maskedTextBox1.Text = "";
textBox_District.Text = "";
textBox_id.Text = "";
textBox_Name.Text = "";
textBox_Party.Text = "";
MNA_radioButton.Checked = false;
MPA_radioButton.Checked = false;
}
else
{
MessageBox.Show("Please select the category....");
}
}
else
{
MessageBox.Show("record is not available in candidate list to update..");
}
}
private bool VerifyToCNIC_update(string update_nic)
{
34 | P a g e
Update_veri_textBox.DataBindings.Add("text", dt, "candidate_cnic").ToString();
Update_veri_textBox.DataBindings.Clear();
string cnic = Update_veri_textBox.Text;
Update_veri_textBox.Text = "";
if (update_nic == cnic)
{
return true;
}
else
{
return false;
}
}
private void Candidate_List_richTextBox_TextChanged(object sender, EventArgs
e)
{
35 | P a g e
adpt = new SqlDataAdapter("select *from candidate_record Where
name='"+Candidate_comboBox.Text+"'",conn);
dt = new DataTable();
adpt.Fill(dt);
textBox_District.DataBindings.Add("text",dt,"District");
textBox_District.DataBindings.Clear();
CNIC_maskedTextBox1.DataBindings.Add("text",dt,"Candidate_CNIC");
CNIC_maskedTextBox1.DataBindings.Clear();
textBox_id.DataBindings.Add("text",dt,"Candidate_Id");
textBox_id.DataBindings.Clear();
textBox_Name.DataBindings.Add("text",dt,"Name");
textBox_Name.DataBindings.Clear();
textBox_Party.DataBindings.Add("text", dt, "Party");
textBox_Party.DataBindings.Clear();
NIC_VERI_textBox.DataBindings.Add("text",dt,"Category");
NIC_VERI_textBox.DataBindings.Clear();
if (NIC_VERI_textBox.Text.Equals("MNA"))
{
MNA_radioButton.Checked = true;
}
if (NIC_VERI_textBox.Text.Equals("MPA"))
{
MPA_radioButton.Checked = true;
}
}
}
}
}
using System;
36 | P a g e
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class ViewNominees : Form
{
SqlConnection con;
SqlDataAdapter adpt;
DataTable dt;
public ViewNominees()
{
InitializeComponent();
con = new
SqlConnection("server=.;database=voting_system;integrated security=true");
}
Form1 Home_page;
private void Home_button_Click(object sender, EventArgs e)
{
this.Hide();
Home_page = new Form1();
Home_page.Show();
}
37 | P a g e
}
38 | P a g e
MNA_dataGridView.Visible = false;
MPA_dataGridView.Visible = false;
Nominees_dataGridView.Visible = true;
}
if (MNA_radioButton.Checked)
{
MNA_dataGridView.Visible = true;
MPA_dataGridView.Visible = false;
Nominees_dataGridView.Visible = false;
adpt = new SqlDataAdapter("select*from Candidate_record where category='" +
MNA_radioButton.Text + "' order by candidate_id asc", con);
dt = new DataTable();
adpt.Fill(dt);
MNA_dataGridView.DataSource = dt;
}
if(MPA_radioButton.Checked== false && MNA_radioButton.Checked == false)
{
MNA_dataGridView.Visible = false;
MPA_dataGridView.Visible = false;
Nominees_dataGridView.Visible = true;
}
39 | P a g e
3.9 Results
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ONLINE_VOTING_SYSTEM
{
public partial class Result : Form
{
SqlConnection con;
SqlDataAdapter adpt_result;
DataTable dt_result;
SqlDataAdapter adptNominees;
DataTable dtNomee;
SqlDataAdapter adpt_party;
DataTable dt_party;
public Result()
{
InitializeComponent();
con = new SqlConnection("server=.;database=voting_system;integrated
security=true");
}
40 | P a g e
Party_result_comboBox.Visible = false;
Party_textBox.Visible = false;
Party_label.Visible = false;
Vote_textBox.Visible = false;
label1.Visible = false;
label2.Visible = false;
label3.Visible = false;
label4.Visible = false;
}
Form1 home_page;
private void button_Home_Click(object sender, EventArgs e)
{
this.Hide();
home_page = new Form1();
home_page.Show();
}
private void
comboBox_candidate_list_SelectedIndexChanged(object sender, EventArgs e)
{
41 | P a g e
adpt_party = new SqlDataAdapter("select count(voter_id)as Voter_Id from
vote_cast where party='" + Party_result_comboBox.Text + "'", con);
dt_party = new DataTable();
adpt_party.Fill(dt_party);
comboBox1.DataSource = dt_party;
comboBox1.DisplayMember = "voter_id";
comboBox1.ValueMember = "voter_id";
party_result_label.Text = comboBox1.Text + " Vote achieved";
}
Admin ADMIN;
private void BACK_button_Click(object sender, EventArgs e)
{
this.Hide();
ADMIN = new Admin();
ADMIN.Show();
}
Result_Table rst_tbl;
private void Total_button_Click(object sender, EventArgs e)
{
this.Hide();
rst_tbl = new Result_Table();
rst_tbl.Show();
}
}
}
42 | P a g e
CHAPTER FOUR
CHAPTER 4
43 | P a g e
Graphical Overview of project
4.1 Form 1
44 | P a g e
4.2 About Us
4.3 History
45 | P a g e
4.4 Register Vote
46 | P a g e
47 | P a g e
4.4.1
48 | P a g e
4.4.2
49 | P a g e
4.4.3
50 | P a g e
4.4.5
51 | P a g e
4.4.6
52 | P a g e
4.5 Admin
4.5.1
53 | P a g e
4.6 Add Nominees
54 | P a g e
4.6.1
55 | P a g e
56 | P a g e
4.6.2
57 | P a g e
4.6.3
58 | P a g e
4.7 View Nominees
59 | P a g e
4.8 Results
60 | P a g e
CHAPTER Five
CHAPTER 5
61 | P a g e
Conclusion
5.1 Conlusion
We are gratefull to Almighty Allah; the project has successfully been completed. In
conclusion, it can be said that the required goals has been achieved. All configurations have been
made and tested on our personal Computers and they are working properly.
This software makes impact of register and cast vote through computer and internect.
Although this project fulfills every requirment of user there is still need to work further. The
implementation of remaining section will have to implement.
62 | P a g e
APPENDEX
APPENDIX-A
MEETING STATISTICS
Date : Saturday, April 02, 2010
Venue : ITC, SAU
Starting Time: 11:30 am
Ending Time : 12:00 noon
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
♦ Scheduling of project time period.
_______________________ _______________________
Project Supervisor Project Developer
2 ND
M EETING M INUTES
64 | P a g e
Project Title : Online Voting System
Project Supervisor : Madam Shumaila Bashir
MEETING STATISTICS
Date : Tuesday, April 08, 2010
Venue : ITC, SAU
Starting Time: 11:30 am
Ending Time : 12:00 noon
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
♦ Discussion on project scope
♦ Discussion on analysis and design of the project.
_______________________ _______________________
Project Supervisor Project Developer
3 RD
M EETING M INUTES
65 | P a g e
MEETING STATISTICS
Date : Monday, April 10, 2010
Venue : ITC, SAU
Starting Time: 11:30 am
Ending Time : 12:00 noon
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
♦ Discussion on selected tools.
♦ Discussion about object-oriented language.
_______________________ _______________________
Project Supervisor Project Developer
4 TH
M EETING M INUTES
MEETING STATISTICS
Date : Tuesday, April 19, 2010
Venue : ITC, SAU
Starting Time: 10:28 am
66 | P a g e
Ending Time : 11:12 am
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
♦ First project demo was shown.
♦ Some modifications was discussed on the project
_______________________ _______________________
Project Supervisor Project Developer
5 TH
M EETING M INUTES
MEETING STATISTICS
Date : Saturday, April 22, 2010
Venue : ITC, SAU
Starting Time: 10:28 am
Ending Time : 11:12 am
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
67 | P a g e
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
♦ Project demo was shown after modification
♦ First draft of Project Report was shown
_______________________ _______________________
Project Supervisor Project Developer
6 TH
M EETING M INUTES
MEETING STATISTICS
Date : Monday, April 27, 2010
Venue : ITC, SAU
Starting Time: 10:28 am
Ending Time : 11:12 am
MEETING PARTICIPANTS
HAKIM ALI BALOCH (2K5-IT-64)
SHOAIB AHMED KALWAR (2K5-IT-131)
KANAHIA LAL (2K5-IT-70)
NARESH SONI (2K5-IT-147)
MOHSIN ALI (2K5-IT-103)
AGENDA
68 | P a g e
♦ Final demo of project was shown
♦ Project Report was done
♦ Presentation of project was roughly prepared
_______________________ _______________________
Project Supervisor Project Developer
7 TH
M EETING M INUTES
MEETING PARTICIPANTS
• Waseem Abbas Soomro……………….(2k5-IT-139)
• Ali Nawaz Lund………………………..(2k5-IT-38)
• Majid Ali Jatoi………………………….(2k5-IT-73)
• Muhammad Muzammil Hussain…….(2k5-IT-105)
• Waqas Tahir Memon…………………..(2k5-IT-138)
AGENDA
♦ Project, Project Report and Presentation was Finalized
_______________________ _______________________
69 | P a g e
Project Supervisor Project Developer
70 | P a g e
Page | 71