97
BARCODE BASED EXAMINATION MANAGEMENT SYSTEM Submitted To Mrs.Shalu Maurya Submitted By Harshit Rao(0709513019) Ankit Tomar(0709513006) 1 | Page

Mini Pro

Embed Size (px)

Citation preview

Page 1: Mini Pro

BARCODE BASED EXAMINATION MANAGEMENT SYSTEM

Submitted ToMrs.Shalu Maurya

Submitted ByHarshit Rao(0709513019)

Ankit Tomar(0709513006)

1 | P a g e

Page 2: Mini Pro

ACKNOWLEDGEMNT

We would like to thank our project coordinator and our faculty in charge Mr. Shalu Maurya, for constant and valuable suggestions while doing the project work , we express our profound gratitude to you because without your support this project couldn’t have been completed on time. We also acknowledge the unseen presence of Mr.Saurabh Srivastava who helped us through out and his teachings helped us make our project more effectively.

Date: Mrs.Shalu Maurya

2 | P a g e

Page 3: Mini Pro

TABLE OF CONTENTS

1. Abstract

2. Introduction To Project Problem Statement Existing System Background Glossary

3. Project Analysis and Specification Feasibility Study Functional Specification

Functions Performed Module Description

Design Specification Data Flow Diagrams Entity Relationship Diagram Class Diagram

Coding and Testing Coding Sample Testing

Implementation User Interface Design with Screenshots Database Structure Deliverable Items Milestone Descriptions

o Work Breakdown Structure Organization Charto Work Breakdown Structure Worksheet o Critical Path using CPM

4. Schedule Estimation 5. Hardware and Software Requirements

6. Conclusion

7. Future Enhancement

8. References

3 | P a g e

Page 4: Mini Pro

ABSTRACT

Barcode based examination management system developed by us provides a user friendly interactive atmosphere for handling activities of enrollment of students into the university and managing their information in database and assists in carrying out the examination procedure in smooth manner with minimal manual involvement .This software provides facility of maintaining records of students at one end and generates barcode against the serial number of answer sheets which would be given to the students for writing their exams ,further the pre-evaluation stage and post-evaluation stage of these answer sheets is managed using this software eventually generates result against the roll number of the students. This software could be used by universities and schools for carrying out automated examinations relying on barcode.

4 | P a g e

Page 5: Mini Pro

INTRODUCTION TO PROJECT

Problem Statement – Develop a windows based application that assists basic examination management system by reducing human labor with the help of barcode system that improves operational efficiency, saves time, reduces error and cuts cost. The project has been developed using modern tools and technology that makes the product more presentable, attractive, interactive and easy to use thus enabling the university using it to work in a smooth and healthy manner.

Existing System – A full range of examination management system and barcode generator are available which make use of different methods for generating Barcodes, each method having its own pros and cons. The Barcode eases the process by improving operational efficiency, saving time, reducing error and cutting cost. It provides a rapid, accurate and efficient means to collect, process, transmit, record and manage data in a various forms.

Background - The software would be used for carrying out entire Examination Management System ie: Enrollment of student into university, generating barcode against the answer sheet number, pre-evaluation, post evaluation and eventually result generation. The proposed project is based on .NET Framework and C# language. The Examination Management System would have all the essential features and, an easy to use and interactive interface.

Glossary – i. .NET Framework:

The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems. It includes a large library of coded solutions to common programming problems and a virtual machine that manages the execution of programs written specifically for the framework. The .NET Framework is a key Microsoft offering and is intended to beused by most new applications created for the Windows platform.The framework's Base Class Library provides a large range of features including user interface, data and data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. The class library is used by programmers, who combine it with their own code to produce applications.Programs written for the .NET Framework execute in a software environment that manages the program's runtime requirements. Also part of the .NET Framework, this runtime environment is known as the

5 | P a g e

Page 6: Mini Pro

Common Language Runtime (CLR). The CLR provides the appearance of an application virtual machine so that programmers need not consider the capabilities of the specific CPU that will execute the program. The CLR also provides other important services such as security, memory management, and exception handling. The class library and the CLR together constitute the .NET Framework.Version 3.0 of the .NET Framework is included with Windows Server 2008 and Windows Vista. The current version of the framework can also be installed on Windows XP family of operating systems. A reduced version of the .NET Framework is also available on Windows Mobile platforms, including smartphones as the .NET Compact Framework. Version 4.0 of the framework was released as a public Beta on 20 May 2009.

