Sunteți pe pagina 1din 68

Check Post Management System

2010

Birla institute of technology


CHECK POST MANAGEMENT SYSTEM
With the help of check post management system BTA will be able to keep the tracks of record in its central database for all the check post in the State. This will generate a number of queries from the database and will help the state administration to take the effective and efficient decision on time

Check Post Management System

Birla institute of technology,Ranchi


Department of Computer Science & Engineering

PROJECT REPORT ON

Check Post Management System


Submitted for the partial fulfillment of the requirement for the award of the Degree

Bachelor of Engineering (B.E.) 2010 Of Birla institute of technology,Ranchi By


Palak sinha Smita kumari Ravi Kumar Shreya shree

Under the Guidance Of Mr. Anmol sinha

Check Post Management System

Check Post Management System

CHAPTER 1 INTRODUCTION

1.1 BRIEF DESCRIPTION OF THE PROJECT Bhopal Transport Authority (BTA) is one of the major governing bodies of State Madhya Pradesh (INDIA). BTA is established for the purpose of transportation administration in the state for the effective administration and efficient management at the check posts around the state it wants a web based Check post management system. 4

Check Post Management System

CHAPTER 2 SOFTWARE REQUIREMENT SPECIFICATION

Check Post Management System

2.1 INTRODUCTION 2.1.1 Purpose: This document describes the software requirements for a Check Post Management System. It is intended for the designer, developer, maintainer and users of the Transport system based.

2.1.2 Scope The software product is a self-contained index-based Check Post Management System that indexes all information of transport System in any location and provides users with the ability to search necessary details within a few seconds. It returns blazingly fast search results to users, even when large numbers of information are present.

2.2 REQURIMENTS ANALYSIS

Business Requirements With the scope of most Networks based, search is a key tool used by admin and users to find information. Users should not be presented with complex search interfaces. Instead, search should work like magic, so that users can select their option in a few words, hit search, and find the information they are looking for. Faceted Search or searching according to category will enhance the relevancy of search results.

Check Post Management System

2.2.2 Functional Requirements The functional requirements are as follows:Managing Details: There is a graphical user interface in the form of individual application based FORM having predefined options where user can perform operation like add, delete, update and view information related to vehicles, check posts, users. Purpose Providing quick, reliable and quality adding information at different location of Network based. Inputs For Vehicle

o Vehicle Type: Type of the vehicle, eg 2/3/4 wheeler o Vehicle Name: name of the vehicle, e.g., car,bus,etc o Vehicle No: Number Assigned By the Transport Authority o Load Type: Heavy/Medium/Light o Driver Name: Name of the Vehicle Driver o Owner Name: Name of the Vehicle owner o Traveling From: from where the vehicle is coming. o Destination: The place to where the vehicle is going o Date: The present system date
For Check Post o Check Post Name: Type of the name of

check post o Check Post Location : Type the name of location where check post is situated
7

Check Post Management System


o Check Post No: Number Assigned By

the Transport Authority o User Name: Name of ser Assigned By the Transport Authority
For User o User Name: Name of ser Assigned By

the Transport Authority o User Password: Password for individual users. o Check Post No: Number Assigned By the Transport Authority for that user
Operations It includes three operations:-

Add details Update details o View details o Delete details


o o Output The operation results will successfully updated in data base if there is no any type of errors. If there is any type of error in operation a failure message will display on alert screen. Searching Even if we have indexed information our effort is wasted unless it pays off by providing a reliable and fast way to find information in a click. Purpose Providing quick, reliable and quality search solution to different users of Network based. Inputs Search keywords. Operations It includes searching operations:8

Check Post Management System


o o o o o o o View All vehicle Records. View All User Details. View All Check Details. Query By Load Type. Query By Vehicle Number. Query By Vehicle Type Query By Check Post Number

o Query By Date

Output The search results will consist of a tabular based on the information between the titles tags, and under this will be able to see a short extract of details in a single window that includes all details about used searched keyword.

2.2.3 User Requirements Users should be able to add, delete, upadate, view details of vehicles, check post, users. Users should be able to do faceted searching. User must get technical papers, Project Reports, Seminar details prepared by their Admin on the Network based. Admin should be able to all operation maintain in above context. .

Check Post Management System

CHAPTER 3 SYSTEM ANALYSIS & DESIGN

10

Check Post Management System

3.1 INTRODUCTION TO DESIGN APPROACH The design document is used to provide flexible template and guideline for the specification of software design. To build complex systems, the developer must abstract different views of the system, build models using precise notations, verify that the models satisfy the requirements of the system, and gradually add details to transform the models into implementation. The design serves the following purposes: Testing a physical entity before building it: Physical models are usually cheaper than building a complete system and enable flaws to be corrected at an early stage of the software development. Communication with the client: The models built according to the requirements of the client can be shown to the client and changes can be accommodated if required. Visualization: Models reduce complexity by separating out small number of important things to deal with at a time. The design should provide: Enough information and understanding about the objective of the project and the implementation. Procedure to implement the functionality described in the requirement specification. 3.2 SOFTWARE ENGINEERING APPROACH

11

Check Post Management System


Software engineering is a layered technology. The foundation for software engineering is the process layer. Software engineering process is the glue that holds the technology layers together and enables rational and timely development of computer software. Process defines a framework that must be established for effective delivery of software engineering technology. The software process forms the basis for management control of software projects and establishes the context in which technical method are applied, work products (models, documents, data, reports, forms, etc.) are produced, milestones are established, quality is ensured and change is properly managed. Software engineering method provide the technical How tos for building software. Methods encompass a broad array of tasks that include communication, requirements analysis, design modeling, program construction, testing and support. Software engineering relies on a set of basic principles that govern each area of the technology and include modeling activities and other descriptive technique. A process framework establishes the foundation for a complete software process by identifying a small number of framework utilities that are applicable to all software projects, regardless of their size or complexity. In addition, the process framework encompasses an asset of umbrella activities that are applicable across the entire software process. Each framework activity is populated by a set of software engineering actions a collection of related tasks that produce a major software engineering work product. The following generic process framework is applicable to our software project: Communication: These framework activities involve heavy communication and collaboration with the customer (and other stack holders) and encompass requirements gathering and other related activities. 12

