Académique Documents
Professionnel Documents
Culture Documents
The Project Report On Railway Reservation System eRail Submitted in partial fulfillment of the requirement of The Degree of Master of Computer Application
Submitted By-
Project Guide-
Page: 1/107
Examiners Certificate
This is to certify that project report submitted by Krishan Kumar Pareek entitled Railway Reservation System eRail is approved and is acceptable in quality and form.
Internal Examiner
External Examiner
Page: 2/107
Certificate of Guide
This is to certify that project report entitled Railway Reservation System eRail Submitted in partial fulfillment and requirement for the degree of Master of Computer Application to Sikkim Manipal University, India by Krishan Kumar Pareek has worked under my supervision and guidance and that no part of this report has been submitted for the award of any other degree, diploma, fellowship, or any similar titles or prizes and the work has not been published in any journal or magazine.
Certified By-
Page: 3/107
Declaration
I hereby declare that the project report entitled Railway Reservation System eRail submitted in partial fulfillment and requirement for the degree of Master of Computer Application to Sikkim Manipal University, India is my original work and not submitted for the award of any other degree, diploma, fellowship, or any similar title of prizes.
Page: 4/107
Acknowledgement
I would like to express our heartiest thank to Dr. A. K. Tiwari, Associate Professor, for showing the complete confidence in me. I express my deep sense of gratitude to all my faculties and management of Tirupati College for Distance Learning, Pratap Nagar, Jaipur for providing me this great opportunity. I express my sincere gratitude towards Dr. A. K. Tiwari, Associate Professor, SMU for providing us the excellent environment for project making. I am also thankful to my friends and classmates, who were always there to help me out, motivate me towards the fulfillment of this project. I would like specially say thanks to Ms. Sonal Chouhan, who always council and guide me very well for ever for ever. Last but not the least it is the staff of Department of Computer Application, Tirupati College for Distance Learning, Pratap Nagar, Jaipur, to whom I am always indebted. I AM THANKFUL TO ALL OF THEM
KRISHAN KUMAR PAREEK MCA, 6th Sem. Tirupati College for Distance Learning, Pratap Nagar, Jaipur
Page: 5/107
Table of Contents
ABSTARCT .....................................................................................................................................................9
Railway Management System Benefits ......................................................................... 10 Scope and Features ........................................................................................................ 10 Security module ......................................................................................................... 11 Master Management module ..................................................................................... 11 Transaction Module ................................................................................................... 12 Query Module............................................................................................................ 12 Out of Scope .................................................................................................................. 13 Goal and objective ......................................................................................................... 13 Solution Concept ........................................................................................................... 13
PROBLEM STATEMENT ......................................................................................................................... 14
Requirements Summary ................................................................................................ 14 Business Requirements.............................................................................................. 14 User Requirements .................................................................................................... 14 Operational Requirements ......................................................................................... 15
SYSTEM ARCHITECTURE ..................................................................................................................... 16
High Level Solution Architecture ................................................................................. 16 Data Flow and Process Flow Chart ............................................................................... 17 User Profiles .................................................................................................................. 17 User Profiles .................................................................................................................. 18 Usage Summary ............................................................................................................ 18
SOFTWARE AND HARDWARE REQUIREMENT ..............................................................................20
Performance................................................................................................................... 22 Availability .................................................................................................................... 22 Reliability ...................................................................................................................... 22 Scalability ...................................................................................................................... 22 Security .......................................................................................................................... 22 Interoperability .............................................................................................................. 22 Location ......................................................................................................................... 22 Setup/Installation ........................................................................................................... 22
USE CASE ................................................................................................................................................... 23 Page: 6/107
Manage Users ................................................................................................................ 23 Description ................................................................................................................ 23 Business Need ........................................................................................................... 23 Priority ....................................................................................................................... 23 Manage Reservation ...................................................................................................... 23 Description ................................................................................................................ 23 Business Need ........................................................................................................... 23 Priority ....................................................................................................................... 23 Manage Cancellation ..................................................................................................... 23 Description ................................................................................................................ 23 Business Need ........................................................................................................... 23 Priority ....................................................................................................................... 23 PRN Query .................................................................................................................... 24 Description ................................................................................................................ 24 Business Need ........................................................................................................... 24 Priority ....................................................................................................................... 24 Use Case : Manage Users .............................................................................................. 24 Use Case Model: Manage Users ............................................................................... 25 Use Case Manage Reservation ............................................................................. 26 Use Case Manage Cancellation ............................................................................ 27 Use Case Manage Cancellation ............................................................................ 28 Use Case PRN Query ........................................................................................... 30
RAILWAY RESERVATION SYSTEM DATA DICTIONARY ............................................................ 32
Table : cancellation_rules .............................................................................................. 32 Table : cash_master ....................................................................................................... 32 Table : coach_type_master ............................................................................................ 33 Table : other_fees .......................................................................................................... 33 Table : reservation_master ............................................................................................ 34 Table : reservation_transaction ..................................................................................... 35 Table : stage_master ...................................................................................................... 35 Table : station_master ................................................................................................... 36 Table : train_master ....................................................................................................... 36 Table : train_schedule ................................................................................................... 37 Table : user_master ....................................................................................................... 37
RAILWAY RESERVATION SYSTEM DATA SCHEMA ER DIAGRAM ........................................38 RAILWAY RESERVATION SYSTEM DFD (DATA FLOW DIAGRAM) ..........................................39
Railway Reservation System : Login ............................................................................ 40 Railway Reservation System : Main Screen ................................................................. 42 Railway Reservation System : User Master .................................................................. 44 Railway Reservation System : Change Password ......................................................... 50 Railway Reservation System : Station Master .............................................................. 53 Railway Reservation System : Train Master ................................................................. 59 Railway Reservation System : Train Schedule ............................................................. 66
Krishan Kumar Pareek, MCA 6th Sem., Reg. No.: 571124530
Page: 7/107
Railway Reservation System : Fare Rule Stage Master ................................................ 72 Railway Reservation System : Fare Rule Stage Master ................................................ 72 Railway Reservation System : Reservation ................................................................... 78 Railway Reservation System : Cancellation ................................................................. 90 Railway Reservation System : Cancellation ................................................................. 90 Railway Reservation System : Daily Transaction ......................................................... 95 Railway Reservation System : PRN Query ................................................................... 98
RAILWAY RESERVATION SYSTEM TEST PLAN ...........................................................................101
Introduction ................................................................................................................. 101 Test Scope ................................................................................................................... 101 Test Strategy ................................................................................................................ 102 Preconditions ............................................................................................................... 102 Test Priorities .............................................................................................................. 102 Test Techniques ........................................................................................................... 103 Test Organization ........................................................................................................ 103 Roles and Responsibilities........................................................................................... 103 Deliverables ................................................................................................................. 103 Test Environment ........................................................................................................ 104 Hardware and Software ............................................................................................... 104 Testing Automation Software ..................................................................................... 104 Application Configuration ........................................................................................... 104 Test Management ........................................................................................................ 105 Testing Schedules ........................................................................................................ 105 Threats to Testing ........................................................................................................ 105
CONCLUSION AND FUTURE ENHANCEMENT ..............................................................................106 BIBLIOGRAPHY .....................................................................................................................................107
Page: 8/107
ABSTRACT
Proposed Railway Reservation System is developed for to automate the railway reservation system. It includes modules required to successfully operate railway reversion process smoothly. It has train master to add modify train information, Train schedule to enter train journey details include all the station name, arrival time and departure time. It includes automatic fare calculation as per the distance between two stations. Reservation module consists of automatic seat no and coaches no allocation system. Daily schedule for updation of not confirm seat and coach no. All master like train master, train schedule, reservation fees, cancellation fees charges can be modified individually from front end and changes reflect in all modules immediately. Therefore proposed Railway Reservation System has been designed to automate the process of railway for ticket reservation and back office activities. System can make the daily activities efficient and providing the fast response. It included inbuilt user management module to enhance security features as system handles sensitive customer and finance data,
Page: 9/107
Page: 10/107
Security module
Security modules include security features like user management and application level password management.. Maintain user master- Each user identified by the user name and user type. Only admin user can create, edit user information. Password must be 6 characters long. Password must be alpha numeric. While creating user system assign default password for the user, user must change default password for first time login. All login time stamp stored in the system for security audit. Access level and roles and privileges are set for different type of users.
Page: 11/107
Transaction Module
Transaction module includes following sub modules. Reservation This module used to make reservation, it asks for input data like train no, journey date, from station code, end station code. System has powerful validation rule to check validation like journey date must be greeter than system date, journey date must be within 90 days. Train should run for the selected day. Check for from station and to station. Seat availability, While saving the record system generate PRN no, seat no and coach no. Before save the system ask for final confirmation. System automatically calculates the fare and save the details. Cancellation For cancellation of ticket it ask for PRN no, after entering the correct PRN no system check for validity of the PRN no, whether it already cancelled, journey date already expired. I it validate system display all the details of the reservation. System automatically calculates the cancellation fees from the cancellation rule master. Before save the record system ask for the confirmation. Update Seat no for unconfirmed passenger It is schedule activity, system query for all cancelled ticket for particular journey date and allocates all vacant seat to unconfirmed passenger. Daily Cash Transaction It shows daily transaction, like how much money received and how much money refund. All data can be exported to MS Excel for review and save in file system.
Query Module
A powerful query module give on screen information for particular PRN NO, it shows all the reservation details and cancellation details, include current status for the seat no, coach no. Both of these areas of functionality will be delivered as the first version of the Railway Reservation System is released. Functionality is described in more detail later in this document.
Page: 12/107
Out of Scope
The following functions are considered out of scope for Version 1 of the Railway Reservation System. Versions 2.0 address items not in scope and those deemed not feasible during V1.0.
Function
Linking and integration of any legacy system for accounting. Integration with banks and other credit verification agency Connection to third-party OLAP applications Sophisticated system to host in internet and used to connect all travel agents. Electronic Data Interchange (EDI) system between different department
Comment
Version
Required by management to control and maintain the accounting activity Help to updated and share the data
2 2 2 2
Solution Concept
The Railway Reservation System consists of: Security Modules: Security modules include security features like user management and application level password management. Master Management module: It includes all master like station, train, all rules which are used to calculate fare and cancellation charges. Transaction Module It includes reservation, cancellation of ticket. Update of seat no and coach no for unconfirmed passengers. Query Modules. A powerful query module give on screen information for particular PRN no, system user can view all information for particular ticket in one screen by entering PRN no.
Krishan Kumar Pareek, MCA 6th Sem., Reg. No.: 571124530
Page: 13/107
Problem Statement
Requirements Summary
The following preliminary lists are based on initial interviews
Business Requirements
The business goal for the application is to support an increase the productivity and complete automation of existing manual or semi automatic railway reservation process. Business requirements are discussed in the Scope section, with the following additional detail: Improve the search facility and system users should get all the information in a second. System should have security features in built as it handles sensitive personal and finance information of the customer. User must not delete any data, Administrator can only have the rights to delete the data, System Administrator must able to control the access rights by each user as per requirement. The application should support the capability to use multi user environment.
The system users want to improve their current ability to analyze customer data. In particular, they want to focus on identifying their best customer and who are defaulter. To enable them to accomplish this goal, they want to extract meaningful data that easily answers the following questions: What are the early warning signs of problems? Who is my best route? What is the most used and busy train? Payment pattern of the customer? Cancellation pattern of customer? What are my customers' issues as groups?
User Requirements
User requirements are categorized by user type. System Users Able to search and view the ticket information by only PRN no.. Able to find all the information like reservation details, seat details, in one screen to give answer to customer query. Must able to change the his or her own password System must able to calculate all fare automatically.
Page: 14/107
Supervisor
All mater details should be updated from front end only.. All data must be exported to ms excel
Operational Requirements
The following requirements provide a high-level view of how the system will run: Processor usage should not exceed 80 percent during concurrent uses. Backups will occur incrementally throughout the day. A full weekly backup is required to WORM drives. Ensure that information is easy to access either, and meaningful for the system users and the company. Minimize the technical knowledge that system users need to access the data, generate ad hoc queries, search and view information. Any change to information must be reflected immediately, and the changes must be propagated to the search engine so that system users that perform searches see this new information. The application should work with the existing communications and networking infrastructure. The application should deploy with a minimum of additional operational processes, manual or otherwise.
Page: 15/107
System Architecture
High Level Solution Architecture
System
Windows Application Microsoft VB Run Time
OLEDB
Database Engine
Data Access
OLTP Access
OLAP Access
Page: 16/107
Login
Not Success
Login Success
Reservation
Start up screen
Cancellation
Master Management
End
Page: 17/107
User Profiles
The following user types are expected for the Railway Reservation System: User USER Supervisor System Administrator Brief Description of Use Actions Minimum rights to the system, query the information can add, edit some modules. Reservation, Cancellation, Make, However can not delete any information. Create new system users, set and alter the role and privilege to the system users for accessing the system resource. Can delete the data. Also responsible to database backup, backend performance. And overall the system performance.
Usage Summary
Railway Reservation System Version 1.0 will address the following use cases. The complete usage scenarios will be completed during the information-gathering process. Use cases will be created and prioritized. Selected use cases will be expanded into usage scenarios and features that are derived from both use cases and the usage scenarios, as represented in the following diagram:
Page: 18/107
Page: 19/107
Database Server
Application Server
Application Server
Workstation 1
Workstation 2
Workstation 3
Workstation N
Page: 20/107
Back End
1. MS Access Why MS Access? MS Access is desktop RDMS support small application with all features like relational query, different data types, joins, and query. Includes Easy to use and easy to deployment. Integration with Windows OS Scalability Import and Export of data in all major database system. Centralized Management Reliability Automating Tasks
Page: 21/107
Development Environment
1. Visual Studio 6.0 2. Microsoft Office
Availability
Because the system is accessed by users of the bank and staff for customer query, and their should not be any single point of failure.
Reliability
Because of the need no single point failure, automatic failover will be required. In addition, existing disaster recovery and backup plans and procedures must be revised to incorporate the Railway Reservation System.
Scalability
Railway Reservation System an average load of 25 concurrent users after the system is fully operational, and expects that to grow by 5 percent each year for the next five years.
Security
For the sensitive member information, all users will need to log on the system with their user id and password. Every resource in the system are defined by the role and privileged. System administrator assigned user role and privileged for their access rights.
Interoperability
In Version 1.0 of the Railway Reservation System, there are no requirements for interoperability with other systems.
Location
The Railway Reservation System is implemented in banks existing network.
Setup/Installation
Setup and installation must not interrupt the system users daily tasks and work flow.
Page: 22/107
Use Case
Manage Users
Description
This function will enable administrator to modify user information.
Business Need
This function will enable system users to interact with Railway Reservation System catalog directly without the intervention of any other employees.
Priority
Medium
Manage Reservation
Description
This function allows user of Railway Reservation System to create new ticket reservation.
Business Need
This function will support the system users to create new reservation
Priority
High
Manage Cancellation
Description
This function enables the user to cancel ticket.
Business Need
This function enables user of Railway Reservation System to have enter PRN no and cancel ticket.
Priority
High
Page: 23/107
PRN Query
Description
This function allows system user query to database for ticket information.
Business Need
This function will allow user to retrieve the latest ticket. Information by providing PRN no
Priority
High
Assumptions/Preconditions
System users have access rights to view user data.
Actors
Administrator
Basic Course
Use case begins when the actor decides to modify user information. System opens the user master information. Actor navigates the required information from. Actor press Edit button and make the necessary changes in the record. Actor press Save button to save the record in the user master catalog. Use case ends when the selected information is passed to a method of delivery.
Page: 24/107
Alternate Course
If no appropriate user information, system reports this fact. Use case restarts to enable users to update the type of user information.
Future Requirements
The system users may want to apply filters to the retrieved data. The system users may want to sort the data. For example, the system user want to list the names of user in chronological order based on the entry date.
User Master
Administrator
Modify Details
Update Master
Navigate Users
Apply Validation
Page: 25/107
Use Case
Title: Abbreviated Title: Requirement ID: Intent
Manage Reservation
Manage Reservation Manage Reservation 13
Assumptions/Preconditions
The actor has rights to access to the Railway Reservation System, and having rights to make new reservation.
Actors
User Supervisor Administrator
Basic Course:
Use case begins when actor decides create new reservation. The system displays new reservation screen. Actor supply all the required details like train no, journey date, station code, passenger details. System validates all the information. System generates PRN no, new seat no and coach no, calculate ticket fare. System asks for user confirmation. Actor confirms the ticket. Use case ends when information is presented to the correct method of delivery.
Page: 26/107
Check train schedule Validation User Add Train No, Journey details Transaction Add passenger details Supervisor
Administrator
Page: 27/107
Use Case
Title: Abbreviated Title: Requirement ID: Intent
Manage Cancellation
Manage Cancellation Manage Cancellation 16
Assumptions/Preconditions
The actor has rights to access to the Railway Reservation System, and having rights to cancel ticket.
Actor
User Supervisor Administrator
Basic Course:
Use case begins when actor decides to cancel ticket. Actor enters PRN No. System validates PRN no. Systems displays reservation details, calculate cancellation fees. System asks for confirmation. Actor confirms cancellation. System update the database: Use case ends when information is presented to the correct method of delivery.
Page: 28/107
Enter PRN No Reservation Deatils Validate the PRN No Cancellation Rule Calculate Cancellation
User
Fees Master
Page: 29/107
Use Case
Title: Abbreviated Title: Requirement ID: Intent
PRN Query
PRN Query PRN Query 19
Enable actor to query the database for latest ticket information. Scenario Narrative
An actor wants view the details of reservation by supplying PRN no.
Assumptions/Preconditions
The actor has rights to access to the Railway Reservation System, and having rights to query the database for reservation details.
Actors
User Supervisor
Basic Course:
Use case begins when actor want to view the reservation details. Actor enters PRN no. System validates PRN no. Systems displays latest information related to reservation, seat no coach no..
Page: 30/107
Enter PRN NO Reservation Master View the Reservation details Reservation Transaction Display Passenger DEatils
User
Fare Rules
Page: 31/107
Indexes PK_cancellation_rules_can_id
Columns can_id
Table : cash_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns cash_id prn_no amount_received amount_refund trn_date trn_by Indexes PK_cash_master_cash_id IX_cash_master_ prn_no Data type Number Number Number Number Date/Time Number dbo erail 6 2 1 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY Value/range
Page: 32/107
Table : coach_type_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns coach_type Data type Text dbo erail 1 1 0 PRIMARY Yes Allow NULLs Not allowed Type clustered, unique, primary key located on PRIMARY Value/range Columns coach_type
Indexes PK_coach_type_master_coach_type
Table : other_fees
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns coach_type re_fess sf_fees Data type Number Number Number dbo erail 3 2 1 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY Value/range
Indexes PK_other_fees_master_coach_type
Columns coach_type
Page: 33/107
Table : reservation_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns prn_no train_no coach_type journey_date from_station to_station boarding_at re_fees sf_fees ti_fees cancel_fees create_by create_date cancel_by cancel_date Data type Number Number Text Date/Time Number Number Number Number Number Number Number Number Date/Time Number Date/Time dbo erail 15 3 2 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Allowed Allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY nonclustered located on PRIMARY Value/range
Page: 34/107
Table : reservation_transaction
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns trn_id prn_no p_name p_gender p_age Coach seat_no confirm is_cancel Data type Number Text Text Text Number Text Text Text Text dbo erail 9 2 1 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Allowed Allowed Allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY Value/range
Table : stage_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns stage_id coach_type dis_from dis_upto ticket_amount Indexes PK_stage_master_stage_id IX_stage_master_ coach_type Data type Number Text Number Number Number dbo erail 5 2 1 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY Value/range
Page: 35/107
Table: station_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns station_id station_code station_name railway_type Data type Number Text Text Text dbo erail 4 1 0 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY Value/range
Indexes PK_station_master_station_id
Columns Station_id
Table : train_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns train_no train_name train_typ schedule A1 A2 A3 SL GN GL AR Indexes PK_train_master_ train_no Data type Number Text Text Text Number Number Number Number Number Number Number dbo erail 11 1 0 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY Value/range
Columns Train_no
Page: 36/107
Table : train_schedule
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns schedule_id train_no station_id distance arival_time departure_time day Data type Number Number Number Number Date/Time Date/Time Number dbo erail 7 2 1 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY Value/range
Table : user_master
Owner: Destination DB name: Number of columns: Number of indexes: Number of foreign keys: Extended attributes: OnFileGroup Clustered PK Columns user_id user_name user_password user_type user_active user_department user_desgination user_dob user_address user_contact_no user_email_id create_date create_by last_pass_chg_date last_login1 last_login2 Indexes PK_user_master_user_id IX_ user_master_user_name Data type Number Text Text Text Number Text Text Text Text Text Text Date/Time Number Date/Time Date/Time Date/Time dbo data 16 2 0 PRIMARY Yes Allow NULLs Not allowed Not allowed Not allowed Not allowed Not allowed Not allowed Allowed Allowed Allowed Allowed Allowed Not allowed Not allowed Not allowed Not allowed Not allowed Type clustered, unique, primary key located on PRIMARY nonclustered located on PRIMARY Value/range
Page: 37/107
Page: 38/107
Train No
Stations
Fare Rules
PRN
Page: 39/107
Option Explicit '>>> check for no of attempt Dim intAttempt As Integer Private Sub CmdClose_Click() End End Sub Private Sub CmdOK_Click() '>>> check login '>>> validation If TxtUserName.Text = "" Then MsgBox "Enter user name", vbCritical TxtUserName.SetFocus Exit Sub End If If TxtPassword.Text = "" Then MsgBox "Enter password", vbCritical TxtPassword.SetFocus Exit Sub End If
Page: 40/107
Page: 41/107
Else intAttempt = intAttempt + 1 If intAttempt > 4 Then MsgBox "You try more than 3 time with invalid login details, restart the application and try again.", vbExclamation CmdOK.Enabled = False Exit Sub End If End If End Sub Private Sub Form_Load() If Cn.State = 1 Then Cn.Close Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DATA.mdb" & ";Persist Security Info=true" Cn.CursorLocation = adUseClient Cn.Open '>>> initital attempt intAttempt = 1 End Sub
Page: 42/107
Page: 43/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim AddEdit As String Private Sub Command1_Click() '>>> close form Unload Me End Sub
Page: 44/107
Page: 45/107
Page: 46/107
If Trim(TxtUserName.Text) = "" Then MsgBox "Enter user name ", vbCritical TxtUserName.SetFocus Exit Sub End If If Trim(CmbUserType.Text) = "" Then MsgBox "Enter/Select user type.", vbCritical CmbUserType.SetFocus Exit Sub End If '>>> check for user type, must select from the combo box Dim Ch As Boolean Ch = False Dim i As Integer For i = 0 To CmbUserType.ListCount - 1 If CmbUserType.Text = CmbUserType.List(i) Then Ch = True Exit For End If Next If Ch = False Then MsgBox "Select user type from the list.", vbExclamation CmbUserType.SetFocus Exit Sub End If '>>> check the add edit flag If AddEdit = "ADD" Then Dim LastSno As Integer Dim Rs2 As New ADODB.Recordset If Rs2.State = 1 Then Rs2.Close Rs2.Open "select max(user_id) from user_master", Cn, adOpenStatic, adLockReadOnly LastSno = IIf(IsNull(Rs2(0).Value) = True, 0, Rs2(0).Value) + 1 Rs1.AddNew Rs1("user_id") = LastSno Rs1("user_name") = TxtUserName.Text Rs1("user_password") = "123456" Rs1("user_type") = CmbUserType.Text If ChkActiveUser.Value = 1 Then Rs1("user_active") = 1 Else Rs1("user_active") = 0 End If Rs1("user_department") = TxtDepartment.Text Rs1("user_desgination") = TxtDesignnation.Text Rs1("user_dob") = DtDOB.Value Rs1("user_address") = TxtAddress.Text Rs1("user_contact_no") = TxtContactNo.Text Rs1("user_email_id") = TxtEmailID.Text
Page: 47/107
Page: 48/107
Rs1.MoveFirst Call displayRecord End If DE True, False End Sub Private Sub ClearText() TxtUserID.Text = "" ChkActiveUser.Value = 1 TxtUserName.Text = "" CmbUserType.Text = "" TxtDepartment.Text = "" TxtDesignnation.Text = "" DtDOB.Value = Now TxtAddress.Text = "" TxtContactNo.Text = "" TxtEmailID.Text = "" End Sub Private Sub displayRecord() TxtUserID.Text = IIf(IsNull(Rs1("user_id")) = True, "", Rs1("user_id")) If Rs1("user_active") = 1 Then ChkActiveUser.Value = 1 Else ChkActiveUser.Enabled = 0 End If TxtUserName.Text = IIf(IsNull(Rs1("user_name")) = True, "", Rs1("user_name")) CmbUserType.Text = IIf(IsNull(Rs1("user_type")) = True, "", Rs1("user_type")) TxtDepartment.Text = IIf(IsNull(Rs1("user_department")) = True, "", Rs1("user_department")) TxtDesignnation.Text = IIf(IsNull(Rs1("user_desgination")) = True, "", Rs1("user_desgination")) DtDOB.Value = IIf(IsNull(Rs1("user_dob")) = True, Now, Rs1("user_dob")) TxtAddress.Text = IIf(IsNull(Rs1("user_address")) = True, "", Rs1("user_address")) TxtContactNo.Text = IIf(IsNull(Rs1("user_contact_no")) = True, "", Rs1("user_contact_no")) TxtEmailID.Text = IIf(IsNull(Rs1("user_email_id")) = True, "", Rs1("user_email_id")) Label17.Caption = Rs1.AbsolutePosition & "/" & Rs1.RecordCount End Sub Private Sub DE(t1 As Boolean, t2 As Boolean) '>>> enable / diable buttons Command2.Enabled = t1 Command3.Enabled = t1 Command4.Enabled = t1 Command5.Enabled = t1 Command6.Enabled = t1 Command7.Enabled = t1 Command11.Enabled = t1 Command8.Enabled = t2 Command9.Enabled = t2 End Sub
Page: 49/107
Option Explicit Private Sub Command1_Click() '>>> check for blank If Text1.Text = "" Then MsgBox "Enter Old Password ...", vbExclamation Text1.SetFocus Exit Sub End If If Text2.Text = "" Or Text3.Text = "" Then MsgBox "Enter New Password ...", vbExclamation Text3.Text = "" Text2.SetFocus Exit Sub End If '>>> check for length If Len(Text2.Text) < 6 Then MsgBox "Password should be at least 6 charcters long", vbExclamation Text2.SelStart = 0 Text2.SelLength = Len(Text2.Text) Text2.SetFocus Exit Sub End If '>>> check for alpha numeric Dim ChNumeric As Boolean Dim ChAlpha As Boolean '>> initial checker ChNumeric = False ChAlpha = False Dim i As Integer
Page: 50/107
Page: 51/107
Unload Me End If End Sub Private Sub Form_Load() Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If FirstLoin = True Then End Else Unload Me End If End Sub Railway Reservation System : Masters
FrmMaster
Page: 52/107
Page: 53/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim AddEdit As String Private Sub ChkViewAll_Click() '>>> pass parameter to view all form StrViewAll = "select * from station_master view_all_filter order by station_id " StrViewAllFilter = "select distinct railway_type from station_master " StrFilterField = "railway_type" ViewQrNumeric = "C" FrmViewAll.LblCap.Caption = "View all station" FrmViewAll.LblFilter.Caption = "Filter by railway :" IntViewID = 0 FrmViewAll.Show 1 '>>>check view id if any id return from the grid '>>> get the record If IntViewID > 0 Then Dim p As Integer Rs1.Find "station_id = " & IntViewID p = Rs1.AbsolutePosition '>> Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord
Page: 54/107
End If End Sub Private Sub Command1_Click() '>>> close form Unload Me End Sub Private Sub Command11_Click() '>>> delete current record '>>> only admin user can delete record If CheckAdminValid(UserType) = False Then Exit Sub If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub On Error GoTo myer1 '>>> confirm before delete If MsgBox("Delete the Record ? ", vbCritical + vbYesNo) = vbYes Then Rs1.Delete Call ClearText '>>> show next record Command4_Click End If Exit Sub myer1: MsgBox "Error Occured : " & Err.Description, vbCritical End Sub Private Sub Command2_Click() '>>> move record set to first record and display the record On Error Resume Next If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub Rs1.MoveFirst Call displayRecord End Sub Private Sub Command3_Click() '>>> move record set back and display the record On Error Resume Next If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub '>>> check for recordset position If Rs1.AbsolutePosition > 1 Then Rs1.MovePrevious Else MsgBox "First Record ..", vbInformation Rs1.MoveFirst End If Call displayRecord End Sub
Page: 55/107
Page: 56/107
''On Error GoTo myer1 '>>> valdation If Trim(TxtStationCode.Text) = "" Then MsgBox "Enter station code.", vbExclamation TxtStationCode.SetFocus Exit Sub End If If Trim(TxtStationName.Text) = "" Then MsgBox "Enter station name.", vbExclamation TxtStationName.SetFocus Exit Sub End If If Trim(TxtRailWay.Text) = "" Then MsgBox "Enter Railway.", vbExclamation TxtStationName.SetFocus Exit Sub End If '>>> check the add edit flag If AddEdit = "ADD" Then Dim LastSno As Integer Dim Rs2 As New ADODB.Recordset If Rs2.State = 1 Then Rs2.Close Rs2.Open "select max(station_id) from station_master", Cn, adOpenStatic, adLockReadOnly LastSno = IIf(IsNull(Rs2(0).Value) = True, 0, Rs2(0).Value) + 1 Rs1.AddNew Rs1("station_id") = LastSno Rs1("station_code") = TxtStationCode.Text Rs1("station_name") = TxtStationName.Text Rs1("railway_type") = TxtRailWay.Text Rs1.Update Rs1.MoveLast Call displayRecord Else Rs1("station_code") = TxtStationCode.Text Rs1("station_name") = TxtStationName.Text Rs1("railway_type") = TxtRailWay.Text Rs1.Update Dim p As Integer p = Rs1.AbsolutePosition Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord End If DE True, False Exit Sub
Page: 57/107
myer1: MsgBox "Error Occured : " & Err.Description, vbCritical End Sub Private Sub Command9_Click() DE True, False End Sub Private Sub Form_Load() Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 ClearText If Rs1.State = adStateOpen Then Rs1.Close Rs1.Open "select * from station_master order by station_id ", Cn, adOpenDynamic, adLockOptimistic If Rs1.RecordCount > 0 Then Rs1.MoveFirst Call displayRecord End If DE True, False End Sub Private Sub ClearText() TxtStationID.Text = "" TxtStationCode.Text = "" TxtStationName.Text = "" TxtRailWay.Text = "" End Sub Private Sub displayRecord() On Error Resume Next TxtStationID.Text = IIf(IsNull(Rs1("station_id")) = True, "", Rs1("station_id")) TxtStationCode.Text = IIf(IsNull(Rs1("station_code")) = True, "", Rs1("station_code")) TxtStationName.Text = IIf(IsNull(Rs1("station_name")) = True, "", Rs1("station_name")) TxtRailWay.Text = IIf(IsNull(Rs1("railway_type")) = True, "", Rs1("railway_type")) Label17.Caption = Rs1.AbsolutePosition & "/" & Rs1.RecordCount End Sub Private Sub DE(t1 As Boolean, t2 As Boolean) '>>> enable / diable buttons Command2.Enabled = t1 Command3.Enabled = t1 Command4.Enabled = t1 Command5.Enabled = t1 Command6.Enabled = t1 Command7.Enabled = t1 Command11.Enabled = t1 Command8.Enabled = t2 Command9.Enabled = t2 End Sub
Page: 58/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim AddEdit As String Private Sub ChkViewAll_Click() '>>> pass parameter to view all form StrViewAll = "select * from train_master view_all_filter order by train_no " StrViewAllFilter = "select distinct train_type from train_type_master " StrFilterField = "train_type" ViewQrNumeric = "C" FrmViewAll.LblCap.Caption = "View all train" FrmViewAll.LblFilter.Caption = "Filter by train type :" IntViewID = 0 FrmViewAll.Show 1 '>>>check view id if any id return from the grid '>>> get the record If IntViewID > 0 Then Dim p As Integer Rs1.Find "train_no = " & IntViewID p = Rs1.AbsolutePosition '>> Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord
Page: 59/107
Page: 60/107
Page: 61/107
Page: 62/107
Page: 63/107
Page: 64/107
Private Function GetSchedule() As String Dim s1 As String s1 = "" If ChkMO.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkTU.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkWE.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkTH.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkFR.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkSA.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If If ChkSU.Value = 1 Then s1 = s1 & "1|" Else s1 = s1 & "0|" End If GetSchedule = s1 End Function
Page: 65/107
Page: 66/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim AddEdit As String Private Sub ChkViewAll_Click() '>>> pass parameter to view all form StrViewAll = "SELECT train_schedule.schedule_id, train_schedule.train_no, station_master.station_code, station_master.station_name, train_schedule.distance, train_schedule.arival_time, train_schedule.departure_time, train_schedule.day " _ & " FROM station_master INNER JOIN train_schedule ON station_master.station_id = train_schedule.station_id view_all_filter order by schedule_id " StrViewAllFilter = "select train_no from train_master " StrFilterField = "train_no" ViewQrNumeric = "N" FrmViewAll.LblCap.Caption = "View all schedule" FrmViewAll.LblFilter.Caption = "Filter by train no :" IntViewID = 0 FrmViewAll.Show 1 '>>>check view id if any id return from the grid '>>> get the record If IntViewID > 0 Then Dim p As Integer Rs1.Find "schedule_id = " & IntViewID p = Rs1.AbsolutePosition '>> Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord End If End Sub Private Sub Command1_Click() '>>> close form Unload Me End Sub Private Sub Command11_Click() '>>> delete current record '>>> only admin user can delete record If CheckAdminValid(UserType) = False Then Exit Sub If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub On Error GoTo myer1 '>>> confirm before delete
Page: 67/107
Page: 68/107
Private Sub Command5_Click() '>>> move record set to last record and display the record On Error Resume Next If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub Rs1.MoveLast Call displayRecord End Sub Private Sub Command6_Click() '>>> add new record '>>> set flag to add '>>> clear all fields If Rs1.State = adStateClosed Then Exit Sub AddEdit = "ADD" Call ClearText DE False, True CmbTrainNo.SetFocus End Sub Private Sub Command7_Click() '>>> edit the current record '>>> set flag to edit If Rs1.State = adStateClosed Then Exit Sub If Rs1.RecordCount <= 0 Then Exit Sub AddEdit = "EDIT" DE False, True CmbTrainNo.SetFocus End Sub Private Sub Command8_Click() '>>> update the record '>>> check the flag If Rs1.State = adStateClosed Then Exit Sub ''On Error GoTo myer1 '>>> valdation If Trim(CmbTrainNo.Text) = "" Then MsgBox "Select train no.", vbExclamation CmbTrainNo.SetFocus Exit Sub End If If Trim(CmbStation.Text) = "" Then MsgBox "Select station.", vbExclamation CmbStation.SetFocus Exit Sub End If
Page: 69/107
Rs1.AddNew Rs1("schedule_id") = LastSno Rs1("train_no") = Val(CmbTrainNo.Text) Rs1("station_id") = ReturnText("select station_id from station_master where station_code ='" & CmbStation.Text & "'") Rs1("distance") = Val(TxtDistance.Text) Rs1("arival_time") = DtArrivalTime.Value Rs1("departure_time") = DtDepartureTime.Value Rs1("day") = Val(TxtDay.Text)
Rs1.Update Rs1.MoveLast Call displayRecord Else Rs1("train_no") = Val(CmbTrainNo.Text) Rs1("station_id") = ReturnText("select station_id from station_master where station_code ='" & CmbStation.Text & "'") Rs1("distance") = Val(TxtDistance.Text) Rs1("arival_time") = DtArrivalTime.Value Rs1("departure_time") = DtDepartureTime.Value Rs1("day") = Val(TxtDay.Text) Rs1.Update Dim p As Integer p = Rs1.AbsolutePosition Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord End If
Page: 70/107
DE True, False Exit Sub myer1: MsgBox "Error Occured : " & Err.Description, vbCritical End Sub Private Sub Command9_Click() DE True, False End Sub Private Sub Form_Load() Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 ClearText '>>> fill train no FillCombo "select train_no from train_master order by train_no", CmbTrainNo '>>> fill station FillCombo "select station_code from station_master order by station_code", CmbStation If Rs1.State = adStateOpen Then Rs1.Close Rs1.Open "select * from train_schedule order by schedule_id ", Cn, adOpenDynamic, adLockOptimistic If Rs1.RecordCount > 0 Then Rs1.MoveFirst Call displayRecord End If DE True, False
End Sub Private Sub ClearText() TxtScheduleID.Text = "" CmbTrainNo.Text = "" CmbStation.Text = "" TxtDistance.Text = 0 TxtDay.Text = 1 End Sub Private Sub displayRecord() On Error Resume Next TxtScheduleID.Text = IIf(IsNull(Rs1("schedule_id")) = True, "", Rs1("schedule_id")) CmbTrainNo.Text = IIf(IsNull(Rs1("train_no")) = True, "", Rs1("train_no")) CmbStation.Text = ReturnText("select station_code from station_master where station_id =" & Rs1("station_id")) TxtDistance.Text = IIf(IsNull(Rs1("distance")) = True, "0", Rs1("distance")) DtArrivalTime.Value = IIf(IsNull(Rs1("arival_time")) = True, Time, Rs1("arival_time")) DtDepartureTime.Value = IIf(IsNull(Rs1("departure_time")) = True, Time, Rs1("departure_time")) TxtDay.Text = IIf(IsNull(Rs1("day")) = True, "0", Rs1("day"))
Page: 71/107
Page: 72/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim AddEdit As String Private Sub ChkViewAll_Click() '>>> pass parameter to view all form StrViewAll = "select * from stage_master view_all_filter order by stage_id " StrViewAllFilter = "select distinct coach_type from coach_type_master " StrFilterField = "coach_type" ViewQrNumeric = "C" FrmViewAll.LblCap.Caption = "View all satge" FrmViewAll.LblFilter.Caption = "Filter by coach type :" IntViewID = 0 FrmViewAll.Show 1 '>>>check view id if any id return from the grid '>>> get the record If IntViewID > 0 Then Dim p As Integer Rs1.Find "stage_id = " & IntViewID p = Rs1.AbsolutePosition '>> Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord
Page: 73/107
Page: 74/107
Page: 75/107
Rs1.AddNew Rs1("stage_id") = LastSno Rs1("coach_type") = CmbCoachType.Text Rs1("dis_from") = Val(TxtDistanceFrom.Text) Rs1("dis_upto") = Val(TxtDistanceUpto.Text) Rs1("ticket_amount") = Val(TxtFare.Text) Rs1.Update Rs1.MoveLast Call displayRecord Else Rs1("coach_type") = CmbCoachType.Text Rs1("dis_from") = Val(TxtDistanceFrom.Text) Rs1("dis_upto") = Val(TxtDistanceUpto.Text) Rs1("ticket_amount") = Val(TxtFare.Text)
Page: 76/107
Rs1.Update Dim p As Integer p = Rs1.AbsolutePosition Rs1.Requery Rs1.MoveFirst Rs1.Move p - 1 Call displayRecord End If DE True, False Exit Sub myer1: MsgBox "Error Occured : " & Err.Description, vbCritical End Sub Private Sub Command9_Click() DE True, False End Sub Private Sub Form_Load() Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 ClearText '>>> fill coach type FillCombo "select coach_type from coach_type_master ", CmbCoachType If Rs1.State = adStateOpen Then Rs1.Close Rs1.Open "select * from stage_master order by stage_id ", Cn, adOpenDynamic, adLockOptimistic If Rs1.RecordCount > 0 Then Rs1.MoveFirst Call displayRecord End If DE True, False
End Sub Private Sub ClearText() TxtStageID.Text = "" CmbCoachType.Text = "" TxtDistanceFrom.Text = 0 TxtDistanceUpto.Text = 0 TxtFare.Text = 0 End Sub Private Sub displayRecord() On Error Resume Next TxtStageID.Text = IIf(IsNull(Rs1("stage_id")) = True, "", Rs1("stage_id")) CmbCoachType.Text = IIf(IsNull(Rs1("coach_type")) = True, "", Rs1("coach_type")) TxtDistanceFrom.Text = IIf(IsNull(Rs1("dis_from")) = True, 0, Rs1("dis_from")) TxtDistanceUpto.Text = IIf(IsNull(Rs1("dis_upto")) = True, "", Rs1("dis_upto")) TxtFare.Text = IIf(IsNull(Rs1("ticket_amount")) = True, "", Rs1("ticket_amount"))
Page: 77/107
Option Explicit Dim Rs1 As New ADODB.Recordset Dim Rs2 As New ADODB.Recordset Private Sub CmbTrainNo_Change()
Page: 78/107
Page: 79/107
If CheckListValue(CmbStationFrom.Text, CmbStationFrom) = False Then MsgBox "Select station from.", vbExclamation CmbStationFrom.SetFocus Exit Sub End If If CheckListValue(CmbUpto.Text, CmbUpto) = False Then MsgBox "Select station upto.", vbExclamation CmbUpto.SetFocus Exit Sub End If If CheckListValue(CmbBoardingAt.Text, CmbBoardingAt) = False Then MsgBox "Select boarding at.", vbExclamation CmbBoardingAt.SetFocus Exit Sub End If '>>> check wheather train start this day from schedule Dim AvaialbaleCaoch As Integer If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from train_master where train_no =" & Val(CmbTrainNo.Text), Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then '>>> display train name LblTrainName.Caption = Rs1("train_name") Dim a() As String a = Split(Rs1("schedule"), "|") Dim Jday As String Dim Ch As Boolean Ch = True Jday = UCase(Format(DtJourneyDate.Value, "DDD")) If Jday = "MON" Then If a(0) = 0 Then Ch = False End If End If If Jday = "TUE" Then If a(1) = 0 Then Ch = False End If End If If Jday = "WED" Then If a(2) = 0 Then Ch = False End If End If If Jday = "THU" Then If a(3) = 0 Then Ch = False End If
Page: 80/107
End If If Jday = "FRI" Then If a(4) = 0 Then Ch = False End If End If If Jday = "SAT" Then If a(5) = 0 Then Ch = False End If End If If Jday = "SUN" Then If a(6) = 0 Then Ch = False End If End If If Ch = False Then MsgBox "Selected Train not start in " & Format(DtJourneyDate.Value, "Dddd"), vbExclamation Exit Sub End If '>>> get the no of coach AvaialbaleCaoch = Rs1(CmbCoachType.Text) Else MsgBox "No Details found for the selected train no.", vbExclamation LblTrainName.Caption = "" CmbTrainNo.SetFocus Exit Sub End If '>>> check for available seat '>>> get the coach type '>>> get the no of coach from train master '>>> get the no of seats by mutiple coach no * no of seats '>>> get the already booked seat for the date If AvaialbaleCaoch <= 0 Then MsgBox CmbCoachType.Text & " coach not availavle in train " & CmbTrainNo.Text, vbExclamation CmbCoachType.SetFocus Exit Sub End If Dim TotalSeat As Integer If CmbCoachType.Text = "A1" Then TotalSeat = AvaialbaleCaoch * 36 ElseIf CmbCoachType.Text = "A2" Then TotalSeat = AvaialbaleCaoch * 54 Else TotalSeat = AvaialbaleCaoch * 74 End If
Page: 81/107
End Sub Private Sub Command2_Click() '>>> clear all ClearText End Sub Private Sub Command3_Click() '>>> save the record '>>> validate details again '>>> populate the data, and confirm before save. '>>> validate '>>> validation for all details entered to check the status '>>> check journey date '>>> it should be less than 90 days. If DateDiff("d", Now, DtJourneyDate.Value) > 90 Then MsgBox "Check journey date, it shoud be less than 90 days.", vbExclamation DtJourneyDate.SetFocus Exit Sub End If If DtJourneyDate.Value < Date Then MsgBox "Journey date must not less than the current date.", vbExclamation DtJourneyDate.SetFocus Exit Sub End If If CheckListValue(CmbTrainNo.Text, CmbTrainNo) = False Then MsgBox "Select train no.", vbExclamation CmbTrainNo.SetFocus Exit Sub End If If CheckListValue(CmbCoachType.Text, CmbCoachType) = False Then MsgBox "Select coach type.", vbExclamation CmbCoachType.SetFocus Exit Sub End If If CheckListValue(CmbStationFrom.Text, CmbStationFrom) = False Then MsgBox "Select station from.", vbExclamation CmbStationFrom.SetFocus Exit Sub End If
Page: 82/107
'>>> check wheather train start this day from schedule Dim AvaialbaleCaoch As Integer If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from train_master where train_no =" & Val(CmbTrainNo.Text), Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then '>>> display train name LblTrainName.Caption = Rs1("train_name") Dim a() As String a = Split(Rs1("schedule"), "|") Dim Jday As String Dim Ch As Boolean Ch = True Jday = UCase(Format(DtJourneyDate.Value, "DDD")) If Jday = "MON" Then If a(0) = 0 Then Ch = False End If End If If Jday = "TUE" Then If a(1) = 0 Then Ch = False End If End If If Jday = "WED" Then If a(2) = 0 Then Ch = False End If End If If Jday = "THU" Then If a(3) = 0 Then Ch = False End If End If If Jday = "FRI" Then If a(4) = 0 Then Ch = False End If
Page: 83/107
Page: 84/107
Page: 85/107
MsgBox "Selected station not found in the train schedule.", vbExclamation CmbStationFrom.SetFocus Exit Sub End If If Rs1.State = 1 Then Rs1.Close Rs1.Open "select distance from train_schedule where train_no =" & Val(CmbTrainNo.Text) & " and station_id = (select station_id from station_master where station_code='" & CmbUpto.Text & "')", Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then EndDistance = Rs1(0) Else MsgBox "Selected station not found in the train schedule.", vbExclamation CmbUpto.SetFocus Exit Sub End If Dim TotalDistance As Integer TotalDistance = EndDistance - StartDistanace If TotalDistance <= 0 Then MsgBox "Select strat station and end station properly.", vbExclamation CmbStationFrom.SetFocus Exit Sub End If '>>> get the fare from stage_master table If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from stage_master where coach_type='" & CmbCoachType.Text & "' order by stage_id ", Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then Rs1.MoveFirst For i = 0 To Rs1.RecordCount If TotalDistance > Rs1("dis_from") And TotalDistance <= Rs1("dis_upto") Then TicketFare = Rs1("ticket_amount") Exit For End If Rs1.MoveNext Next Else MsgBox "No fare details found for the train.", vbExclamation Exit Sub End If TxtTotalFees.Text = TicketFare * c + Val(TxtReservationFees.Text) + Val(TxtSuperFastFees.Text) '>>> save the record '>>> open the transaction to hold, for final confirmation Cn.BeginTrans Dim PrnID As Integer If Rs1.State = 1 Then Rs1.Close Rs1.Open "select max(prn_NO) from reservation_master", Cn, adOpenStatic, adLockReadOnly PrnID = IIf(IsNull(Rs1(0)) = True, 0, Rs1(0)) + 1 TxtPrnNo.Text = PrnID
Page: 86/107
Dim TrnId As Integer If Rs1.State = 1 Then Rs1.Close Rs1.Open "select max(trn_id) from reservation_transaction ", Cn, adOpenStatic, adLockReadOnly TrnId = IIf(IsNull(Rs1(0)) = True, 0, Rs1(0)) + 1 Dim CashId As Integer If Rs1.State = 1 Then Rs1.Close Rs1.Open "select max(cash_id) from cash_master ", Cn, adOpenStatic, adLockReadOnly CashId = IIf(IsNull(Rs1(0)) = True, 0, Rs1(0)) + 1 '>>> save in reservation master If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from reservation_master where 1=2 ", Cn, adOpenDynamic, adLockOptimistic Rs1.AddNew Rs1("prn_no") = PrnID Rs1("train_no") = Val(CmbTrainNo.Text) Rs1("coach_type") = CmbCoachType.Text Rs1("journey_date") = DtJourneyDate.Value Rs1("from_station") = Val(ReturnText("select station_id from station_master where station_code='" & CmbStationFrom.Text & "'")) Rs1("to_station") = Val(ReturnText("select station_id from station_master where station_code='" & CmbUpto.Text & "'")) Rs1("boarding_at") = Val(ReturnText("select station_id from station_master where station_code='" & CmbBoardingAt.Text & "'")) Rs1("re_fees") = Val(TxtReservationFees.Text) Rs1("sf_fees") = Val(TxtSuperFastFees.Text) Rs1("ti_fees") = Val(TxtTotalFees.Text) Rs1("cancel_fees") = 0 Rs1("create_by") = UserID Rs1("create_date") = Now Rs1.Update '>>> save in reservation transaction If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from reservation_transaction where 1=2 ", Cn, adOpenDynamic, adLockOptimistic For i = 0 To c - 1 Rs1.AddNew Rs1("trn_id") = TrnId Rs1("prn_no") = PrnID Rs1("p_name") = TxtPassenger(i).Text Rs1("p_gender") = CmbSex(i).Text Rs1("p_age") = TxtAge(i).Text Rs1("confirm") = "Y" '>>> get coach /seat no If Rs2.State = 1 Then Rs2.Close Rs2.Open "select seat_no,coach from reservation_transaction where prn_no in (select prn_no from reservation_master where format(journey_date,'dd-MMM-yy')='" & Format(DtJourneyDate.Value, "dd-MMMyy") & "' and coach_type ='" & CmbCoachType.Text & "' ) order by coach , seat_no desc ", Cn If Rs2.RecordCount <= 0 Then Rs1("seat_no") = 1 Rs1("coach") = 1 Else Dim SNo, CNo As Integer SNo = Rs2("seat_no") CNo = Rs2("coach")
Page: 87/107
Page: 88/107
Cn.CommitTrans MsgBox "Ticket saved.", vbInformation ClearText End If End Sub Private Sub Command4_Click() Unload Me End Sub Private Sub Form_Load() FillCombo "select train_no from train_master order by train_no", CmbTrainNo FillCombo "select coach_type from coach_type_master ", CmbCoachType Dim i As Integer For i = 0 To 5 CmbSex(i).AddItem "M" CmbSex(i).AddItem "F" Next ClearText End Sub Private Sub ClearText() TxtPrnNo.Text = "" DtJourneyDate.Value = Date CmbTrainNo.Text = "" LblTrainName.Caption = "" CmbCoachType.Text = "" CmbStationFrom.Text = "" CmbUpto.Text = "" CmbBoardingAt.Text = "" Dim i As Integer For i = 0 To 5 TxtPassenger(i).Text = "" TxtAge(i).Text = "" CmbSex(i).Text = "" TxtCoach(i).Text = "" TxtSeat(i).Text = "" Next TxtReservationFees.Text = "" TxtSuperFastFees.Text = "" TxtTotalFees.Text = "" End Sub
Page: 89/107
Option Explicit Dim Rs1 As New ADODB.Recordset Private Sub Command2_Click() TxtPrnNo.Text = "" ClearText TxtPrnNo.SetFocus End Sub Private Sub Command3_Click() '>> validate If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from reservation_master where prn_no=" & Val(TxtPrnNo.Text), Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then '>>> check for already cancelled If IsNull(Rs1("cancel_date")) = False Then MsgBox "PRN no already cancelled.", vbExclamation Exit Sub End If
Page: 90/107
Page: 91/107
Page: 92/107
Private Sub TxtPrnNo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then ClearText If Rs1.State = 1 Then Rs1.Close Rs1.Open "select * from reservation_master where prn_no=" & Val(TxtPrnNo.Text), Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then '>>> check for already cancelled If IsNull(Rs1("cancel_date")) = False Then MsgBox "PRN no already cancelled.", vbExclamation Command3.Enabled = False 'Exit Sub End If '>>> check for already journey start Dim StrStartTime As String Dim Rs2 As New ADODB.Recordset If Rs2.State = 1 Then Rs2.Close Rs2.Open "select * from train_schedule where train_no =" & Rs1("train_no") & " order by schedule_id ", Cn, adOpenStatic, adLockReadOnly StrStartTime = Format(Rs2("arival_time"), "HH:nn") If Rs2.State = 1 Then Rs2.Close If CDate(Format(Rs1("journey_date"), "dd-MMM-yy ") & StrStartTime) < Now Then MsgBox "You can not cancel this ticket, journey date expired.", vbExclamation Exit Sub End If TxtJourney.Text = Rs1("journey_date") TxtTrainNo.Text = Rs1("train_no") TxtCoachType.Text = Rs1("coach_type") TxtStationFrom.Text = Rs1("from_station") TxtUpto.Text = Rs1("to_station") TxtBoarding.Text = Rs1("boarding_at") TxtReservationFees.Text = Rs1("re_fees") TxtSuperFastFees.Text = Rs1("re_fees") TxtTotalFees.Text = Rs1("ti_fees") If IsNull(Rs1("cancel_date")) = False Then Command3.Enabled = False TxtCancellationFees.Text = Rs1("cancel_fees") TxtTotalRefund.Text = Val(TxtTotalFees.Text) - Val(TxtCancellationFees.Text) Else Command3.Enabled = True TxtCancellationFees.Text = "" TxtTotalRefund.Text = "" End If
Page: 93/107
'>>> get details from reservation trnsaction If Rs2.State = 1 Then Rs2.Close Rs2.Open "select * from reservation_transaction where prn_no =" & Val(TxtPrnNo.Text) & " order by trn_id ", Cn, adOpenStatic, adLockReadOnly If Rs2.RecordCount > 0 Then Dim i As Integer Rs2.MoveFirst For i = 0 To Rs2.RecordCount - 1 TxtPassenger(i).Text = Rs2("p_name") TxtAge(i).Text = Rs2("p_age") CmbSex(i).Text = Rs2("p_gender") TxtCoach(i).Text = Rs2("coach") TxtSeat(i).Text = Rs2("seat_no") Rs2.MoveNext Next End If Else MsgBox "Invalid PRN no, no deatils found.", vbExclamation Exit Sub End If End If End Sub
Page: 94/107
Page: 95/107
Page: 96/107
Page: 97/107
Option Explicit Dim Rs1 As New ADODB.Recordset Private Sub Command2_Click() TxtPrnNo.Text = "" ClearText TxtPrnNo.SetFocus End Sub Private Sub Command4_Click() Unload Me End Sub Private Sub Form_Load() TxtPrnNo.Text = "" ClearText End Sub Page: 98/107
Page: 99/107
Page: 100/107
Test Scope
The scope of the user acceptance testing covers: Version 1 of the Railway Reservation System User-facing functionality defined by a set of use cases Administrator-facing functionality defined by a set of use cases
The aim of the testing is to determine how well the application meets its functional requirements from the perspective of the user, and to identify any issues so they can be resolved. Also, the testing serves to compile a set of test data and results that can be used during subsequent test cycles, to test for non-regression of the software in later releases or after the application is in maintenance. Working practices might vary from user to user and are considered outside the scope of the testing.
Page: 101/107
Test Strategy
The basis of user acceptance testing is that other tests were completed successfully, so the application and its required infrastructure are considered to be stable and reliable. Acceptance testing concentrates on the application from the users perspective, that is, how the application is used and whether it meets the necessary quality criteria. Change requests will be sent to the development team as the actionable documentation. Change criteria will be determined by the Test team and the Development team prior to the beginning of testing. For instance, criteria may include impact to desired functionality, amount of code impacted by proposed change, and design required by proposed change. The tester will evaluate the criteria. The test lead will determine Change Required or not. Once a bug has been determined as Change Required, the bug report will be translated into a Change Request and passed on to development. The customer of the acceptance testing is the System Users, Supervisor and Adminstratorfor Railway Reservation System. The progress of the acceptance testing will be reported to the customer, together with any issues that are discovered and their planned resolutions. Signoff of the tests, and therefore the acceptance of the application, will be performed by the customer or a selected representative.
Preconditions
The following items are required before testing can take place: A complete and coherent functional specification of the Railway Reservation System expressed as use cases and usage scenarios A complete and validation-tested release of Railway Reservation System, delivered according to the delivery plan An agreed-upon procedure for dealing with any anomalies that are discovered during the testing process A set of test specifications describing how each functional area of the Railway Reservation System is to be acceptance tested An implemented test environment for the testing Sufficient, suitable resources to carry out the testing Available standards for the acceptance testing
Test Priorities
During testing of the Railway Reservation System, the following qualities will be tested in order of priority: Functionalitywhether the required functions are available and working as expected Usabilityhow user-friendly and intuitive the Railway Reservation System is Securityhow well-protected and guaranteed corporate and user data is Performancewhether the response times are within acceptable limits Customizationhow straightforward it is to use the application in new, unpredicted ways
Page: 102/107
Test Techniques
The following techniques will be applied: Scripted testssequences of user interactions (based on the use case and usage scenarios) using predefined data sets against predicted results Unscripted testsbased on scripted tests, the tester tries to modify the scenarios to explore what-if possibilities Penetration testsscripted tests to attempt unauthorized entry into the system Usability checkliststests to determine the complexity of interactions Performance statisticsgeneration of performance information to check against desired performance criteria
Weekly team meetings will be held involving the test manager, testers, and product managers. At these meetings, the progress of the testing process will be reported, any issues will be discussed, and actions will be agreed upon.
Deliverables
The following deliverables will be expected from the user acceptance testing process: Test planthis document, together with any updates that have occurred during the testing process Change requestsany bugs, defects, or other changes required to the Railway Reservation System as a result of the testing process Weekly reportsprogress reports to enable the status of the testing process to be determined Completion reporta report to be signed off by the customer, to signify the successful completion of the user acceptance testing
Page: 103/107
Two Intel-based client laptop computers, each running: Microsoft Windows XP Professional Microsoft Office
The following additional hardware will be required: One laser printer to print reports One color printer (laser or inkjet) to print screen dumps One CD-ROM drive to enable clean installation of the Railway Reservation System Networking connectivity to permit interconnection of the server, clients.
Application Configuration
The following user accounts will be configured on the server: System Administrator System Users 1 System Users 2 Supervisor
Page: 104/107
Test Management
Tests shall be managed according to the corporate test management standards, which cover: Conduct of tests Reporting of test results Defect tracking and resolution Configuration management of the test environment Configuration control of test deliverables.
Testing Schedules
The user acceptance testing schedules are shown in the project structure document and resulting Gantt charts.
Threats to Testing
Potential threats to the testing process are as follows: Insufficient resources available for testing. Testing resources have been seconded from the development departments, whose time is at a premium. Mitigation: ensure department heads apply a high priority to the testing of the Railway Reservation System. Availability of sales personnel for testing. The test team should be overseen by at least one sales representative. Mitigation: gain prior agreement from the vice president of Sales for two sales representatives to be assigned to test the application.
Page: 105/107
Linking and integration of any legacy system for accounting. Integration with travel agent through Web Services Connection to third-party OLAP applications Electronic Data Interchange (EDI) system between banks, other credit verification agency and their vendors In the area of data security and system security. Provide more online tips and help. To optimize the query which is embedded in the system.
Page: 106/107
Bibliography
Websites
http://www.google.com http://www.microsoft.com http://www.programmer2programmer.net http://www.codeproject.com http://www.msdn.com. http://www.vb123.com http://www.vbcode.com http://www.sqltuner.com
Books
Mastering Visual Basic 6 (Paperback) Mastering Visual Basic .NET (Paperback) Visual Basic Black Book (Paperback) SQL Bible, 2nd Edition (Paperback) Database Development in Visual Basic
Page: 107/107