(ii)C Sharp (C#)

C# (pronounced C Sharp) is a multi-paradigm programming language that encompasses functional, imperative, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft as part of the .NET initiative and later approved as a standard by Ecma (ECMA- 334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg, the designer of Borland's Turbo Pascal. It has an object-oriented syntax based on C++.It was initially named Cool, which stood for "C-like Object Oriented Language." However, in July 2000, when Microsoft made the project public, the name of the programming language was given as C#. The most recent version of the language is 3.0 which was released in conjunction with the .NET Framework 3.5 in 2007. The next proposed version, 4.0, is in development.

C# is intended to be a simple, modern, general-purpose, object-oriented programming language.

Because software robustness, software durability and programmer productivity are important, the language should include strong type checking, array bounds checking, detection of attempts to use uninitialized variables, source code portability, and automatic garbage collection.

The language is intended for use in developing software components that can take advantage of distributed environments.

6 | P a g e

Page 7: Mini Pro

Programmer portability is very important, especially for those programmers already familiar with C and C++.

Support for internationalization is very important. C# is intended to be suitable for writing applications for both

hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.

Although C# applications are intended to be economical with regard to memory and processing power requirements, the language is not intended to compete directly on performance and size with C.

ii. Barcode:Code 39 (also known as "USS Code 39", "Code 3/9", "Code 3 of 9", "USD-3", "Alpha39", "Type 39", "Code 93") is a barcode symbology that can encode uppercase letters (A through Z), digits (0 through 9) and a handful of special characters like the $ sign. The barcode itself does not contain a check, but it can be considered self-checking by some, on the grounds that a single erroneously interpreted bar cannot generate another valid character. Possibly the most serious drawback of Code 39 is its low data density: It requires more space to encode data in Code 39 than, for example, in Code 128. This means that very small goods cannot be labeled with a Code 39 based barcode. However, Code 39 is still widely used and can be decoded with virtually any barcode reader. One advantage of Code 39 is that since there is no need to generate a check digit, it can easily be integrated into existing printing system by adding a barcode font to the system or printer and then printing the raw data in that font.The Code 39 (also known as 3 of 9 bar code) is a variable length, discrete, alphanumeric bar code. Its character set contains 43 meaningful characters: 0 - 9, A-Z, -, ., $, /, +, %, and space. Each character is composed of nine elements: five bars and four spaces. Three of the nine elements are wide (binary value 1), and six elements are narrow (binary value 0). An additional common character (*) is used for both start and stop delimiters.

7 | P a g e

Page 8: Mini Pro

PROJECT ANALYSIS AND SPECIFICATION

The main objective is to develop a Barcode based examination management system. Technology used is-.NET framework using C#.

FEASIBILITY STUDY

The feasibility can be divided into the following sections:

Economic FeasibilityThe project is economically feasible as the resources required for development of the project must be available in the organisation readily, and minor investment costs could be bared very easily by an organisation.

Technical FeasibilityTo deploy the application, the only technical aspects needed are mentioned below:Operating Environment : Win 2000/XP/Vista/W7Platform : .Net Framework & IISDatabase : SQL Server 2005

For Users:.NET Framework 3.5 or above

Operational or Behavioural FeasibilityThe application requires no special technical guidance and all the views available in the application are self explanatory. The users are well guided with warning and failure messages for all the actions taken.

8 | P a g e

Page 9: Mini Pro

Functional Specification

This project provides a way of handling University Examination System which helps an University by improving operational efficiency, saving time, reducing error and cutting cost. The Barcode has different uses which enables different processes to be processed quickly, efficiently, and accurately. The project has been developed using modern tools and technology that makes the product more presentable, attractive, interactive and easy to use thus enabling the university using it to work in a smooth and healthy manner.

i. Objective: The main objective is to develop a Barcode based examination management system that helps an university to improve its operational efficiency, saves time, reduces error and cost. Technology used is-.NET framework using C#.

ii. Methodology : Windows 7 Home Premium has been chosen as the server platform. And SDLC (system development life cycle) has been chosen as methodology following agile model.

9 | P a g e

Page 10: Mini Pro

System Development Life cycle:

A SDLC should result in a high quality system that meets or exceeds customer expectations, reaches completion within time and cost estimates, works effectively and efficiently in the current and planned Information Technology infrastructure, and is inexpensive to maintain and cost-effective to enhance. Here we have used Agile Model for development of the Barcode generator.

Functions Performed

The software developed consists the following functionalities so as to assist the Examination system in an automated manner represented as an integrated component of following components

Student Registration

Barcode Generation against the Answer Sheet Number

Pre-Evaluation entries

Post-Evaluation entries

Result Generation

10 | P a g e

Page 11: Mini Pro

MODULE DESCRIPTION

The software encompasses of five modules which when integrated together form an automated Barcode based Examination Management System.

These Five Modules Being

(A) Registration

This module of the software is concerned with the registration of every student at the time of admission. All the information related to the student is entered here.

(B) Generate Barcode

A unique barcode is generated for every answer sheet corresponding to the particular serial number of every answer sheet. The software makes use of CODE-39 and CODE-39 Extended techniques for generating the barcode. The barcode along with the unique code of the answer sheet is entered in the database. The data redundancy is checked by constraining the software not to accept any code whose entry does exist in the database.

(C) Pre Evaluation entries

All the entries required are entered in the database using this module. The entries such as the roll number, paper code, paper id, date of exam etc.. are entered corresponding to the unique code of the answer sheet. Once these entries are done the answer sheet is sent for evaluation.

(D) Post Evaluation entries :

11 | P a g e

Page 12: Mini Pro

This module of the software is concerned with the entry that is to be done after the answer sheet has been evaluated. In this module the code of the answer sheet is entered and if the entry corresponding to the code entered exist in the data base then all the pre evaluation information entered before are displayed. The marks awarded for the corresponding answer sheet are then entered.

(E) Result Generation

The roll number of the student is entered and the marks of the subjects for which the student had appeared are displayed but if the roll number is not found in the database then an error is genrated.

12 | P a g e

Page 13: Mini Pro

DATA FLOW DIAGRAMS

CONTEXT LEVEL DIAGRAM

DATABASE EXAMINATION CONTROLLER

FIRST LEVEL DFD

13 | P a g e

EXAMINATION CONTROL SYSTEM

Page 14: Mini Pro

SECOND LEVEL DFD

14 | P a g e

Page 15: Mini Pro

ENTITY RELATIONSHIP DIAGRAM

15 | P a g e

Page 16: Mini Pro

CLASS DIAGRAM

16 | P a g e

Page 17: Mini Pro

CODING AND TESTING

Coding Sample

Code for Welcome Module

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 BarTry{ public partial class Welcome : Form { public Welcome() { InitializeComponent(); }

private void btnGenerate_Click(object sender, EventArgs e) { Generator obj = new Generator(); obj.Show(); }

private void btnPre_Click(object sender, EventArgs e) { Pre obj1 = new Pre(); obj1.Show(); }

private void btnPost_Click(object sender, EventArgs e) { Post obj2 = new Post(); obj2.Show();

}

private void btnResult_Click(object sender, EventArgs e) { result obj3 = new result(); obj3.Show(); }

private void button1_Click(object sender, EventArgs e) { Registeration obj4 = new Registeration(); obj4.Show(); }

}}

17 | P a g e

Page 18: Mini Pro

Code for Barcode Generation Module

using System;using System.Collections;using System.Collections.Generic;using System.Text;using System.Drawing;using System.Drawing.Drawing2D;using System.Data;using System.IO;using System.Drawing.Imaging;using System.Windows.Forms;using System.Data.SqlClient;using System.Data.Sql;using System.Data.SqlTypes;using System.ComponentModel; namespace BarTry{ public partial class Generator : Form {

public Generator() { InitializeComponent(); }

private void btnEncode_Click(object sender, EventArgs e) { Barcode b = new Barcode();

int W = Convert.ToInt32(this.txtWidth.Text.Trim()); int H = Convert.ToInt32(this.txtHeight.Text.Trim());

TYPE type = TYPE.UNSPECIFIED; switch (cbEncodeType.SelectedItem.ToString().Trim()) { case "Code 39": type = TYPE.CODE39; break; case "Code 39 Extended": type = TYPE.CODE39Extended; break; default: MessageBox.Show("Please specify the encoding type."); break; }

try { if (type != TYPE.UNSPECIFIED) { b.IncludeLabel = this.chkGenerateLabel.Checked; barcode.Image = b.Encode(type, this.txtData.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor, W, H);

}

barcode.Width = barcode.Image.Width; barcode.Height = barcode.Image.Height;

18 | P a g e

Page 19: Mini Pro

barcode.Location = new Point((this.groupBox2.Location.X/2)+100, (this.groupBox2.Location.Y/2 )-40); } catch (Exception ex) { MessageBox.Show(ex.Message); } }

private void btnForeColor_Click_1(object sender, EventArgs e) { using (ColorDialog cdialog = new ColorDialog()) { cdialog.AnyColor = true; if (cdialog.ShowDialog() == DialogResult.OK) { this.ForeColor = cdialog.Color; this.btnForeColor.BackColor = this.ForeColor; } } }

private void btnBackColor_Click(object sender, EventArgs e) {

using (ColorDialog cdialog = new ColorDialog()) { cdialog.AnyColor = true; if (cdialog.ShowDialog() == DialogResult.OK) { this.BackColor = cdialog.Color; this.btnBackColor.BackColor = this.BackColor; } } }

private void Form1_Load(object sender, EventArgs e) { Bitmap temp = new Bitmap(1, 1); temp.SetPixel(0, 0, this.BackColor); barcode.Image = (Image)temp; cbEncodeType.SelectedIndex = 0;

this.btnBackColor.BackColor = this.BackColor; this.btnForeColor.BackColor = this.ForeColor; }

private void txtEncoded_TextChanged(object sender, EventArgs e) {

}

19 | P a g e

Page 20: Mini Pro

private void Savedata_Click(object sender, EventArgs e) { //We are using SQL express. //My database name is "PictureDb". SqlConnection con = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); //I have used a table named "tblUsers" and fill the fields SqlCommand com = new SqlCommand("insert into tblUsers(fldCode,fldPic) values('" + txtData.Text + "',@Pic)", con);

//In here, I have to save the picturebox image to tblUsers //because you were not able to send the PictureBox1.Image //to field "fldPic" that is of kind //"image" in SQL SERVER EXPRESS, then you should do something else // and that is converting //your picture box image to an array of bytes and then sending //that array to database. //Below, we have used a stream which will be used to //contain our picturebox image bytes. MemoryStream stream=new MemoryStream(); //through the instruction below, we save the //image to byte in the object "stream". barcode.Image.Save(stream,System.Drawing.Imaging.ImageFormat.Jpeg);

//Below is the most important part, actually you are //transferring the bytes of the array //to the pic which is also of kind byte[] byte[] pic=stream.ToArray();

com.Parameters.AddWithValue("@Pic", pic); try { con.Open(); com.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } }

private void btnView_Click(object sender, EventArgs e) { SqlConnection connect = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); SqlCommand command = new SqlCommand ("select fldPic from tblUsers where fldCode='" + txtData.Text + "'", connect); //for retrieving the image field in SQL SERVER EXPRESS //Database you should first bring //that image in DataList or DataTable //then add the content to the byte[] array. //That's ALL!

20 | P a g e

Page 21: Mini Pro

SqlDataAdapter dp = new SqlDataAdapter(command); DataSet ds = new DataSet("MyImages"); dp.Fill(ds, "MyImages"); int i = ds.Tables[0].Rows.Count; if ((i == 0)) { barcode.Image = null; ; MessageBox.Show("No such answer sheet exists in database"); } else { byte[] MyData = new byte[0];

DataRow myRow; myRow = ds.Tables["MyImages"].Rows[0];

MyData = (byte[])myRow["fldPic"];

MemoryStream stream = new MemoryStream(MyData); //With the code below, you are in fact converting the byte array of image //to the real image. barcode.Location = new Point((this.groupBox2.Location.X / 2) + 100, (this.groupBox2.Location.Y / 2) - 40); barcode.Image = Image.FromStream(stream); }

}

private void groupBox1_Enter(object sender, EventArgs e) {

}

private void save_Click(object sender, EventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.Filter = "Bitmap files (*.bmp)|*.bmp|JPG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|All files (*.*)|*.*"; save.FilterIndex = 4; save.RestoreDirectory = true; if(save.ShowDialog() == DialogResult.OK){ barcode.Image.Save(save.FileName); } }

}

} interface IBarcode { string Encoded_Value {

21 | P a g e

Page 22: Mini Pro

get; }

string RawData { get; } List<string> Errors { get; } } public enum TYPE : int { UNSPECIFIED, CODE39, CODE39Extended, ITF14, PostNet }; public class Barcode : IDisposable { #region Variables private IBarcode ibarcode = new Blank(); private string Raw_Data = ""; private string Encoded_Value = ""; private TYPE Encoded_Type = TYPE.UNSPECIFIED; private Image _Encoded_Image = null; private Color _ForeColor = Color.Black; private Color _BackColor = Color.White; private int _Width = 300; private int _Height = 150; private bool _IncludeLabel = false; private ImageFormat _ImageFormat = ImageFormat.Jpeg; #endregion

#region Constructors /// <summary> /// Default constructor. Does not populate the raw data. MUST be done via the RawData property before encoding. /// </summary> public Barcode() { //constructor }//Barcode /// <summary> /// Constructor. Populates the raw data. No whitespace will be added before or after the barcode. /// </summary> /// <param name="data">String to be encoded.</param> public Barcode(string data) { //constructor this.Raw_Data = data; }//Barcode public Barcode(string data, TYPE iType) { this.Raw_Data = data; this.Encoded_Type = iType; } #endregion

#region Properties

22 | P a g e

Page 23: Mini Pro

/// <summary> /// Gets or sets the raw data to encode. /// </summary> public string RawData { get { return Raw_Data; } set { Raw_Data = value; } }//RawData /// <summary> /// Gets the encoded value. /// </summary> public string EncodedValue { get { return Encoded_Value; } }//EncodedValue /// <summary> /// Gets the Country that assigned the Manufacturer Code. /// </summary> /// <summary> /// Gets or sets the Encoded Type (ex. UPC-A, EAN-13 ... etc) /// </summary> public TYPE EncodedType { set { Encoded_Type = value; } get { return Encoded_Type; } }//EncodedType /// <summary> /// Gets the Image of the generated barcode. /// </summary> public Image EncodedImage { get { return _Encoded_Image; } }//EncodedImage /// <summary> /// Gets or sets the color of the bars. (Default is black) /// </summary> public Color ForeColor { get { return this._ForeColor; } set { this._ForeColor = value; } }//ForeColor /// <summary> /// Gets or sets the background color. (Default is white) /// </summary> public Color BackColor { get { return this._BackColor; } set { this._BackColor = value; } }//BackColor /// <summary> /// Gets or sets the width of the image to be drawn. (Default is 300 pixels) /// </summary> public int Width { get { return _Width; } set { _Width = value; }

23 | P a g e

Page 24: Mini Pro

} /// <summary> /// Gets or sets the height of the image to be drawn. (Default is 150 pixels) /// </summary> public int Height { get { return _Height; } set { _Height = value; } } /// <summary> /// Gets or sets whether a label should be drawn below the image. /// </summary> public bool IncludeLabel { set { this._IncludeLabel = value; } get { return this._IncludeLabel; } } /// <summary> /// Gets or sets the amount of time in milliseconds that it took to encode and draw the barcode. /// </summary> /// <summary> /// Gets the XML representation of the Barcode data and image. /// </summary> /// <summary> /// Gets or sets the image format to use when encoding and returning images. (Jpeg is default) /// </summary> public ImageFormat ImageFormat { get { return _ImageFormat; } set { _ImageFormat = value; } } /// <summary> /// Gets the list of errors encountered. /// </summary> public List<string> Errors { get { return this.ibarcode.Errors; } }

/// <summary> /// Gets the assembly version information. /// </summary> public Version Version { get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; } } #endregion

#region Functions #region General Encode public Image Encode(TYPE iType, string StringToEncode, int Width, int Height) { this.Width = Width; this.Height = Height; return Encode(iType, StringToEncode);

24 | P a g e

Page 25: Mini Pro

} public Image Encode(TYPE iType, string StringToEncode, Color ForeColor, Color BackColor, int Width, int Height) { this.Width = Width; this.Height = Height; return Encode(iType, StringToEncode, ForeColor, BackColor); } public Image Encode(TYPE iType, string StringToEncode, Color ForeColor, Color BackColor) { this.BackColor = BackColor; this.ForeColor = ForeColor; return Encode(iType, StringToEncode); } public Image Encode(TYPE iType, string StringToEncode) { Raw_Data = StringToEncode; return Encode(iType); } internal Image Encode(TYPE iType) { Encoded_Type = iType; return Encode(); } internal Image Encode() { ibarcode.Errors.Clear();

DateTime dtStartTime = DateTime.Now;

if (Raw_Data.Trim() == "") throw new Exception("EENCODE-1: Input data not allowed to be blank.");

if (this.EncodedType == TYPE.UNSPECIFIED) throw new Exception("EENCODE-2: Symbology type not allowed to be unspecified.");

this.Encoded_Value = "";

switch (this.Encoded_Type) {

case TYPE.CODE39: ibarcode = new Code39(Raw_Data); break; case TYPE.CODE39Extended: ibarcode = new Code39(Raw_Data, true); break; }

this.Encoded_Value = ibarcode.Encoded_Value; this.Raw_Data = ibarcode.RawData;

_Encoded_Image = (Image)Generate_Image();

25 | P a g e

Page 26: Mini Pro

return EncodedImage; } #endregion