Check Post Management System

Planning: This activity establishes a plan for the software engineering work that follows. It describes the technical asks to be conducted, the risks that are likely, the resources that will be required, the work product to be produced and a work schedule.

Modeling: This activity encompasses the creation of models that allow the developer and customer to better understand software requirement and the design that will achieve those requirements.

Construction: This activity combines four generation (either manual or automated) and the testing that is required uncovering errors in the code.

Deployment: The software (as a complete entity or as a partially completed increment) is delivered to the customer who evaluates the delivered product and provides feedback based on the evaluation.

3.2.1 Process Model Used Process models define a distinct set of activities, actions, tasks, milestones and work products that are required to engineer high quality software. These process models are not perfect, but they do provide a useful roadmap for software engineering work. Software engineers and the managers adapt a perspective process model to their needs and then follow it. In addition, the people who have requested the software have a role to play as the process model is followed. Process model provides stability, control and organization to an activity that can, if left uncontrolled, becomes quite chaotic. The process models are also referred to as Rigorous process 13

Check Post Management System


models because they often encompass the capability suggested by CMMI. The terminology and detail of each process model deer, but the generic framework activities remain reasonably consistent. From the point of view of the software engineer, the work products are the programs, documents and data that are produced as a consequence of the activity and tasks defined by the process. There are a number of software process assessment mechanism that enable organizations to determine the Maturity of their software process. However, the quality, timeliness and long term viability of the product you built are the best indicators of the efficacy of the process that you use. The project follows a Waterfall Model or Linear Sequential Model, as shown below:

Fig 1.2: The Waterfall Model of Software Development It follows the following steps: Requirement Analysis

It involves gathering information about the current existing tools and techniques that can be used for development of Network based check post management system and to decide which one is 14

Check Post Management System


the best one to be followed. Also to decide onto the right programming language that can be used to implement the algorithm. Design

It involves drawing a well established design which will involve various DFDs, i.e., Data Flow Diagrams. They show how the data flow takes place in the system. It also involves various Use Case and Class Diagrams which show the interaction of users with the system and behavior of various classes. Many other diagrams such as sequence diagrams and collaboration diagrams are also drawn. Coding

This phase involves actual coding part. It is done mostly in java but some modules are designed in servlets and user interface is developed using JSP servlets. The most important part of this phase is the documentation. A well documented code is prepared. Testing

After the coding part is over, various test cases are prepared to test the deliverable web application. It includes various testing such as Integration Testing and Alpha testing,

3.3 DESIGN DIAGRAMS

Activity Diagram:Activity diagrams provide a way to model the workflow of a business process. You can also use activity diagrams to model code-specific 15

Check Post Management System


information such as a class operation. Activity diagrams are very

similar to a flowchart because you can model a workflow from activity to activity. An activity diagram is basically a special case of a state machine in which most of the states are activities and most of the transitions are implicitly triggered by completion of the actions in the source activities. An activity diagram is typically used for modeling the sequence of activities in a process, whereas a state chart is better suited to model the discrete stages of an objects lifetime.

Home Page

Home Page has Some Introductory information and login form on it

User Logs in as User /Admin 16

Check Post Management System

User Enters in user-homepage

User

Use r=?

Admin

Admin Enters in admin-

Add New option is available to insert the vehicles record On Clicking the Add New JSP form appear

Add, Update, Delete, View option is available

Similar process as of

If Option=Ad d

User Submits the Record and Message appears record added is redirected to the usersuccessfully or homepage If Option= ?

Delete New JSP form appears asking for Vehicle no

View

If user wishes he can Logout by clicking the Logout Link

Admin provides vehicle no, Clicks Ok. New JSP form appears with the records of the given vehicle and asks for confirmation Admin confirms by clicking Delete. Update

New JSP page appears having different Query

New JSP form appears asking for Vehicle no

Admin provides vehicle no, Clicks Ok. New JSP form appears with the records of the given vehicle and asks for confirmation Admin confirms by clicking Update. 17

Check Post Management System

IfIf Admin wishes he cans Logout by clicking the Logout Link . Admin wishes he can Logout by clicking the Logout Button

Web Page Displays Message: Successfully Logged out

Fig 3.1 Activity Diagram

18

Check Post Management System

CHAPTER 4 SOFTWARE IMPLEMENTATION

19

Check Post Management System


4.2 Installing Oracle We have found that Dell 5000 notebooks using SpeedStep technology need to have SpeedStep disabled during the Oracle installation. We recommend the disabling of SpeedStep during an Oracle installation if you have this notebook model. It is possible this problem may occur with other notebook models using SpeedStep. We have not seen this problem with IBM Thinkpads. Installation User Name To install Oracle software, you must login to your computer with the same User name as you will to use the software. In addition, that User name must be a member of the administrators group. Check Virtual Memory Settings You need a minimum of 768 MB.. See Appendix A on page 56, for operating system specific instructions on changing virtual memory. Check Free Disk Space You need 3.5GB of disk space to install Personal Oracle 10g, including 140 MB on the system drive (usually C:), with the rest of the space on any single uncompressed drive. Oracle documentation uses an additional 600 MB. Oracle Developer Suite 10g uses an additional 1.1GB. See Appendix B on page 58, for operating system specific instructions on checking disk space. RAM Requirements You need 512 MB minimum, 1024 MB is preferred. Right click on My Computer and choose Properties to determine your computers currently installed RAM. Step #1: Installing Personal Oracle 10g 1-1. Insert the Oracle 10g Database10.1. 1-2. Select the Install/Deinstall Products button. 1-3. The Welcome window opens. 1-4. Select Advanced Installation 1-5. Click the Next button. 1-6. The File Locations window opens. 1-7. Change the Destination Name to: OraHome10 1-8. Change the Destination Path to c:\oracle\product\10.1.0\OraHome10 NOTE: Adjust accordingly if you want to install Oracle on a drive other than C:. If you use a different destination path, please write it down. You will need to enter this path later during configuration. 1-9. Click the Next button. 20