#region Image Functions /// <summary> /// Gets a bitmap representation of the encoded data. /// </summary> /// <returns>Bitmap of encoded value.</returns> private Bitmap Generate_Image() { if (Encoded_Value == "") throw new Exception("EGENERATE_IMAGE-1: Must be encoded first."); Bitmap b = null;

switch (this.Encoded_Type) { case TYPE.ITF14: { b = new Bitmap(Width, Height);

int bearerwidth = (int)((b.Width) / 12.05); int iquietzone = Convert.ToInt32(b.Width * 0.05); int iBarWidth = (b.Width - (bearerwidth * 2) - (iquietzone * 2)) / Encoded_Value.Length; int shiftAdjustment = ((b.Width - (bearerwidth * 2) - (iquietzone * 2)) % Encoded_Value.Length) / 2;

if (iBarWidth <= 0 || iquietzone <= 0) throw new Exception("EGENERATE_IMAGE-3: Image size specified not large enough to draw image. (Bar size determined to be less than 1 pixel or quiet zone determined to be less than 1 pixel)");

//draw image int pos = 0;

using (Graphics g = Graphics.FromImage(b)) { //fill background g.Clear(BackColor);

//lines are fBarWidth wide so draw the appropriate color line vertically using (Pen pen = new Pen(ForeColor, iBarWidth)) { pen.Alignment = PenAlignment.Right;

while (pos < Encoded_Value.Length) { //lines are 2px wide so draw the appropriate color line vertically if (Encoded_Value[pos] == '1') g.DrawLine(pen, new Point((pos * iBarWidth) + shiftAdjustment + bearerwidth + iquietzone, 0), new Point((pos * iBarWidth) + shiftAdjustment + bearerwidth + iquietzone, Height));

pos++; }//while

//bearer bars pen.Width = (float)b.Height / 8;

26 | P a g e

Page 27: Mini Pro

pen.Color = ForeColor; pen.Alignment = PenAlignment.Inset; g.DrawLine(pen, new Point(0, 0), new Point(b.Width, 0));//top g.DrawLine(pen, new Point(0, b.Height), new Point(b.Width, b.Height));//bottom g.DrawLine(pen, new Point(0, 0), new Point(0, b.Height));//left g.DrawLine(pen, new Point(b.Width, 0), new Point(b.Width, b.Height));//right }//using }//using

if (IncludeLabel) Label_ITF14((Image)b);

break; }//case case TYPE.PostNet: { b = new Bitmap(Encoded_Value.Length * 4, 20);

//draw image for (int y = b.Height - 1; y > 0; y--) { int x = 0; if (y < b.Height / 2) { //top while (x < b.Width) { if (Encoded_Value[x / 4] == '1') { //draw bar b.SetPixel(x, y, ForeColor); b.SetPixel(x + 1, y, ForeColor); b.SetPixel(x + 2, y, BackColor); b.SetPixel(x + 3, y, BackColor); }//if else { //draw space b.SetPixel(x, y, BackColor); b.SetPixel(x + 1, y, BackColor); b.SetPixel(x + 2, y, BackColor); b.SetPixel(x + 3, y, BackColor); }//else x += 4; }//while }//if else { //bottom while (x < b.Width) { b.SetPixel(x, y, ForeColor); b.SetPixel(x + 1, y, ForeColor); b.SetPixel(x + 2, y, BackColor); b.SetPixel(x + 3, y, BackColor); x += 4; }//while

27 | P a g e

Page 28: Mini Pro

}//else }//for

break; }//case default: { b = new Bitmap(Width, Height);

int iBarWidth = Width / Encoded_Value.Length; int shiftAdjustment = (Width % Encoded_Value.Length) / 2;

if (iBarWidth <= 0) throw new Exception("EGENERATE_IMAGE-2: Image size specified not large enough to draw image. (Bar size determined to be less than 1 pixel)");

//draw image int pos = 0;