Check Post Management System


1-10. The Select Installation Type window opens. 1-11. Select Personal Edition (804 MB). 1-12. Click the Next button. 1-13. You may see the following error message several times during your installation. Click the Continue button each time you see the message. 1-14. The Select Database Configuration window opens. 1-15. Select General Purpose. 1-16. Click the Next button. 1-17. The Specify Database Configuration Options window opens. Enter: a. Global Database Name: db1 b. SID: db1 c. Select Create database with samples schemas 1-18. Click the Next button 1-19. The Select Database Management Option window opens. 1-20. Click the Next button. 1-21. The Specify Database File Storage Option window opens. 1-22. Keep the default or select a different directory for your database files. 1-23. Click the Next button. 1-24. The Specify Backup and Recovery Options window opens. 1-25. Keep the default settings and click the Next button. 1-26. The Specify Database Schema Passwords window opens. a. Select Use the same password for all the accounts b. In the Enter Password and Confirm Password fields type johnheinz NOTE: You can choose a different password. Please remember the passwords you entered. You will need to reinstall the Oracle installation if you do not know the passwords for the SYS or SYSTEM accounts. 1-27. Click the Next button. 1-28. The Summary window opens. 1-29. Click the Install button. 1-30. The Install window opens. The time to install depends upon the speed and memory of your computer and may take more than 45 minutes. Dont be alarmed if the installer seems to be stuck at a certain percentage during the installation. You can also ignore additional windows that open during installation. During the Installation: a. The Configuration Assistant window appears. No action is required. b. The Database Configuration Assistant progress window appears. No action is required. 1-31. The Database Configuration Assistant window opens. 1-32. Click the OK button. 1-33. The Configuration Assistant window reappears. Take no action. 21

Check Post Management System


1-34. The End of Installation window will appear. 1-35. Click the Exit button 1-36. The Exit window will display. 1-37. Click the Yes button

4.2 Installing JAVA

This will guide you through the quite simple next-next-next installation of Java on Windows XP.

1.

Double click on file that was downloaded.

Michael: I clicked it and I got 'To Restart Installer, Please Refresh The Webpage' reply Name: Comment: Samantha: I also have the same problem.. reply Name: Comment: post comment or question Name: Comment:

2.

Accept agreement.

22

Check Post Management System

post comment or question

Name: Comment:

3.

Click Next and it will install for about 8 minutes.

post comment or question

Name: Comment:

4.

Unclick the Show the readme file checkbox and click Finish .

23

Check Post Management System

4.2 JDBC ODBC CONECTIVITY

You will need at least JDK 1.1 and of course, at least Microsoft Access 97 installed on your system. I assume that you know how to use Access 97, so I will now assume that you already have a MS Access database that you want to be able to access. Microsoft uses ODBC (Open Database Connectivity) drivers with most of their software. Java uses JDBC (Java Database Connectivity) drivers to connect to various databases. JDBC cannot access an ODBC database directly, instead you have to use the JDBC-ODBC Bridge driver. Before you can even touch Java, you need to tell the ODBC driver on your PC where your database is stored, so that it can create a data source that the JDBC-ODBC bridge driver can open. For Windows 9x systems, go to Control Panel and open the "ODBC Data Sources (32bit)" applet.

24

Check Post Management System


For Windows XP and (I think) Windows 2000 systems go to Control Panel and open the "Data Sources (ODBC)" applet. Important note for Windows XP users: If the Data Sources applet is not visible in Control Panel then you can still access "Data Sources" by going to Control Panel> Administrative Tools> Data Sources (ODBC). Alternatively, you can make the applet visible in Control Panel, by downloading PowerToys for Windows XP from Microsoft's Expert Zone When you install the Power Toys, ensure you install "TweakUI". Then fire up TweakUI, and go to Control Panel and tick "odbcc32.cpl" Setting up ODBC Now that you have the ODBC control panel applet open, you should be presented with the following information:

Next you have to add a data source that the JDBC-ODBC Bridge driver can open. To do so, click add. The following dialog will now appear:

25

Check Post Management System

Make sure you select "Microsoft Access Driver" as shown above and click finish. In the next screen enter a name for your data source - this is the name you will use in your Java code to open your database. Also enter a description. Use the "Select" button to browse for your database on your PC. Below is what you should now have:

Click Ok. Your database will now be in the list of data sources:

26

Check Post Management System