using (Graphics g = Graphics.FromImage(b)) { //clears the image and colors the entire background g.Clear(BackColor);

//lines are fBarWidth wide so draw the appropriate color line vertically using (Pen pen = new Pen(ForeColor, iBarWidth)) { pen.Alignment = PenAlignment.Right;

while (pos < Encoded_Value.Length) { if (Encoded_Value[pos] == '1') g.DrawLine(pen, new Point(pos * iBarWidth + shiftAdjustment, 0), new Point(pos * iBarWidth + shiftAdjustment, Height));

pos++; }//while }//using }//using

if (IncludeLabel) Label_Generic((Image)b);

break; }//case }//switch

_Encoded_Image = (Image)b;

return b; }//Generate_Image /// <summary> /// Gets the bytes that represent the image. /// </summary> /// <param name="savetype">File type to put the data in before returning the bytes.</param>

28 | P a g e

Page 29: Mini Pro

/// <returns>Bytes representing the encoded image.</returns> #endregion

#region Label Generation private Image Label_ITF14(Image img) { try { System.Drawing.Font font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);

using (Graphics g = Graphics.FromImage(img)) { g.DrawImage(img, (float)0, (float)0);

g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality;

//color a white box at the bottom of the barcode to hold the string of data g.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(0, img.Height - 16, img.Width, 16));

//draw datastring under the barcode image StringFormat f = new StringFormat(); f.Alignment = StringAlignment.Center; g.DrawString(this.Raw_Data, font, new SolidBrush(this.ForeColor), (float)(img.Width / 2), img.Height - 16, f);

Pen pen = new Pen(ForeColor, (float)img.Height / 16); pen.Alignment = PenAlignment.Inset; g.DrawLine(pen, new Point(0, img.Height - 20), new Point(img.Width, img.Height - 20));//bottom

g.Save(); }//using return img; }//try catch (Exception ex) { throw new Exception("ELABEL_ITF14-1: " + ex.Message); }//catch } private Image Label_Generic(Image img) { try { System.Drawing.Font font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);

using (Graphics g = Graphics.FromImage(img)) { g.DrawImage(img, (float)0, (float)0);

g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality;

29 | P a g e

Page 30: Mini Pro

g.CompositingQuality = CompositingQuality.HighQuality;

//color a background color box at the bottom of the barcode to hold the string of data g.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(0, img.Height - 16, img.Width, 16));

//draw datastring under the barcode image StringFormat f = new StringFormat(); f.Alignment = StringAlignment.Center;

string strLabelText = this.RawData;

g.DrawString(strLabelText, font, new SolidBrush(this.ForeColor), (float)(img.Width / 2), img.Height - 16, f);

g.Save(); }//using return img; }//try catch (Exception ex) { throw new Exception("ELABEL_GENERIC-1: " + ex.Message); }//catch }//Label_Generic #endregion #endregion

#region Misc internal static bool CheckNumericOnly(string Data) { int STRING_LENGTHS = 18;

string temp = Data; string[] strings = new string[(Data.Length / STRING_LENGTHS) + ((Data.Length % STRING_LENGTHS == 0) ? 0 : 1)];

int i = 0; while (i < strings.Length) if (temp.Length >= STRING_LENGTHS) { strings[i++] = temp.Substring(0, STRING_LENGTHS); temp = temp.Substring(STRING_LENGTHS); } else strings[i++] = temp.Substring(0);

foreach (string s in strings) { long value = 0; if (!Int64.TryParse(s, out value)) return false; }

return true; }

#endregion

#region Static Methods /// <summary>

30 | P a g e

Page 31: Mini Pro

/// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <returns>Image representing the barcode.</returns> public static Image DoEncode(TYPE iType, string Data) { using (Barcode b = new Barcode()) { return b.Encode(iType, Data); }//using } /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <param name="XML">XML representation of the data and the image of the barcode.</param> /// <returns>Image representing the barcode.</returns> /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param> /// <returns>Image representing the barcode.</returns> public static Image DoEncode(TYPE iType, string Data, bool IncludeLabel) { using (Barcode b = new Barcode()) { b.IncludeLabel = IncludeLabel; return b.Encode(iType, Data); }//using } /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="data">Raw data to encode.</param> /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param> /// <param name="Width">Width of the resulting barcode.(pixels)</param> /// <param name="Height">Height of the resulting barcode.(pixels)</param> /// <returns>Image representing the barcode.</returns> public static Image DoEncode(TYPE iType, string Data, bool IncludeLabel, int Width, int Height) { using (Barcode b = new Barcode()) { b.IncludeLabel = IncludeLabel; return b.Encode(iType, Data, Width, Height);

31 | P a g e

Page 32: Mini Pro

}//using } /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param> /// <param name="DrawColor">Foreground color</param> /// <param name="BackColor">Background color</param> /// <returns>Image representing the barcode.</returns> public static Image DoEncode(TYPE iType, string Data, bool IncludeLabel, Color DrawColor, Color BackColor) { using (Barcode b = new Barcode()) { b.IncludeLabel = IncludeLabel; return b.Encode(iType, Data, DrawColor, BackColor); }//using } /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param> /// <param name="DrawColor">Foreground color</param> /// <param name="BackColor">Background color</param> /// <param name="Width">Width of the resulting barcode.(pixels)</param> /// <param name="Height">Height of the resulting barcode.(pixels)</param> /// <returns>Image representing the barcode.</returns> public static Image DoEncode(TYPE iType, string Data, bool IncludeLabel, Color DrawColor, Color BackColor, int Width, int Height) { using (Barcode b = new Barcode()) { b.IncludeLabel = IncludeLabel; return b.Encode(iType, Data, DrawColor, BackColor, Width, Height); }//using } /// <summary> /// Encodes the raw data into binary form representing bars and spaces. Also generates an Image of the barcode. /// </summary> /// <param name="iType">Type of encoding to use.</param> /// <param name="Data">Raw data to encode.</param> /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param> /// <param name="DrawColor">Foreground color</param> /// <param name="BackColor">Background color</param> /// <param name="Width">Width of the resulting barcode.(pixels)</param> /// <param name="Height">Height of the resulting barcode.(pixels)</param>

32 | P a g e

Page 33: Mini Pro

/// <param name="XML">XML representation of the data and the image of the barcode.</param> /// <returns>Image representing the barcode.</returns> #endregion

#region IDisposable Members

public void Dispose() { try { }//try catch (Exception ex) { throw new Exception("EDISPOSE-1: " + ex.Message); }//catch }

#endregion } class Blank : BarcodeCommon, IBarcode {

#region IBarcode Members

public string Encoded_Value { get { throw new NotImplementedException(); } }

#endregion } class Code39 : BarcodeCommon, IBarcode { private System.Collections.Hashtable C39_Code = new System.Collections.Hashtable(); private System.Collections.Hashtable ExtC39_Translation = new System.Collections.Hashtable(); private bool _AllowExtended = false; public Code39(string input) { Raw_Data = input; } public Code39(string input, bool AllowExtended) { Raw_Data = input; _AllowExtended = AllowExtended; } private string Encode_Code39() { this.init_Code39(); this.init_ExtendedCode39();

string strFormattedData = "*" + Raw_Data.Replace("*", "") + "*";

if (_AllowExtended) InsertExtendedCharsIfNeeded(ref strFormattedData);

33 | P a g e

Page 34: Mini Pro

string result = ""; foreach (char c in strFormattedData) { try { result += C39_Code[c].ToString(); result += "0"; } catch { if (_AllowExtended) Error("EC39-1: Invalid data."); else Error("EC39-1: Invalid data. (Try using Extended Code39)"); } }

result = result.Substring(0, result.Length - 1);

this.C39_Code.Clear();

return result; } private void init_Code39() { C39_Code.Clear(); C39_Code.Add('0', "101001101101"); C39_Code.Add('1', "110100101011"); C39_Code.Add('2', "101100101011"); C39_Code.Add('3', "110110010101"); C39_Code.Add('4', "101001101011"); C39_Code.Add('5', "110100110101"); C39_Code.Add('6', "101100110101"); C39_Code.Add('7', "101001011011"); C39_Code.Add('8', "110100101101"); C39_Code.Add('9', "101100101101"); C39_Code.Add('A', "110101001011"); C39_Code.Add('B', "101101001011"); C39_Code.Add('C', "110110100101"); C39_Code.Add('D', "101011001011"); C39_Code.Add('E', "110101100101"); C39_Code.Add('F', "101101100101"); C39_Code.Add('G', "101010011011"); C39_Code.Add('H', "110101001101"); C39_Code.Add('I', "101101001101"); C39_Code.Add('J', "101011001101"); C39_Code.Add('K', "110101010011"); C39_Code.Add('L', "101101010011"); C39_Code.Add('M', "110110101001"); C39_Code.Add('N', "101011010011"); C39_Code.Add('O', "110101101001"); C39_Code.Add('P', "101101101001"); C39_Code.Add('Q', "101010110011"); C39_Code.Add('R', "110101011001"); C39_Code.Add('S', "101101011001"); C39_Code.Add('T', "101011011001"); C39_Code.Add('U', "110010101011"); C39_Code.Add('V', "100110101011"); C39_Code.Add('W', "110011010101"); C39_Code.Add('X', "100101101011");

34 | P a g e

Page 35: Mini Pro

C39_Code.Add('Y', "110010110101"); C39_Code.Add('Z', "100110110101"); C39_Code.Add('-', "100101011011"); C39_Code.Add('.', "110010101101"); C39_Code.Add(' ', "100110101101"); C39_Code.Add('$', "100100100101"); C39_Code.Add('/', "100100101001"); C39_Code.Add('+', "100101001001"); C39_Code.Add('%', "101001001001"); C39_Code.Add('*', "100101101101"); } private void init_ExtendedCode39() { ExtC39_Translation.Clear(); ExtC39_Translation.Add(Convert.ToChar(0).ToString(), "%U"); ExtC39_Translation.Add(Convert.ToChar(1).ToString(), "$A"); ExtC39_Translation.Add(Convert.ToChar(2).ToString(), "$B"); ExtC39_Translation.Add(Convert.ToChar(3).ToString(), "$C"); ExtC39_Translation.Add(Convert.ToChar(4).ToString(), "$D"); ExtC39_Translation.Add(Convert.ToChar(5).ToString(), "$E"); ExtC39_Translation.Add(Convert.ToChar(6).ToString(), "$F"); ExtC39_Translation.Add(Convert.ToChar(7).ToString(), "$G"); ExtC39_Translation.Add(Convert.ToChar(8).ToString(), "$H"); ExtC39_Translation.Add(Convert.ToChar(9).ToString(), "$I"); ExtC39_Translation.Add(Convert.ToChar(10).ToString(), "$J"); ExtC39_Translation.Add(Convert.ToChar(11).ToString(), "$K"); ExtC39_Translation.Add(Convert.ToChar(12).ToString(), "$L"); ExtC39_Translation.Add(Convert.ToChar(13).ToString(), "$M"); ExtC39_Translation.Add(Convert.ToChar(14).ToString(), "$N"); ExtC39_Translation.Add(Convert.ToChar(15).ToString(), "$O"); ExtC39_Translation.Add(Convert.ToChar(16).ToString(), "$P"); ExtC39_Translation.Add(Convert.ToChar(17).ToString(), "$Q"); ExtC39_Translation.Add(Convert.ToChar(18).ToString(), "$R"); ExtC39_Translation.Add(Convert.ToChar(19).ToString(), "$S"); ExtC39_Translation.Add(Convert.ToChar(20).ToString(), "$T"); ExtC39_Translation.Add(Convert.ToChar(21).ToString(), "$U"); ExtC39_Translation.Add(Convert.ToChar(22).ToString(), "$V"); ExtC39_Translation.Add(Convert.ToChar(23).ToString(), "$W"); ExtC39_Translation.Add(Convert.ToChar(24).ToString(), "$X"); ExtC39_Translation.Add(Convert.ToChar(25).ToString(), "$Y"); ExtC39_Translation.Add(Convert.ToChar(26).ToString(), "$Z"); ExtC39_Translation.Add(Convert.ToChar(27).ToString(), "%A"); ExtC39_Translation.Add(Convert.ToChar(28).ToString(), "%B"); ExtC39_Translation.Add(Convert.ToChar(29).ToString(), "%C"); ExtC39_Translation.Add(Convert.ToChar(30).ToString(), "%D"); ExtC39_Translation.Add(Convert.ToChar(31).ToString(), "%E"); ExtC39_Translation.Add("!", "/A"); ExtC39_Translation.Add("\"", "/B"); ExtC39_Translation.Add("#", "/C"); ExtC39_Translation.Add("$", "/D"); ExtC39_Translation.Add("%", "/E"); ExtC39_Translation.Add("&", "/F"); ExtC39_Translation.Add("'", "/G"); ExtC39_Translation.Add("(", "/H"); ExtC39_Translation.Add(")", "/I"); ExtC39_Translation.Add("*", "/J"); ExtC39_Translation.Add("+", "/K"); ExtC39_Translation.Add(",", "/L"); ExtC39_Translation.Add("/", "/O"); ExtC39_Translation.Add(":", "/Z"); ExtC39_Translation.Add(";", "%F");

35 | P a g e

Page 36: Mini Pro

ExtC39_Translation.Add("<", "%G"); ExtC39_Translation.Add("=", "%H"); ExtC39_Translation.Add(">", "%I"); ExtC39_Translation.Add("?", "%J"); ExtC39_Translation.Add("[", "%K"); ExtC39_Translation.Add("\\", "%L"); ExtC39_Translation.Add("]", "%M"); ExtC39_Translation.Add("^", "%N"); ExtC39_Translation.Add("_", "%O"); ExtC39_Translation.Add("{", "%P"); ExtC39_Translation.Add("|", "%Q"); ExtC39_Translation.Add("}", "%R"); ExtC39_Translation.Add("~", "%S"); ExtC39_Translation.Add("`", "%W"); ExtC39_Translation.Add("@", "%V"); ExtC39_Translation.Add("a", "+A"); ExtC39_Translation.Add("b", "+B"); ExtC39_Translation.Add("c", "+C"); ExtC39_Translation.Add("d", "+D"); ExtC39_Translation.Add("e", "+E"); ExtC39_Translation.Add("f", "+F"); ExtC39_Translation.Add("g", "+G"); ExtC39_Translation.Add("h", "+H"); ExtC39_Translation.Add("i", "+I"); ExtC39_Translation.Add("j", "+J"); ExtC39_Translation.Add("k", "+K"); ExtC39_Translation.Add("l", "+L"); ExtC39_Translation.Add("m", "+M"); ExtC39_Translation.Add("n", "+N"); ExtC39_Translation.Add("o", "+O"); ExtC39_Translation.Add("p", "+P"); ExtC39_Translation.Add("q", "+Q"); ExtC39_Translation.Add("r", "+R"); ExtC39_Translation.Add("s", "+S"); ExtC39_Translation.Add("t", "+T"); ExtC39_Translation.Add("u", "+U"); ExtC39_Translation.Add("v", "+V"); ExtC39_Translation.Add("w", "+W"); ExtC39_Translation.Add("x", "+X"); ExtC39_Translation.Add("y", "+Y"); ExtC39_Translation.Add("z", "+Z"); ExtC39_Translation.Add(Convert.ToChar(127).ToString(), "%T"); //also %X, %Y, %Z }

private void InsertExtendedCharsIfNeeded(ref string FormattedData) { string output = ""; foreach (char c in Raw_Data) { try { string s = C39_Code[c].ToString(); output += c; } catch { object oTrans = ExtC39_Translation[c.ToString()]; output += oTrans.ToString(); } }

36 | P a g e

Page 37: Mini Pro

FormattedData = output; }

#region IBarcode Members

public string Encoded_Value { get { return Encode_Code39(); } }

#endregion } abstract class BarcodeCommon { protected string Raw_Data = ""; protected List<string> _Errors = new List<string>();

public string RawData { get { return this.Raw_Data; } }

public List<string> Errors { get { return this._Errors; } }

public void Error(string ErrorMessage) { this._Errors.Add(ErrorMessage); throw new Exception(ErrorMessage); }

}