Java Phew! Now all the ground work has been done, we can get down to the fun stuff. The following part of the tutorial shows you how to verify that you have done the above properly, and how to create a table in your database. In your Java application, make sure you include the java.sql package. Here is some sample code: import java.sql.*; public class Temp { public static void main(String args[]) { Connection con; // The connection to the database. // The following code can throw errors, so they must be caught. try{ // First, tell Java what driver to use and where to find it. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Next, create a connection to your data source. // Specify that you are using the ODBC-JDBC Bridge. // And specify the data source from ODBC. con = DriverManager.getConnection("jdbc:odbc:Temp"); // Create an SQL statement. Statement stmt = con.createStatement(); // Execute some SQL to create a table in your database. // If the table already exists, an exception is thrown! 27

Check Post Management System


stmt.executeUpdate("CREATE TABLE COFFEES " + "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " + "SALES INTEGER, TOTAL INTEGER)"); } // Catch any exceptions that are thrown. catch(ClassNotFoundException e){ System.out.println(e.toString()); } catch(SQLException e){ System.out.println(e.toString()); } } }

4.2 DEPLOYEMENT OF CHECK POST MANAGEMENT SYSTEM It is assumed that there is an web browser in your computer already. Go on Desktop Click on Start Click on all programs Select internet Explorer And go on address bar and type

http: localhost: 8080:application1/homepage.jsp

28

Check Post Management System

CHAPTER 5 SOURCE CODE

5.1 Main Form 29

Check Post Management System


using using using using using using using using using using using using using using System.Collections; System.Collections.Specialized; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.IO; System.Threading; System.Net.Sockets; System.Diagnostics; System.Net.NetworkInformation; Trinet.Networking;

namespace lanscan { public partial class FormMain : Form { // ThreadQueue queue; ArrayList threads = new ArrayList(); ArrayList threads2 = new ArrayList(); int dgvindex; int featindex=-1; string[] featname = new string[10]; string[] featurl = new string[10]; public FormMain() { InitializeComponent(); // queue = new ThreadQueue(this); } private void btnGo_Click(object sender, EventArgs e) { statSearch.Text = "Please Wait..."; if (Search.maxsize != -1) { if (Search.maxsize < Search.minsize) { MessageBox.Show("Now that's a new one. Max size < Min size.\nDude, what were you thinking ? "); txtMinSize.Focus(); return; } 30

Check Post Management System


} Search.keyword = txtKeyword.Text.ToLower(); if (Search.keyword == "" && Search.filters == null) { MessageBox.Show("Nope. If you select 'All files and folders',\nthen you have to specify a keyword."); txtKeyword.Focus(); return; } prgbrSearch.Visible = true; DataTable table = new DataTable(); table.Columns.Add("File Name"); table.Columns.Add("Location"); table.Columns.Add("Size"); dgvResult.DataSource = table; for (int i = 0; i < dgvResult.Columns.Count; i++) { dgvResult.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } // queue.Start(); prgbrSearch.Style = ProgressBarStyle.Marquee; for (int i = 0; i < 4; i++) { if(Settings.ipranges[i*2]! =""&&Settings.ipranges[i*2+1]!="") { IP ipstart = new IP(Settings.ipranges[i * 2]); IP ipend = new IP(Settings.ipranges[(i * 2)+1]); for (IP ip = ipstart; ip <= ipend; ip++) { Thread thread = new Thread(new ParameterizedThreadStart(LocateSearch)); threads2.Add(thread); thread.Start(ip.ToString()); } 31

Check Post Management System


} } for (int i = 0; i < 15; i++) { if (Settings.individualips[i] != "") { Thread thread = new Thread(new ParameterizedThreadStart(LocateSearch)); threads2.Add(thread); thread.Start(Settings.individualips[i ].ToString()); } } txtKeyword.Text = ""; } private void txtKeyword_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode==Keys.Enter) { btnGo_Click(null, null); } } private void preferencesToolStripMenuItem_Click(object sender, EventArgs e) { FormConfigure frm = new FormConfigure(); frm.ShowDialog(); } private void advancedToolStripMenuItem_Click(object sender, EventArgs e) { FormAdvanced frm = new FormAdvanced(); frm.ShowDialog(); } private void UpdateThread() { try { TcpClient client = new TcpClient(Settings.serverip, 12345); NetworkStream ns = client.GetStream(); StreamReader sr = new StreamReader(ns); 32

Check Post Management System


string version = sr.ReadLine(); string[] cur = Application.ProductVersion.Split(new char[] { '.' }); string[] nw = version.Split(new char[] { '.' }); int i; for (i = 0; i < 4; i++) { if (Int32.Parse(cur[i]) < Int32.Parse(nw[i])) break; } if (i == 4) return; string message = sr.ReadLine(); string address = sr.ReadLine(); if (MessageBox.Show("New Version available : " + version + "\n\n" + message + "\n\nYour current version is :" + Application.ProductVersion + "\n\n" + "Do you want to download it?", "Update Lan Scan to " + version, MessageBoxButtons.YesNo) == DialogResult.Yes) { Thread thread = new Thread(new ParameterizedThreadStart(ProcessThread)); thread.Start(@"\\" + Settings.serverip + @"\" + address); threads.Add(thread); } sr.Close(); ns.Close(); client.Close(); } catch { } finally { threads.Remove(Thread.CurrentThread); } } private void FormMain_Load(object sender, EventArgs e) { if (File.Exists("ips.dat")) { FileStream fs = new FileStream("ips.dat", FileMode.Open); StreamReader sr = new StreamReader(fs); 33

Check Post Management System


for (int i = 0; i < 15; i++) { string s = sr.ReadLine(); if (s == "" || s == null) break; Settings.individualips[i] = s; } sr.Close(); fs.Close(); } if (File.Exists("filter.dat")) { FileStream fs = new FileStream("filter.dat", FileMode.Open); StreamReader sr = new StreamReader(fs); Settings.videoFilter = sr.ReadLine(); Settings.audioFilter = sr.ReadLine(); Settings.imagesFilter = sr.ReadLine(); Settings.codeFilter = sr.ReadLine(); Settings.softwareFilter = sr.ReadLine(); Settings.documentsFilter = sr.ReadLine(); sr.Close(); fs.Close(); } else { Settings.videoFilter = Default.videoFilter; Settings.audioFilter = Default.audioFilter; Settings.imagesFilter = Default.imagesFilter; Settings.codeFilter = Default.codeFilter; Settings.softwareFilter = Default.softwareFilter; Settings.documentsFilter = Default.documentsFilter; } if (File.Exists("advanced.dat")) { FileStream fs = new FileStream("advanced.dat", FileMode.Open); StreamReader sr = new StreamReader(fs); Settings.serverip = sr.ReadLine(); string s = sr.ReadLine(); Settings.searchDepth = Int32.Parse(s); Settings.threads = Int32.Parse(sr.ReadLine()); 34

Check Post Management System


Settings.pingTimeout = Int32.Parse(sr.ReadLine()); sr.Close(); fs.Close(); } else { Settings.serverip = Default.serverip; Settings.searchDepth = Default.searchDepth; Settings.threads = Default.threads; Settings.pingTimeout = Default.pingTimeout; } if (File.Exists("iprange.dat")) { FileStream fs = new FileStream("iprange.dat", FileMode.Open); StreamReader sr = new StreamReader(fs); for (int i = 0; i < 8; i++) { string s = sr.ReadLine(); if (s == "" || s == null) break; Settings.ipranges[i] = s; } sr.Close(); fs.Close(); } else { this.Show(); FormConfigure frm = new FormConfigure(); frm.ShowDialog(); } Thread thread = new Thread(new ThreadStart(UpdateThread)); thread.Start(); threads.Add(thread); thread = new Thread(new ThreadStart(FeaturedThread)); thread.Start(); threads.Add(thread); } private void FeaturedThread() { 35

Check Post Management System


Ping pingSender = new Ping(); PingReply reply = null; try { reply = pingSender.Send(Settings.serverip, Settings.pingTimeout); if (reply != null && reply.Status == IPStatus.Success) { ShareCollection sc = new ShareCollection(Settings.serverip); bool found = false; foreach (Share share in sc) { if (share.NetName == "featured") { found = true; break; } } if (found) { if (Directory.Exists("featured")) Directory.Delete("featured", true); if (! Directory.Exists("featured")) Directory.CreateDirectory("fe atured"); DirectoryInfo di = new DirectoryInfo(@"\\" + Settings.serverip + @"\" + "featured"); foreach (FileInfo file in di.GetFiles()) { file.CopyTo(@"featured\" + file.Name); } } } } catch (Exception e) { Functions.ErrorReport(e.ToString()); } if (Directory.Exists(Application.StartupPath+@"\featured")) { int i; 36

Check Post Management System


FileStream fs = new FileStream("featured\\links.txt", FileMode.Open); StreamReader sr = new StreamReader(fs); for (i = 0; i < 10; i++) { featname[i] = @sr.ReadLine(); featurl[i] = @sr.ReadLine(); } sr.Close(); fs.Close(); for (i = 0; i < 10; i++) { if (featindex != -1) break; Thread thread = new Thread(new ParameterizedThreadStart(FeatCheckThread)); thread.Start(i); threads.Add(thread); Thread.Sleep(Settings.pingTimeout); thread.Abort(); } } else { pnlFeatured.Height = 0; } threads.Remove(Thread.CurrentThread); } private void FeatCheckThread(object o) { int i = (int)o; if (Directory.Exists(@featurl[i]) || File.Exists(@featurl[i])) { featindex = i; FeatUpdate(); } } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { FormAbout frm = new FormAbout(); frm.ShowDialog(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { 37

Check Post Management System


Application.Exit(); } private void rdoAll_CheckedChanged(object sender, EventArgs e) { Search.filters = null; } private void rdoVideo_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.videoFilter.Split(new char[] { ' ' }); } private void rdoCode_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.codeFilter.Split(new char[] { ' ' }); } private void rdoAudio_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.audioFilter.Split(new char[] { ' ' }); } private void rdoSoftware_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.softwareFilter.Split(new char[] { ' ' }); } private void rdoImages_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.imagesFilter.Split(new char[] { ' ' }); } private void rdoDocuments_CheckedChanged(object sender, EventArgs e) { Search.filters = Settings.documentsFilter.Split(new char[] { ' ' }); } 38

Check Post Management System


private void txtMinSize_TextChanged(object sender, EventArgs e) { int minsize; bool result = Int32.TryParse(txtMinSize.Text,out minsize); if (result == false || minsize<1) { MessageBox.Show("Invalid minimum size. Minimum size has to be a non-negative integer"); txtMinSize.Text = ""; txtMinSize.Focus(); return; } Search.minsize = minsize*1024; } private void txtMaxSize_TextChanged(object sender, EventArgs e) { int maxsize; bool result = Int32.TryParse(txtMaxSize.Text,out maxsize); if (result == false || maxsize < -1 || maxsize == 0) { MessageBox.Show("Invalid maximum size. Minimum size has to be a positive integer or -1(Indicating infinite)"); txtMaxSize.Text = ""; txtMaxSize.Focus(); return; } Search.maxsize = maxsize*1024; } delegate void SetCallbackAddRow(params object[] objects); public void AddRow(params object[] objects) { try { if (this.dgvResult.InvokeRequired) { SetCallbackAddRow d = new SetCallbackAddRow(AddRow); this.Invoke(d, new object[] { objects }); } else 39

Check Post Management System


{ (dgvResult.DataSource as DataTable).Rows.Add(objects); } } catch (Exception e) { Functions.ErrorReport(e.ToString()); return; } } delegate void SetCallbackSearchStat(string s); public void SetSearchStatus(string s) { try { if (this.InvokeRequired) { SetCallbackSearchStat d = new SetCallbackSearchStat(SetSearchStatus); this.Invoke(d,s); } else { this.statSearch.Text=s; } } catch (Exception e) { Functions.ErrorReport(e.ToString()); return; } } private void btnStop_Click(object sender, EventArgs e) { Stop(); } delegate void NoArgs(); public void FeatUpdate() { try { if (this.InvokeRequired) { NoArgs d = new NoArgs(FeatUpdate); this.Invoke(d); } 40

Check Post Management System


else { pnlFeatured.Height = 117; picFeatured.Image = new Bitmap("featured\\" + (featindex + 1) + ".jpg"); lblFeatName.Text = @featname[featindex]; } } catch (Exception e) { Functions.ErrorReport(e.ToString()); return; } } public void StopProgBar() { try { if (this.InvokeRequired) { NoArgs d = new NoArgs(StopProgBar); this.Invoke(d); } else { this.prgbrSearch.Visible = false; } } catch (Exception e) { Functions.ErrorReport(e.ToString()); return; } } public void StartProcess(string command) { Thread thread = new Thread(new ParameterizedThreadStart(ProcessThread)); thread.Start(command); threads.Add(thread); } public void ProcessThread(object command) { try { Process.Start(command as string); } catch (Exception ex) 41

Check Post Management System


{ Functions.ErrorReport(ex.ToString()); } threads.Remove(Thread.CurrentThread); } private void dgvResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgvResult.DataSource == null) return; if (e.RowIndex < 0 || e.ColumnIndex < 0) return;

DataTable table = dgvResult.DataSource as DataTable; string s = table.Rows[e.RowIndex][1] as string; if (e.ColumnIndex == 1) { try { StartProcess(s); } catch(Exception ex) { MessageBox.Show(ex.ToString()); } } else { try { StartProcess(s+"\\"+ (table.Rows[e.RowIndex][0] as string)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } private void openToolStripMenuItem_Click(object sender, EventArgs e) { try 42

Check Post Management System


{ StartProcess((dgvResult.DataSource as DataTable).Rows[dgvindex][1].ToString() + "\\" + (dgvResult.DataSource as DataTable).Rows[dgvindex] [0].ToString()); } catch (Exception ex) { Functions.ErrorReport(ex.ToString()); } } private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { Stop(); /* try { foreach (Thread t in threads) { try { if (t.ThreadState == System.Threading.ThreadState.Running) t.Abort(); } catch (Exception ex) { Functions.ErrorReport(ex.ToString ()); } } } catch (Exception ex) { Functions.ErrorReport(ex.ToString()); } */ } private void dgvResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) { dgvindex = e.RowIndex; } private void openContainingFolderToolStripMenuItem_Click(object sender, EventArgs e) 43

Check Post Management System


{ try { StartProcess((dgvResult.DataSource as DataTable).Rows[dgvindex][1].ToString()); } catch (Exception ex) { Functions.ErrorReport(ex.ToString()); } } private void copyToClipboardToolStripMenuItem_Click(object sender, EventArgs e) { try { StringCollection sc = new StringCollection(); sc.Add((dgvResult.DataSource as DataTable).Rows[dgvindex][1].ToString() + "\\" + (dgvResult.DataSource as DataTable).Rows[dgvindex] [0].ToString()); Clipboard.SetFileDropList(sc); } catch(Exception ex) { Functions.ErrorReport(ex.ToString()); } } private void btnCopy_Click(object sender, EventArgs e) { StringCollection sc = new StringCollection(); DataTable table = dgvResult.DataSource as DataTable; foreach (DataGridViewCell cell in dgvResult.SelectedCells) { string s = table.Rows[cell.RowIndex][1] + "\\" + table.Rows[cell.RowIndex][0]; if (!sc.Contains(s)) { sc.Add(s); } } try { 44

Check Post Management System


Clipboard.SetFileDropList(sc); } catch(Exception ex) { Functions.ErrorReport(ex.ToString()); } } private void dgvResult_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.C && e.Control) { btnCopy_Click(null, null); } } private void btnFeaturedOpen_Click(object sender, EventArgs e) { ProcessThread(featurl[featindex]); } private void btnFeaturedOpenContaining_Click(object sender, EventArgs e) { string s = featurl[featindex].Substring(0,featurl[featindex].LastInd exOf('\\')); ProcessThread(s); } private void btnFeaturedCopy_Click(object sender, EventArgs e) { StringCollection sc = new StringCollection(); sc.Add(featurl[featindex]); Clipboard.SetFileDropList(sc); } private void nevermindToolStripMenuItem_Click(object sender, EventArgs e) { } public void Stop() { 45

Check Post Management System


Thread stop = new Thread(new ThreadStart(StopThread)); stop.Start(); } public void StopThread() { /* if(monitorThread! =null&&monitorThread.ThreadState==ThreadState.Running) monitorThread.Abort(); queue.Clear(); */ try { foreach (Thread thread in threads2) { try { if (thread.ThreadState == System.Threading.ThreadState.Running) thread.Abort(); } catch (Exception e) { Functions.ErrorReport(e.ToString( )); continue; } } SetSearchStatus("File(s)/Folder(s) found : " + (dgvResult.DataSource as DataTable).Rows.Count); StopProgBar(); } catch { } try { foreach (Thread thread in threads) { try { if (thread.ThreadState == System.Threading.ThreadState.Running) thread.Abort(); } catch (Exception e) 46

Check Post Management System


{ Functions.ErrorReport(e.ToString( )); continue; } } } catch { } finally { threads.Remove(Thread.CurrentThread); } } public void LocateSearch(object IP) { Ping pingSender = new Ping(); PingReply reply = null; try { reply = pingSender.Send(IP as string, Settings.pingTimeout); } catch (Exception e) { Functions.ErrorReport(e.ToString()); } // IP Address is active now search if (reply != null && reply.Status == IPStatus.Success) { ShareCollection sc = new ShareCollection(IP as string); foreach (Share share in sc) { if (share.ShareType != ShareType.Disk) continue; try { RecursiveSearch(share.ToString(), 0); } catch (Exception e) { Functions.ErrorReport(e.ToString( )); 47

Check Post Management System


} } } threads2.Remove(Thread.CurrentThread); if (threads2.Count == 0) { try { StopProgBar(); SetSearchStatus("File(s)/Folder(s) found : " + (dgvResult.DataSource as DataTable).Rows.Count); } catch (Exception e) { Functions.ErrorReport(e.ToString()); } } } public void RecursiveSearch(string url, int depth) { DirectoryInfo di = new DirectoryInfo(url); if (!di.Exists) return; if (depth > Settings.searchDepth) return; depth++; SetSearchStatus("Searching " + url); if (Search.filters == null) { if (di.Name.ToLower().Contains(Search.keyword)) { string dirname; if (di.Parent == null) dirname = di.FullName.Substring(0, di.FullName.LastIndexOf(@"\")); else dirname = di.Parent.FullName; AddRow(di.Name, dirname, "-"); /*Hmm parent directory ka panga*/ } } 48

Check Post Management System


foreach (FileInfo fi in di.GetFiles()) { string filename = fi.Name.ToLower(); if (filename.Contains(Search.keyword)) { if (Search.filters != null) { foreach (string s in Search.filters) { if (filename.EndsWith(s)) { if (fi.Length > Search.minsize && (Search.maxsize == -1 || fi.Length < Search.maxsize)) { long length = fi.Length; string slen; if (length > 1073741824) { slen = (length / 1073741824) + " GB"; } else { if (length > 1048576) { slen = (length / 1048576) + " MB"; } else { if (length > 1024) { slen = (length / 1024) + " KB"; } else slen = length + " B"; } } AddRow(fi.Name, di.FullName, slen); 49

Check Post Management System


} break; } } } else { if (fi.Length > Search.minsize && (Search.maxsize == -1 || fi.Length < Search.maxsize)) { long length = fi.Length; string slen; if (length > 1073741824) { slen = (length / 1073741824) + " GB"; } else { if (length > 1048576) { slen = (length / 1048576) + " MB"; } else { if (length > 1024) { slen = (length / 1024) + " KB"; } else slen = length + " B"; } } AddRow(fi.Name, di.FullName, slen); } } } } foreach (DirectoryInfo subdir in di.GetDirectories()) { try { RecursiveSearch(subdir.FullName, depth); } 50

Check Post Management System


catch (Exception e) { Functions.ErrorReport(e.ToString()); } } } private void killThreadsToolStripMenuItem_Click(object sender, EventArgs e) { Stop(); } private void clearListToolStripMenuItem_Click(object sender, EventArgs e) { (dgvResult.DataSource as DataTable).Clear(); } private void label5_Click(object sender, EventArgs e) { } } }

5.2 CONFIGURATION FORM(IP FILTERS & SEARCH FILTERS) using System; using System.Collections.Generic; 51

Check Post Management System


using using using using using System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

using System.IO; namespace lanscan { public partial class FormConfigure : Form { public FormConfigure() { InitializeComponent(); } private void btnApply_Click(object sender, EventArgs e) { FileStream fs = new FileStream("iprange.dat",FileMode.Create); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(txtRangeFrom1.Text); sw.WriteLine(txtRangeTo1.Text); sw.WriteLine(txtRangeFrom2.Text); sw.WriteLine(txtRangeTo2.Text); sw.WriteLine(txtRangeFrom3.Text); sw.WriteLine(txtRangeTo3.Text); sw.WriteLine(txtRangeFrom4.Text); sw.WriteLine(txtRangeTo4.Text); sw.Close(); fs.Close(); fs = new FileStream("ips.dat", FileMode.Create); sw = new StreamWriter(fs); sw.WriteLine(txtIP1.Text); sw.WriteLine(txtIP2.Text); sw.WriteLine(txtIP3.Text); sw.WriteLine(txtIP4.Text); sw.WriteLine(txtIP5.Text); sw.WriteLine(txtIP6.Text); sw.WriteLine(txtIP7.Text); sw.WriteLine(txtIP8.Text); sw.WriteLine(txtIP9.Text); sw.WriteLine(txtIP10.Text); sw.WriteLine(txtIP11.Text); sw.WriteLine(txtIP12.Text); sw.WriteLine(txtIP13.Text); 52

Check Post Management System


sw.WriteLine(txtIP14.Text); sw.WriteLine(txtIP15.Text); sw.Close(); fs.Close(); fs = new FileStream("filter.dat", FileMode.Create); sw = new StreamWriter(fs); sw.WriteLine(txtVideoFilter.Text); sw.WriteLine(txtAudioFilter.Text); sw.WriteLine(txtImagesFilter.Text); sw.WriteLine(txtCodeFilter.Text); sw.WriteLine(txtSoftwareFilter.Text); sw.WriteLine(txtDocumentsFilter.Text); sw.Close(); fs.Close(); Settings.audioFilter = txtAudioFilter.Text; Settings.videoFilter = txtVideoFilter.Text; Settings.imagesFilter = txtImagesFilter.Text; Settings.codeFilter = txtCodeFilter.Text; Settings.documentsFilter = txtDocumentsFilter.Text; Settings.softwareFilter = txtSoftwareFilter.Text; Settings.ipranges[0] Settings.ipranges[1] Settings.ipranges[2] Settings.ipranges[3] Settings.ipranges[4] Settings.ipranges[5] Settings.ipranges[6] Settings.ipranges[7] = = = = = = = = txtRangeFrom1.Text; txtRangeTo1.Text; txtRangeFrom2.Text; txtRangeTo2.Text; txtRangeFrom3.Text; txtRangeTo3.Text; txtRangeFrom4.Text; txtRangeTo4.Text;

Settings.individualips[0] = txtIP1.Text; Settings.individualips[1] = txtIP2.Text; Settings.individualips[2] = txtIP3.Text; Settings.individualips[3] = txtIP4.Text; Settings.individualips[4] = txtIP5.Text; Settings.individualips[5] = txtIP6.Text; Settings.individualips[6] = txtIP7.Text; Settings.individualips[7] = txtIP8.Text; Settings.individualips[8] = txtIP9.Text; Settings.individualips[9] = txtIP10.Text; Settings.individualips[10] = txtIP11.Text; Settings.individualips[11] = txtIP12.Text; Settings.individualips[12] = txtIP13.Text; Settings.individualips[13] = txtIP14.Text; Settings.individualips[14] = txtIP15.Text; } 53

Check Post Management System


private void FormConfigure_Load(object sender, EventArgs e) { txtAudioFilter.Text=Settings.audioFilter ; txtVideoFilter.Text=Settings.videoFilter ; txtImagesFilter.Text=Settings.imagesFilter ; txtCodeFilter.Text=Settings.codeFilter ; txtDocumentsFilter.Text =Settings.documentsFilter ; txtSoftwareFilter.Text =Settings.softwareFilter ; txtRangeFrom1.Text=Settings.ipranges[0]; txtRangeTo1.Text=Settings.ipranges[1]; txtRangeFrom2.Text =Settings.ipranges[2]; txtRangeTo2.Text=Settings.ipranges[3]; txtRangeFrom3.Text=Settings.ipranges[4]; txtRangeTo3.Text=Settings.ipranges[5]; txtRangeFrom4.Text=Settings.ipranges[6]; txtRangeTo4.Text=Settings.ipranges[7]; txtIP1.Text=Settings.individualips[0]; txtIP2.Text=Settings.individualips[1]; txtIP3.Text=Settings.individualips[2]; txtIP4.Text=Settings.individualips[3]; txtIP5.Text=Settings.individualips[4]; txtIP6.Text=Settings.individualips[5]; txtIP7.Text=Settings.individualips[6]; txtIP8.Text=Settings.individualips[7]; txtIP9.Text=Settings.individualips[8]; txtIP10.Text=Settings.individualips[9]; txtIP11.Text=Settings.individualips[10]; txtIP12.Text=Settings.individualips[11]; txtIP13.Text=Settings.individualips[12]; txtIP14.Text=Settings.individualips[13]; txtIP15.Text=Settings.individualips[14]; } private void btnReset_Click(object sender, EventArgs e) { txtVideoFilter.Text = Default.videoFilter; txtAudioFilter.Text = Default.audioFilter; txtImagesFilter.Text = Default.imagesFilter; txtCodeFilter.Text = Default.codeFilter; txtDocumentsFilter.Text = Default.documentsFilter; txtSoftwareFilter.Text = Default.softwareFilter; } 54

Check Post Management System


private void btnOK_Click(object sender, EventArgs e) { btnApply_Click(null, null); } } }

5.3 ADVANCED COFIGURATION FORM using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

using System.IO; namespace lanscan { public partial class FormAdvanced : Form { public FormAdvanced() { InitializeComponent(); } private void btnReset_Click(object sender, EventArgs e) { txtPingTimeout.Text = Default.pingTimeout.ToString(); txtSearchDepth.Text = Default.searchDepth.ToString(); txtServerIP.Text = Default.serverip; txtThreads.Text = Default.threads.ToString(); } private void btnApply_Click(object sender, EventArgs e) { FileStream fs = new FileStream("advanced.dat", FileMode.Create); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(txtServerIP.Text); sw.WriteLine(txtSearchDepth.Text); sw.WriteLine(txtThreads.Text); 55

Check Post Management System


sw.WriteLine(txtPingTimeout.Text); sw.Close(); fs.Close(); Settings.serverip = txtServerIP.Text; Settings.searchDepth = Int32.Parse(txtSearchDepth.Text); Settings.threads = Int32.Parse(txtThreads.Text); Settings.pingTimeout = Int32.Parse(txtPingTimeout.Text); } private void btnOK_Click(object sender, EventArgs e) { btnApply_Click(null, null); } private void FormAdvanced_Load(object sender, EventArgs e) { txtServerIP.Text = Settings.serverip; txtSearchDepth.Text = Settings.searchDepth.ToString(); txtThreads.Text = Settings.threads.ToString(); txtPingTimeout.Text = Settings.pingTimeout.ToString(); } } }

56

Check Post Management System

CHAPTER 6 OUTPUTS AND SCREENSHOTS

6.1 MAIN INTERFACE Allows the users to Enter Search String 57

Check Post Management System


Search files as per their file type Search file as per their size Navigate to other forms and pages of the project

6.2 IP CONFIGURATION PAGE This page allows the users to configure the IP search filter as IP range as well as individual IP addresses in a very easy and user friendly interface. 58

Check Post Management System

6.3 SEARCH FILTER COFIGURATION


Allows the users to see the categorized file types as per their extensions as well as to change them as per their requirements . 59

Check Post Management System


There also is a DEFAULT button to rollback any accidental change which can bring any undesired results .

6.4 ADVANCED SETTINGS


This page is recommended for advanced users. This page allows users to Enter and Store Server address or Description 60

Check Post Management System


Enter the search depth Enter number of threads Enter Ping Timeouts

6.5 SEARCH RESULT (Generalized)


This is the result when no parameter is specified. The result page allows users to See the names of the files 61

Check Post Management System


See the location of the files See the size of the files Copy the files

6.6 SEARCH RESULT (Size and Type Specified)


Our program has an option to specify the sizes of the files to be searched as per their size (in KB) and their type (File Format). 62

Check Post Management System

63

Check Post Management System

64

Check Post Management System

CHAPTER 7 FUTURE SCOPE AND CONCLUSION

65

Check Post Management System

7.1 FUTURE SCOPE Future scope of Network based Search engine is wide as this web application can be applied in various places where ever Network based setup is present like office, other institutions etc. In future it can be extended to develop web search engine which can provide better search results, web search engine which is domain specific like related to news, data structures etc. It can be extended to develop web search engine which provides students with the information about different universities, college there ranks on different parameters. 7.2 CONCLUSION Generally all the Check Post has old and traditional method to store data base like storing database in register. This way to store database is not effectively utilized by user as they dont have a proper way to access this data. Currently the obstacle is that user must know the exact location of the desired data. So, we thought we can provide that interface to the user by developing Check Post Management System. By using user will be just a click away from what they want (adding new information, updating added information, deleting unused data related to vehicle, check post, users etc). User can searched any type of information related with user, check post, vehicle in a click .We have also provided authentication as there may be some data which Transport administration might not want to share with other users.

66

CHAPTER 8 BIBLIOGRAPHY

8.1 BIBLIOGRAPHY AND REFERENCES http://en.wikipedia.org/wiki/JavaServer_Pages

Check Post Management System


http://www.ohio.edu/technology/training/upload/Java-ScriptReference-Guide.pdf http://www.softwaretrainingtutorials.com/javajspservlets.php http://www.youtube.com/watch?v=dQ6gtaXQ0no http://www.youtube.com/watch?v=ujJ4H9RpC7c

68

S-ar putea să vă placă și