Code for Pre-Evaluation Module using System;using System.Collections;using System.Collections.Generic;using System.Text;using System.Drawing;using System.Drawing.Drawing2D;using System.Data;using System.IO;using System.Drawing.Imaging;using System.Windows.Forms;using System.Data.SqlClient;using System.Data.Sql;using System.Data.SqlTypes;using System.ComponentModel; namespace BarTry{ public partial class Pre : Form { public Pre() { InitializeComponent();

37 | P a g e

Page 38: Mini Pro

}

private void button1_Click(object sender, EventArgs e) { SqlConnection connect = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); SqlCommand command = new SqlCommand ("select * from tblUsers where fldCode='" + textBox1.Text + "'", connect); //for retrieving the image field in SQL SERVER EXPRESS //Database you should first bring //that image in DataList or DataTable //then add the content to the byte[] array. //That's ALL! SqlDataAdapter dp = new SqlDataAdapter(command); DataSet ds = new DataSet(); dp.Fill(ds); int i = ds.Tables[0].Rows.Count; if ((i == 0)) { MessageBox.Show("No such answer sheet exists in database"); } else { groupBox1.Show(); } }

private void Pre_Load(object sender, EventArgs e) { groupBox1.Hide(); }

private void textBox3_TextChanged(object sender, EventArgs e) {

}

private void textBox3_TextChanged_1(object sender, EventArgs e) {

}

private void button2_Click(object sender, EventArgs e) { }

private void button3_Click(object sender, EventArgs e) { String c = course.Text; String state = ""; if (Regular.Checked) { state = Regular.Text; } else if (Carryover.Checked) { state = Carryover.Text; } else if (re.Checked) {

38 | P a g e

Page 39: Mini Pro

state = re.Text; } SqlConnection con = new SqlConnection("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); con.Open(); SqlCommand com = new SqlCommand("Insert into pre VALUES('" + rno.Text + "','" + papercode.Text + "','" + paperid.Text + "','" + dat.Text + "','" + ccode.Text + "','" + state.ToString() + "','" + sem.Text + "','" +textBox1.Text + "','" + c.ToString() + "')", con); com.ExecuteNonQuery(); con.Close(); textBox1.Clear(); rno.Clear(); papercode.Clear(); paperid.Clear(); dat.Clear(); ccode.Clear(); sem.Clear(); MessageBox.Show("Entries Updated Successfully"); } } }

Code for Post Implemenation Module

using System;using System.Collections;using System.Collections.Generic;using System.Text;using System.Drawing;using System.Drawing.Drawing2D;using System.Data;using System.IO;using System.Drawing.Imaging;using System.Windows.Forms;using System.Data.SqlClient;using System.Data.Sql;using System.Data.SqlTypes;using System.ComponentModel;

namespace BarTry{ public partial class Post : Form { public Post() { InitializeComponent(); }

private void Post_Load(object sender, EventArgs e) { groupBox1.Hide(); groupBox2.Hide();

39 | P a g e

Page 40: Mini Pro

}

private void button1_Click(object sender, EventArgs e) { SqlConnection connect = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); SqlCommand command = new SqlCommand ("select * from pre where fldCode='" + textBox1.Text + "'", connect); SqlDataAdapter dp = new SqlDataAdapter(command); DataSet ds = new DataSet(); dp.Fill(ds); int i = ds.Tables[0].Rows.Count; if ((i == 0)) { MessageBox.Show("No such answer sheet exists in database"); } else { groupBox1.Show(); groupBox2.Show();} if (i == 1) { String rno = ds.Tables[0].Rows[0][0].ToString(); String course = ds.Tables[0].Rows[0][8].ToString(); String pid = ds.Tables[0].Rows[0][2].ToString(); String pcode = ds.Tables[0].Rows[0][1].ToString(); String ccode = ds.Tables[0].Rows[0][4].ToString(); String sem = ds.Tables[0].Rows[0][6].ToString(); String date = ds.Tables[0].Rows[0][3].ToString(); String status = ds.Tables[0].Rows[0][5].ToString(); r_no.Text = rno; textBox2.Text = course; textBox3.Text = pcode; textBox4.Text = pid; textBox5.Text = ccode; textBox6.Text = sem; textBox8.Text = date; textBox7.Text = status; } }

private void groupBox1_Enter(object sender, EventArgs e) {

}

private void fillByToolStripButton_Click(object sender, EventArgs e) {

}

private void r_no_TextChanged(object sender, EventArgs e) {

}

private void button2_Click(object sender, EventArgs e)

40 | P a g e

Page 41: Mini Pro

{ SqlConnection con = new SqlConnection("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); con.Open(); SqlCommand com = new SqlCommand("Insert into post VALUES('" + textBox1.Text + "','" + r_no.Text + "','" + textBox3.Text + "','" + textBox9.Text + "','" + textBox7.Text + "','" + textBox6.Text + "')", con); com.ExecuteNonQuery(); con.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox9.Clear(); r_no.Clear(); MessageBox.Show("Entries Updated Successfully"); } } }

Code for Result Generation

using System;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.Sql;using System.Data.SqlClient;using System.Data.SqlTypes;

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { GridView1.Visible = false; Label3.Visible = false; Label4.Visible = false; } protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); SqlCommand com = new SqlCommand

41 | P a g e

Page 42: Mini Pro

("select * from Register where rno='" + TextBox1.Text + "'", con); SqlConnection connect = new SqlConnection ("Data Source=HARSHIT-PC\\SQLEXPRESS;Initial Catalog=BARCODE;Integrated Security=True"); SqlCommand command = new SqlCommand ("select * from post where rno='" + TextBox1.Text + "'", connect);

SqlDataAdapter da = new SqlDataAdapter(com); SqlDataAdapter dp = new SqlDataAdapter(command); DataSet ds = new DataSet(); DataSet dset = new DataSet(); dp.Fill(ds); da.Fill(dset); int i = ds.Tables[0].Rows.Count; int j = dset.Tables[0].Rows.Count; if ((j == 0)) { Response.Redirect("Error.aspx"); } else { String student = dset.Tables[0].Rows[0][2].ToString(); String father = dset.Tables[0].Rows[0][3].ToString();

Label1.Text = student; Label2.Text = father;

} if ((i == 0)) { Response.Redirect("Error.aspx"); }

else { Label3.Visible = true; Label4.Visible = true; GridView1.Visible = true; } }}

42 | P a g e

Page 43: Mini Pro

TESTING

Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing also provides an objective, independent view of the software to allow the business to appreciate and understand the risks at implementation of the software. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs.

Software testing can also be stated as the process of validating and verifying that a software program/application/product:

1. meets the business and technical requirements that guided its design and development;

2. works as expected; and3. can be implemented with the same characteristics.

The testing of the software is done under various circumstances and considering different modules or parts of the software disintegrated into units or integrated as a software, etc.

The testing performed for this software are :-

Unit Testing

Each module as described earlier was tested keeping it in isolation form other modules. Each of the 5 modules were tested as a single unit for any ambiguity or errors.

System Testing

The unit tested modules were integrated together an a software as a whole was implemented and validations for redundancy,etc were applied.

α Testing

Alpha testing is the software prototype stage when the software is first able to run. It will not have all the intended functionality, but it will have core functions and will be able to accept inputs and generate outputs. An alpha test usually takes place in the developer's offices on a separate system.

43 | P a g e

Page 44: Mini Pro

Just as when the software started functioning to the needs it was tested for the exceptions and errors (logical and syntactical) so as the desired outcome is achieved.

β Testing

The software has reached "beta" stage when it is operating with most of its functionality, and is ready for user feedback.This was done after making an executable of the software and implementing it on a host other than on which it was developed, ie: friends system and was checked for the unexpected situations or conditions as viewed from the point of view of globalisation and user friendliness and environment.Then it was corrected at our site and was tailor made in such a way it works in different types of environment.

Acceptance Testing

Usually the end users who will be using the applications test the application before ‘accepting’ the application.This type of testing gives the end users the confidence that the application being delivered to them meets their requirements.This testing also helps nail bugs related to usability of the application. This was done by delivering the entire integrated set of modules a complete software package to the project in-charge and various test cases were satisfied as per user requirements.

44 | P a g e

Page 45: Mini Pro

IMPLEMENTATIONThis activity deals with bringing out the desired software into the real application for which it has been developed.

USER INTERFACE DESIGN

The software has been developed in such a manner that it provides a user friendly GUI to the user. It provides an efficient environment to the user so that user can work on it without much of training. Illustrations of the screen shots are elucidated below.

1. Welcome Screen

The first interactive form that user encounters just as the application is launched displays a Menu to the user for performing different operations:-

Registration of New Student Generating Barcode for the Answer Sheet Making Pre- Evaluation Entries Post Evaluation Entries Checking Result against a Students Roll number

45 | P a g e

Page 46: Mini Pro

2. Registration of New Student

The information related to student going to appear in the exam is entered in this form. The whole description of the student is entered here and on the click of submit button the information entered is saved in the database.

46 | P a g e

Page 47: Mini Pro

Validation

Four type of validation has been used in this software.

a. Redundancy check validation.b. Numbers only.c. Characters and Space only.d. Entries not completed.

i. Redundancy check :

If the enrollment number entered by the user has already been registered then a message box saying enrollment number already registered is displayed and new entry is to be done to save the entries in the database.

47 | P a g e

Page 48: Mini Pro

ii. Entries not completed:

If all the entries of the form is not filled by the user before pressing the submit button then a message box saying entries not completed is displayed. The entries will be saved in the database when only if all the entries have been filled.

48 | P a g e

Page 49: Mini Pro

iii. Numbers Only :

If the entries that must contain numbers only is entered with any alphabet or special character the a message box saying only integers are allowed is displayed and the wrong entry is to be reentered.

49 | P a g e

Page 50: Mini Pro

iv. Alphabets and space only:

If the entries that must contain alphabet and space only is entered with any number or special character then a message box saying only Alphabet and space are allowed is displayed and the wrong entry is to be reentered.

50 | P a g e

Page 51: Mini Pro

If everything is correct and entries are made correctly and properly validated then entries move to the database and a message is displayed that database updated successfully and the entries are reset.

51 | P a g e

Page 52: Mini Pro

3. Barcode Generator

i. Generating Barcode : The user encounters this form after selecting the generate barcode for the answer sheet option from the menu. The unique code of the answer sheet is entered here and then the encoding technique for generating barcode is selected. The barcode is then generated, user can also embed the label along with the barcode image.

52 | P a g e

Page 53: Mini Pro

ii.)Saving Barcode image at desired location and in the database

After the barcode is generated user can save the image of the barcode in GIF, JPEG and PNG format at the desired disk location by clicking on the save image button. Finally user saves the barcode generated along with the unique code in the database by clicking on save button.

53 | P a g e

Page 54: Mini Pro

4. Pre Evaluation Entries

This form allows the user to enter the pre evaluation entries corresponding to a particular answer sheet. The answer sheet code is entered in the barcode id text field.

i . If the code entered in the barcode id text field does not match with the entries existing in the database then an error message is issued that “ No such answer sheet exist in the database”.

54 | P a g e

Page 55: Mini Pro

ii. If a match is found in the database then a form is displayed in which all the pre evaluation entries such as roll number, course, paper code, semester etc are entered. Finally the data entered is saved in the database on the click of submit button of the pre evaluation entry form.

5. Post Evaluation EntriesThis form allows the user to enter the post evaluation entries. The unique code of the answer sheet whose post evaluation entries are to be done.

i. If the answer sheet number that has been entered in the barcode id text field does not exist in the database then an error message “ No such answer sheet exist in the database ” displayed.

55 | P a g e

Page 56: Mini Pro

ii. If the answer sheet number that has been entered in the barcode id text field d exist in the database then all the pre evaluation entries are displayed, a text field in which marks are to be entered is also displayed. The marks are then entered and saved in the database by clicking on the submit button.

6. View Result

56 | P a g e

Page 57: Mini Pro

i. If the user wants to view the result of any candidate roll number of that student can be entered here, if the roll number exists in the database then the result is generated.

ii. If the roll number does not exist in the database then an error message is issued.

57 | P a g e

Page 58: Mini Pro

DATABASE STRUCTURE

Four tables have been used :1. User table.2. Registration table.3. Pre evaluation table.4. Post evaluation table.

Each module of the software interacts with its respective tables in a smooth manner there by ensuring the smooth running of the software.

i. User Table:

Table 1 :tblUsers

This table contains the unique code of the answer sheet and their corresponding barcode image. The code of the answer sheet has been defined as the primary key here.

58 | P a g e

Page 59: Mini Pro

ii. Registration:

Table2 : Register

It contains the detail of the student appearing in the examination. Enrollment number has been defined as the primary key of the table.

iii. Pre Evaluation:

Table 3: pre

It holds the pre evaluation details of every answer sheet. Code of the answer sheet defined in the user table is again used here and defined as the primary key of the table.

59 | P a g e

Page 60: Mini Pro

iv. Post Evaluation

Table 4: post

The table holds the post evaluation data along with some pre evaluation entries inherited from the pre evaluation table. The code has been defined as the primary key of the table.

60 | P a g e

Page 61: Mini Pro

Deliverable Items –

i. Setup for the examination management system.ii. Programmed documentation.

iii. Instruction for how to use the software.

61 | P a g e

Page 62: Mini Pro

Milestone Description – The following milestones or check points mark the completion of some phase of project implementation-

i. Information gathering or feasibility study –Framing of project plan, resources required (manpower, software and hardware) and cost estimation for different stages of development.

ii. Analysis – Study and gather information from the resources that provide the information about the development of a Barcode Generator and a general examination management system.

iii. Design – In this phase the front-end graphical user interface is created that will interact with the user.

iv. Coding – It include the back-end coding for the design that provides proper working and output to the user.

v. Testing – The application is tested to see if it works according to our requirement or not. Several types of testing are-

Unit Testing System Testing α-Testing β-Testing Acceptance Testing

vi. Maintenance – This phase includes the modifications in the software after it is delivered to the user as it may meet few ambiguous situations, they have to be rectified and removed.

62 | P a g e

Page 63: Mini Pro

Work Breakdown Structure Organization Chart

63 | P a g e

Page 64: Mini Pro

Work Breakdown Structure Worksheet

Work ID Work Name Description Complexity

1.0 Barcode based examination management system.

A software for automating examination process of university.

Medium

1.1 Project Management

1.1.1 Scope Management Define Specific Boundaries for Software and Manage them throughout the development techniques

Medium

1.1.1.1 Initiation The Process of formally recognizing the need of the software and analyzing similar software on the web

1.1.1.1.1 Scope Statement Documentation of Scope

1.1.1.1.2 Problem Statement Documentation of Problem

1.1.1.2 Scope Planning The process of developing a written Scope Management Plan as the basis for future project decisions

1.1.1.2.1 Scope Management Plan

Documentation of Detailed Scope Management Plan

1.1.1.3 Scope Definition The process of subdividing the major project deliverables into smaller, more manageable components

Medium

1.1.1.3.1 WBS(Work Breakdown Structure)

Broad Categorization of Work to be done during software development

1.1.1.4 Scope Verification The process of formally accepting the software scope by the stakeholders clients.

1.1.1.4.1 Formal Acceptance Documentation of Scope Approval

1.1.1.5 Scope Change Control The process of controlling changes to project scope

1.1.1.5.1 Scope Changes, Corrective Action and Lessons Learned

Documentation of any Scope Changes occurs during software development for future reference

1.1.2 Schedule Management Estimation of Efforts in terms of time ,

High

1.1.2.1 Schedule Estimation Estimation of time frame needed to complete the project

1.1.2.1.1 WBS Update Detailed Documentation of Program, Project, Tasks, Activities and Work

64 | P a g e

Page 65: Mini Pro

Work ID Work Name Description Complexity

Packages

1.1.2.1.2 Schedule Estimation Documentation for Schedule Estimation Calculations

1.1.2.1.3 Scheduling Control Detailed Documentation for Schedule Updates, Corrective Actions and Lessons Learned for future reference

1.2 Feasibility Study

1.2.1 Business Problem Definition

Detailed Description of Problem Medium

1.2.2 Feasibility Report Detailed documentation of feasibility study

Medium

1.3 Analysis

1.3.1 Functional Requirement Define Behavior and functionalities of the Proposed Software

Medium

1.3.2 Non Functional Requirement

Define Qualities(Constraints) for the Proposed Software

Medium

1.3.3 Analysis Report Detailed Documentation of analysis phase

High

1.4 Design

1.4.1 Modeling Includes Designing of all types of UML diagrams

High

1.4.1.1 Usage Modeling The Process to identify how people work with the proposed system

1.4.1.2 Process Modeling The Process to identify how processes will interact

1.4.1.2.1 Data Flow Diagrams Is a graphical representation of the "flow" of data through the software

1.4.1.3 Entity Relationship Diagram

Abstract and conceptual representation of data.

1.4.2 User Interface Designing

Mainly includes form Designing Medium

1.4.2.1 Standards Documentation

Documentation of standards adopted for designing User Interface

1.4.2.2 Forms Designing The Process of creating User interface considering all standards.

1.5 Develop

1.5.1 Software Coding Coding with high level of standards Medium

1.5.2 Software Debugging Debug code for proper functionality Medium

1.5.3 Unit Testing Software verification and validation method in which a programmer tests

Medium

65 | P a g e

Page 66: Mini Pro

Work ID Work Name Description Complexity

if individual units of source are correct.

1.5.4 System Testing Testing conducted on a complete, integrated system.

Medium

1.5.5 α Testing Testing conducted at the Developer sight by end users.

Medium

1.5.6 β Testing Testing conducted at the end users site

Medium

1.5.7 Acceptance Testing End-user testing, Site testing Medium

1.6 Implement

1.6.1 Implementation Planning

Detailed plan how to implement the developed software

Medium

1.6.1.1 Plan Documentation Detailed documentation of implementation plan

1.6.2 User Support Documentations

Generalized illustrative user manual Low

1.6.3 Implementation Testing and verification

Verification and validation of developed software after implementation

Medium

1.6.3.1 User Acceptance Report

Acceptance of the software from the user.

1.6.3.2 Providing Deliverables Providing the deliverable items to the user.

1.6.4 Implementation Performance Monitoring

Constant monitoring of the implemented software for performance enhancement

Medium

1.7 Infrastructure

1.7.1 Facilities Work environment Medium

1.7.2 Install Development Hardware and Software

Install all the software and hardware needed for the software development

Medium

66 | P a g e

Page 67: Mini Pro

CRITICAL PATH

Critical path generated by CPM (Critical Path Method) is a mathematically based algorithm for scheduling a set of project activities , the essential technique for using CPM is to construct a model of the project that includes th following

1. A list of activities required to complete the project

2. The time each activity takes for completion

3. The dependencies between the dependencies.

ACTIVITIES PRECEDENCE DURATION 1. Planning and Analysis (A) - 182. Design (B) - 153. Coding and Testing (C) B 264. Documentation (D) A 85. User Training (E) D 26. Installation and Test System(F) C,E 2

67 | P a g e

10 0 0

Page 68: Mini Pro

SCHEDULE ESTIMATIONCost and Schedule Estimation Equations and Related fields

1.      

1.

Effort=A*EAF*KLOCB

Where

A:      Constant, used to capture the multiplicative effects on effort with projects of increasing size

          Calibrated to 2.94

B:      Scale Factor, accounts for the relative economies or diseconomies of scale

          Encountered for software projects of different sizes.

          Calculated as: B=.91+.01*∑5i SFi

          Where SF: COCOMO’s 5 Scale Drivers

EAF:  Effort Adjustment Factor

           Calculated as :EAF= ∏17i Wi          

Where W: weights of  COCOMO’s 17 Cost Drivers

ESLOC: Effective Thousand Lines Of Code.

 2.        

Schedule=[3.67*Effort(.28+.2*(B-.91))]*Sched%/100

Where

Sched%: Schedule acceleration

3.

Cost=Salary*Staff*Schedule

Where

Salary= Salary of engaged employees

Staff= workforce needed

Schedule= Months needed to complete the project

68 | P a g e

Page 69: Mini Pro

Driver Very Low Low Nominal High Very High Extra High

Scale Drivers            

Precedentedness  (PREC) 6.20 4.96 3.72 2.48 1.24 0.00

Development Flexibility (FLEX) 5.07 4.05 3.04 2.03 1.01 0.00

Architecture/Risk Resolution (RESL) 7.07 5.65 4.24 2.83 1.41 0.00

Team Cohesion (TEAM) 5.48 4.38 3.29 2.19 1.10 0.00

Process Maturity (PMAT) Weighted average of

“Yes” answers

to CMM Maturity Questionnaire

Cost Drivers            

Analyst Capability (ACAP) 1.42 1.19 1.00 0.85 0.71 NA

Application Experience (APEX) 1.22 1.10 1.00 0.88 0.81 NA

Programmer Capability (PCAP) 1.34 1.15 1.00 .88 .76 NA

Platform Experience (PLEX) 1.19 1.09 1.00 0.91 0.85 NA

Language and Tool Experience (LTEX) 1.20 1.09 1.00 0.91 0.84 NA

Personnel Continuity (PCON) 1.29 1.12 1.00 0.90 0.81 NA

Use of Software Tool (TOOL) 1.17 1.09 1.00 0.90 0.78 NA

Multisite Development (SITE) 1.22 1.09 1.00 0.93 0.86 0.80

Development Schedule (SCED) 1.43 1.14 1.00 1.00 1.00 NA

Execution Time (TIME) NA NA 1.00 1.11 1.29 1.63

Main Storage (STOR) NA NA 1.00 1.05 1.17 1.46

Platform Volatility (PVOL) NA 0.87 1.00 1.15 1.30 NA

Required Reliability (RELY) 0.82 0.92 1.00 1.10 1.26 NA

Database Size (DATA) NA 0.90 1.00 1.14 1.28 NA

Product Complexity (CPLX) 0.73 0.87 1.00 1.17 1.34 1.74

Required Reusability (RUSE) NA 0.95 1.00 1.07 1.15 1.24

Documentation (DOCU) 0.81 0.91 1.00 1.11 1.29 1.63

69 | P a g e

Page 70: Mini Pro

             

Table 1: Drivers and corresponding Weights

 

 

 

 

 

 

 

 

Key Process Area Almost Always (>90%)

Often (60%-90%)

About Half (40%-60%)

Occasionally (10%-40%)

Rarely If Ever (<10%)

Doesn’t Apply

Don’t Know

Requirement Management √            

Software Project Planning √            

Software Project Tracking and Oversight

      √      

Software Subcontract Management

    √        

Software Quality Assurance

  √          

Software Configuration Management

    √        

Organization Process Focus

  √          

Organization Process Definition

  √          

Training Program   √          

Integrated Software Management

      √      

70 | P a g e

Page 71: Mini Pro

Software Product Engineering

  √          

Intergroup Coordination   √          

Peer Reviews       √      

Quantitative Process Management

    √        

Software Quality Management

    √        

Defect Prevention   √          

Technology Change Management

  √          

Process Change Management

    √        

Table 2: PMAT Calculation Factors

 

Schedule and Effort Estimation Calculations:

PMAT=5-[∑18i=1(((KPA%)i/100)*5/18)

PMAT=2.2233

B=.91+.01*∑5i SFi

B=1.0997

Effort=A*EAF*KLOCB

Kilo Line Of Code=(6950/1000)=6.95

A=2.94

EAF=.87

 

Effort≈21.56 Person Months

  Schedule=[3.67*Effort(.28+.2*(B-.91))]*Sched%/100

71 | P a g e

Page 72: Mini Pro

Sched% = 0.5 (Acceleration)

Schedule=4.91 Months≈5 Month

 

 

Cost Estimation Calculations:

 

Staff= 2

Schedule=2.5 months

Cost= Salary x 2 x 2.5

 

 

Conclusion:

Effort Needed Schedule

21.56 person months 2.5 months

Table 3: Conclusion Table

 

Phase Percentage of schedule Schedule in months

Project Management +Feasibility Study + Analysis 35% .875(26 days)

Design and Development 55% 1.375(41 days)

Implementation 10% .25(8 days)

Table 4: Phase Distribution of Efforts

 

SLOC Attribute Included Excluded

What is included or excluded    

72 | P a g e

Page 73: Mini Pro

Executable statements √  

Non executable data declaration statements and

compiler directives

√  

Comments, continuation lines, banners, blank

lines, instantiated SLOC, and nonblank spacers

  √

How lines are produced    

Manually/hand-programmed SLOC √  

Lines developed for use as input to a source code generator √  

Lines generated as output from a source code generator a   √

Lines converted with automated code translators b √  

Copied, reused, or modified lines of code c √  

Deleted lines of code (rework percentages of remaining SLOC account for the work to make the program execute correctly without deleted lines)

  √

Origins of lines    

New lines developed from scratch √  

Preexisting lines taken from a prior version, build, or release √  

Invocation statements or preexisting lines requiring rework from COTS or other off-the-shelf packages; rework percentages need to be calculated

√  

Invocation statements for modified vendor supplied or special support libraries, but not

unmodified library code itself

√  

Modified vendor-supplied or special support libraries, commercial libraries, reuse libraries, or other software component libraries; rework percentages should be calculated for modifying these lines

√  

Lines that are part of an unmodified vendor supplied operating system or utility or other

Non developed code

  √

End usage of each line    

Lines that are in or part of primary product √  

Lines external to or in support of primary product only if part of final or deliverable program √  

Lines external to or in support of primary product but are not deliverable; any other non deliverable lines

  √

a:  Software from a source code generator is estimated best via function point sizing, not SLOC. Some people estimate generated lines by counting the total number of generated lines and applying reuse factors to them to reduce the effective size that will be used by the cost model.  

73 | P a g e

Page 74: Mini Pro

 

b:  These lines should be considered as pre-existing lines of code and the amount of rework required on the translated code should be defined through the use of rework percentages.

c:  These lines should be considered as pre-existing SLOC.

Table 5:SEI SLOC Counting Standards

HARDWARE AND SOFTWARE REQURIMENTS

Equipment Configuration –

Hardware Used-Intel Core 2 Duo, 2.40 GHZ4GB DDR RAM320GB Hard Disk14.1 inch Screen

Operating System – Microsoft Windows 7 Home Premium

Software used for Development – Microsoft Visual Studio 2008

Implementation Languages –

The software is developed in ASP.net implemented using C#.net as language along with .NET Framework 3.5.

74 | P a g e

Page 75: Mini Pro

CONCLUSION

This software provides a way of handling University Examination System which helps an University by improving operational efficiency, saving time, reducing error and cutting cost .The Barcode has different uses which enables different processes to be processed quickly, efficiently, and accurately. The project has been developed using modern tools and technology that makes the product more presentable, attractive, interactive and easy to use thus enabling the university using it to work in a smooth and healthy manner.

75 | P a g e

Page 76: Mini Pro

FUTURE ENHANCEMENTS

Implementation of hardware device Barcode Scanner would have made the software more effective.

A login system could have been provided so that only few of the staff can use the software.

Use of AJAX tabs could have given entirely different look to the software which being more proficient.

Barcode could have been generated against random serialized numbers for the answer sheets.

76 | P a g e

Page 77: Mini Pro

REFRENCES

i. Reference 1: ASP.NET Unleashed 3.5 by Stephen Walther.

ii. Reference 2: Guidelines for GUI design inUse.

iii. Reference 3: www.w3schools.com

iv. Reference 4: www.photoshoptutorials.ws

v. Reference 5: www.ajax.net-tutorials.com

vi. Reference 6: en.wikipedia.org

77 | P a g e