This is a Project carried on by me in my BCA degree
Food Distribution Management System.
Responsibilities :
•Understand the nature and procedure of ration distribution.
•Gather information of food Grains distributed to each card holder.
•Responsible to maintain right data and produce right data to the Government.
1. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 1
PREFACE
In recent years, an increasing number of industries and institutions are displaying information on
websites. This is being done mainly because they want to face the challenges of the new millennium,
which undoubtedly is computer independent.
In this era of modernity websites have become part and parcel of everyone’s day to day life. Even the
people for firms or institutions who are not associated with the websites are approaching the professionals
to develop website, which could reduce their tedious work like going and collecting information, giving
information with taking maximum time for traveling with expense and wasting the time. Websites are no
exception to this. With the help of websites it is very easy to collect information about any firm or
institution by just sitting in single computer with an internet connection.
2. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 2
Dedicated to
My
Parents & Teachers
3. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 3
1. INTRODUCTION:
" FOOD DISTRIBUTION ” is a desktop application designed to manage all the ration card
holder’s details, their family member’s details and food grains allotted to each card holder based the
number of family members. This system automates the manual record keeping system of food grains
distributed to all the card holders based on their card types.
The way our food is distributed cements in place production, consumption and trading practices
that destroy the environment harm animals and are deeply unjust.
In this era of computers and internet almost all the work in our day to day life is being
computerized. Using internet almost all works are carried out easily. Like we can say banking became
very easy with online banking, buying and selling became modernized by E-commerce web sites, people
came close to each other by social networking sites, sending messages to each other was also very
difficult and would take minimum 2 days to reach that is also modernized by Emails, chatting etc.
Here I am implementing a application known as “ FOOD DISTRIBUTION
MANAGEMENT SYSTEM ” .In this site the people of Karnataka can book the tickets for their
favorite movie just by logging on to our website. This Applications is developed to store and maintain all
the details of food distributed to the family.
All the tedious process will be minimized and even a common man can afford to do all these
things. Hence we can say that this application would be one more step towards modernizing the society.
4. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 4
Three main components of Food Distribution :
Transport infrastructure, such as roads, vehicles, rail transport, airports, and ports.
Food handling technology and regulation, such as refrigeration, and storage, warehousing.
Adequate source and supply logistics, based on demand and need.
This report examines the impact of food distribution networks on our environment, economy,
culture and communities, and their contribution to climate change.
We offer a sustainable vision for the future of food distribution, and provide a roadmap for
government, business and civil society to help get us there.
Food Distribution Features & Functionality :
Food distribution software is a specialized form of warehousing and transportation management
software. As software, food distribution management system has overcome all these problems where the
data is completely secured and centralized, where the distribution happens properly and the remaining
supplies can also be easily verified. Thus keeping the data centralized and the interface made available to
all the users makes it easy and reliable to all the distributers and the government.
5. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 5
Specific features include:
Order Entry : Order entry initiates the entire food distribution cycle, so the system should be
able to store past customer orders and display them through sorting filters. This helps users
review customer history and automatically prepare “standard orders” made by customers on a
regular basis.
Catch Weight Management : Since weight and quantities vary tremendously, a food distribution
program needs the ability to track the weights of meat and produce throughout the delivery and
distribution cycle and tie those to the ordering and accounting systems.
Inventory Control: This includes lot tracking, which can integrate with barcode scanning or
radio frequency identification (RFID) implementations to note when and where certain items
were delivered, which will be particularly useful during a food recall.
Delivery Management: Delivery management modules offer intelligent routing procedures that
result in faster delivery times. For food distribution, they’ll also need to incorporate special
transportation requirements, including refrigeration and handling care.
.
6. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 6
PROBLEM DEFINITION :
Food distribution management system in present days is manually maintained in registers and the
cards are manually seen and verified, to distribute food for respective card holder. Maintaining these
records is heavy and insecure where the records can be damaged, altered and malpracticed. Thus the
problem is that the data is open and not centralized.
As software, food distribution management system has overcome all these problems where the
data is completely secured and centralized, where the distribution happens properly and the remaining
supplies can also be easily verified. Thus keeping the data centralized and the interface made available to
all the users makes it easy and reliable to all the distributers and the government.
Food distribution software helps to maintain the accounts of the firm along with sales in a details
and clear picture. Helps easy flow of work
No need of any paper work will be involved into the system; every aspect will be saved in the
software clear. Even the client details will be saved so that communication will be made very easily.
7. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 7
EXISTING SYSTEM :
All the food distribution activities are managed manually through traditional means of record
keeping. The desired report generation is not possible and has to be carried out manually.
Records maintained and updated are not submitted back to the government. No centralized data, No data
security, Manual feed and alteration. Remaining grains records are not maintained, it has to be manually
calculated and maintained.
Limitations of Existing System :
Need more man power to keep a track on the work flow.
More paper work is involved in the business.
Takes lot of time to search for client details.
Easy work will not be involved.
Cannot keep a track on sales of the firm.
More workers are needed, in order to take care of different departments.
8. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 8
PROPOSED SYSTEM :
All the activities are managed by a set of user interfaces that takes care of data management
helping the users to easily carryout the tasks of food distribution. The proposed system also provides in
generation of reports based on different criteria with ease.
A window application is developed in such a way that software will reach all the objectives of the
firm in and proper way. Each and every departments will be assigned in the software so that there will be
a proper data of sales, transports and storages.
9. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 9
Advantages of proposed System :
It automates the management of data related to Food Distribution
It helps in the generation on report based quires
It provides the user in generation of reports based on different criteria.
Uniformed friendly, courteous drivers insure on time deliveries.
No man power required to keep a track of proper data of sales, transports and storages.
Reduce time Compatibility.
Food distribution software helps to maintain the accounts of the firm along with sales in a
details and clear picture.
Helps in frequent deliveries and with our geographical reach we can make emergency
deliveries when required.
10. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 10
2. SYSTEM REQUIREMENTS:
Front - End Tool : VB.NET.
Reason: The front tool used is VB.NET because we can develop a good front-end and also it
supports OOP concepts required for modern day programming.
Back - End Tool: Oracle.
Reason: It facilitates in handling queries, managing table data and designing a good database
system.
11. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 11
HARDWARE REQUIRMENTS :
Processor : PENTIUM IV
RAM : 512MB or above
Hard Disk : 20GB of available Hard disk space
Screen Resolution : 600 X 800
SOFTWARE REQUIRMENTS :
Platform : WINDOWS (2000, XP), WINDOWS 7
IDE : Visual Studios 2008
Database : Oracle
12. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 12
3 . INTRODUCTION TO VB.Net
So what is Visual Basic?
The” Visual” part refers to the method used to create the graphical
User interface (GUI). Rather than writing numerous lines of code to describe
The appearance and location of interface elements, you simply add pre-built
Objects into place on screen. If you’ve ever used a drawing program such
As Paint, you already have most of the skills necessary to create an effective
User Interface.
The “Basic” part refers to the BASIC (Beginners All-purpose Symbolic
Instruction Code) language, a language used by more programmers than any
other language in the history of computing. Visual Basic has evolved from the original BASIC language
an now contains several hundreds statements, functions and keywords, many of which relate directly to
the windows GUI. Beginners can create useful applications by learning just a few of the keywords, yet the
power of the language allows professionals to accomplish anything that can be accomplished using any
other Windows programming language.
The Visual Basic programming language is not unique to Visual Basic. The
Visual Basic programming system Applications Edition included in Microsoft Excel, Microsoft Access,
and many other Windows applications uses the same language. The Visual Basic Scripting Edition
(VBScript) is a widely used scripting language and a subset of the Visual Basic language. The investment
you make a in learning Visual Basic will carry over to those other areas.
VISUAL BASIC .NET IDE -2008 :
13. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 13
Visual Basic Editions
14. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 14
Visual Basic is available in three versions, each geared to meet a specific
set of development requirements .
The Visual Basic Learning Edition allows programmers to easily create powerful applications for
Microsoft Windows and Windows NT. It includes all intrinsic controls, plus grid, tab, and data-
bound controls. Documentation provided with this edition includes the Learn VB Now CD plus
the Microsoft Developer Network (MSDN) Library CDS containing full online documentation.
The Professional Edition provides computer professionals with a full featured set of tools for
developing solutions for others. It includes all the features of the Learning Edition, plus
additional ActiveX Controls, the Internet Information Server Application Designer, integrated
Visual Database Tools and Data Environment, Active Data Objects, and the Dynamic HTML
Page Designer. Documentation provided by the Professional Edition includes the Visual Studio
Professional Features book plus Microsoft Developer Network CDs containing full online
documentation.
The Enterprise Edition allows professionals to create robust distributed application in a team
setting. It includes all the features of the Professional Edition, plus Back Office tools such as SQL
Server, Microsoft Transaction Server, SNA Server,& more. Printed Documentation provided with
the Enterprise Edition includes the Visual Studio Enterprise Features book plus Microsoft
Developer Network CDs containing full online documentation.
TOOL BOX :
15. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 15
Common controls section contains like Button , Textbox ,checkbox, combobox,label ,listbox, etc
container section contains like Groupbox, Flow layout panel, panel. Menus and toolbars cestion contains
menustrip ,stuts strip ,tool strip etc data section contains datagrid view,binding source etc Components
contains error provider ,help provider etc ,printing section contains page setup, printing dialog etc ,dialog
section open dialog box , save dialog box , font dialog etc ,crystal report section contains crystal report
controls .
PROPERTY WINDOW :
16. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 16
Events :
Each control have its own events like click event, enter event, double
click event leave event mouse click event, mouse through event etc
Features of vb.net :
17. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 17
Easier to Use.
Streamlined and Modernized.
More Powerful than VB 6.0.
Higher level of access to system resources that in the
Past required the use of languages like C++.
True Object Inheritance.
Garbage Collection for better memory management.
Auto case adjusts.
No line terminators.
Requires “Begin, End”.
Still intended as RAD tool.
Fully object oriented, supports free threading.
Structured exception handling.
Modern, Powerful, True OOPS :
Inheritance, overloading, shadowing, delegates, attributes, hierarchical name spaces
Robust :
Strict type checking, initialize variables at declaration, variable declaration types.
18. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 18
44 .. IINNTTOODDUUCCTTIIOONN TTOO OORRAACCLLEE
Oracle SQL Plus:-
SQL is the standard language used to manipulate and retrieve data from these relational
databases. SQL enables a programmer or database administrator to do the following:
Modify a database's structure.
Change system security settings.
Add user permissions on databases or tables.
Query a database for information.
Update the contents of a database.
SQL was developed to service relational databases.
19. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 19
The SQL has several parts :
Data Definition language (DDL): provides commands for defining relation schemas, deleting
relations and modifying relational schemas.
Interactive data-manipulation language (DML): includes a query language based on both the
relational algebra and the tupple relational calculus.
View definition: The SQL DDL includes commands for defining views.
Transaction control language: SQL includes commands for specifying the beginning and end of
transactions.
Integrity: The SQL includes commands for specifying integrity constraints that the data stored in
the database should satisfy.
Authorization: The SQL includes commands to specify the access rights to relations and views.
Basic structure of SQL :
A relational database consists of a collection of relations, each of which is assigned a unique
name. SQL allows the use of null values to indicate that the value either is unknown or does not exist. It
allows the user to specify which attributes cannot be assigned null values.
The basic structure of an SQL expression consists of two parts
20. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 20
Data Manipulation Language (DML) :
DML is a part of SQL that manipulates data in the database. The Statements you can use in DML are
SELECT, INSERT, UPDATE and DELETE.
SELECT statement : This statement is used to select certain attributes from a table
Format: SELECT <ATTRIBUTES> FROM <TABLENAME> WHERE CONDITION;
INSERT statement : Enables the user to enter data directly into the table.
Format: INSERT INTO TABLENAME (ATTRIBUTE NAMES…)
VALUES (ATTRIBUTE VALUES);
UPDATE statement
Enables to modify the data already stored in the table.
Format: UPDATE TABLENAME
SET COLUMNNAME=VALUE
WHERE CONDITION
DELETE statement
Enables you to remove selected rows of data from a single table.
Format : DELETE FROM TABLENAME
WHERE CONDITION
21. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 21
2. Data Control Language (DCL) :
The DCL provides security for your database .The command of DCL used most frequently is
COMMIT. COMMIT statement
The COMMIT command pertains to any transactions you make in the database. It
protects the database by restricting any operations that make changes to the database.
Format :
COMMIT;
Views
A view is a personalized presentation of data from one or more tables. View do not contain or store
data, but they take data from the tables on which they are based, called base tables. As the tables the
views can also be queried, updated, inserted and deleted, with some restrictions. All operations
performed in a view actually affect the database tables of that view.
Format: CREATE VIEW VIEWNAME AS
SELECT FIELDS
FROM TABLENAME
WHERE CONDITION
Indexes
An index is an optional structure associated to tables that increases the data recovery
performance. An index is created for one or more columns of a table. After being created, an index is
automatically updated and used by ORACLE.
22. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 22
Format : CREATE INDEX INDEXNAME ON TABLENAME (
NAMEOFTHECOLUMN ASC/DESC,..)
Relational Database Management System
In an RDBMS, a database is considered to be a collection of interrelated data and programs. The data in a
database has to be related. The programs in a database perform the role manipulating this data. A database
management system is software that takes care of maintaining the database. It acts as the interface
between the database and the user.
A database that is designed on relational model of database is called a ‘Relational Database’ and
the software that helps maintain those database is called ‘Relational database Management System’. In
the relational data model, the data in a database is an organized in ‘relations’. A Relation is synonymous
with a ‘table’. A table consists of columns and rows, in which are referred to as fields and records in
DBMS terms and attributes and topples in RDBMS terms.
23. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 23
Oracle, version 8.0, is a Relational Database Management System. Being a component of the
professional and developer editions of Oracle.
Most database applications comprise of a ‘back-end’. The ‘Back-End’ part of the application
is the one which takes care of storing and retrieving the data the data. The ‘Front-End’ on the other hand,
provides a user-interface or a means by which the user can interact with the data in the back end. The user
of a particular application usually only interacts through the front-end. This comprises usually of ‘forms’,
which present the data in an attractive and user-friendly manner. It is these that are used to add, modify or
generally manipulate data in the tables.
Oracle SQL Plus acts as a back end as it provides tables where data can be stored. In
addition to this, it also acts as a front end.
Using Oracle therefore, forms can be created that act as the interface between the users the
tables.
Oracle 8-an RDBMS
24. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 24
5 . DDAATTAA FFLLOOWW DDIIAAGGRRAAMM
DFD shows the use of the data pictorially. DFD represents the flow of the data between
transformations are process in the system. The DFD show the logical flow of data. These are used in
understanding a system and can be effectively used for partitioning during analysis. A DFD does not
represent procedural information.
In drawing DFD’s the designer has to specify the major transformations in the path of data
from input to output. It helps in the modular designing. It permits better documentation, control and
management of data about data. This also plays a major role in preventing errors, redundancies and
inconsistencies.
Context Level data flow diagram:
The context level DFD shows the interaction of the system with the external
environment. It only depicts the inputs to the system and output from the system but it does not show how
they are transformed. The functional aspects of the system are not covered under context level DFD’s.
25. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 25
Data Flow diagram Notations :
1. Functional Processing:
It is represented by an oval. The processing or main transaction are
specified by this notation.
Data Flow:
It is represented by an arrow line and name of the data is specified by the side of
the line as label. This is used for data movement.
26. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 26
Data Store:
It is represented by one open end rectangle. The database used in the system
are specified by this notation.
Source or sink:
It is represented by one end rectangle. It is used for specifying from where
data comes and where it reaches.
27. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 27
Steps required in DFD :
Identify system, processing transformations. Transactions concerned with reading, validating and
formatting inputs.
Identify input transformations. Transformations concerned with reading, validating and formatting
inputs.
Identify output transformations. Transformations concerned with formatting and writing output.
Group under the output.
Function.
28. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 28
Data Flow Diagram:
Admin
CARD_TYPE
CARD_HOLDER
FAMILY_MEMBERS
GRAINS
DISTRIBUTION
LOGIN
READ/STORE
DAT A
STORAGE
29. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 29
DDAATTAABBAASSEE TTAABBLLEESS ::
TABLE NAME ADMIN:
Name Type Specification
Username Varchar(20)
Password Varchar(20)
TABLE NAME CARD TYPE:
Name Type Specification
Id Number Number(30) Primary key
Card_Name Varchar(250)
Criteria Varchar(250)
30. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 30
TABLE NAME CARD HOLDERS :
Name Type Specification
Id Number Number(30) Primary key
Name Varchar(250)
Address Varchar(250)
Annual Income Number(30)
Card_Type_Id Number(30)
TABLE NAME FAMILY MEMBERS :
Name Type Specification
Id Number Number(30) Primary Key
Name Varchar(250)
Card_Holder_Id Number(30)
31. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 31
TABLE NAME GRAINS :
Name Type Specification
Id Number Number(30) Primary Key
Name Varchar(250)
TABLE NAME DISTRIBUTION :
Name Type Specification
Id Number Number(30) Primary Key
Card_Holder_Id Number(30)
Grain_Id Number(30)
Dist_Date Date
Monthly_Liable Varchar(50)
Quantity Number(30)
32. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 32
6 . Entity Relationship Diagrams
Definition :
An Entity-Relationship diagram is a data modeling technique that creates a graphical representation of
the entities, and the relationships between entities, within an information system. (View diagram).
The three main components of an ERD are :
The entity is a person, object, place or event for which data is collected. For example, if you consider the
information system for a business, entities would include not only customers, but the customer's address,
and orders as well. The entity is represented by a rectangle and labeled with a singular noun.
The relationship is the interaction between the entities. In the example above, the
customer places an order, so the word "places" defines the relationship between that instance of a
customer and the order or orders that they place. A relationship may be represented by a diamond
shape, or more simply, by the line connecting the entities. In either case, verbs are used to label the
relationships.
The cardinality defines the relationship between the entities in terms of numbers. An entity may
be optional: for example, a sales rep could have no customers or could have one or many
customers; or mandatory: for example, there must be at least one product listed in an order. There
are several different types of cardinality notation; crow's foot notation, used here, is a common one.
In crow's foot notation, a single bar indicates one, a double bar indicates one and only one (for
example, a single instance of a product can only be stored in one warehouse), a circle indicates.
33. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 33
Data process :
A data process transforms data values.
Or
If you open a process, you can either create a new DFD or open an existing DFD in which the
process is specified. The data flows of the opened process are connected in the new diagram to
the process with the name of the opened process. Vertices, and the flows and objects
connected to them, are transferred with the flows that are connected to the decomposed process.
If a data process has decomposition at a lower level, an asterisk is placed inside the ellipse. The
data process can be opened only if it has a name.
Data store :
Or
A data store stores data passively for later access. A data store responds to requests to store and
access data. It does not generate any operations.
A data store allows values to be accessed in an order different from the order in which they were
generated.
Input flows indicate information or operations that modify the stored data such as adding or
deleting elements or changing values. Output flows indicate information retrieved from the store;
this information can be an entire value or a component of a value.
34. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 34
The steps involved in creating an ERD are :
Identify the entities.
Determine all significant interactions.
Analyze the nature of the interactions.
Draw the ERD
Entity Relationship Notations :
Peter Chen developed ERDs in 1976. Since then Charles Bachman and James Martin have added
some slight refinements to the basic ERD principles.
Entity :
An entity is an object or concept about which you want to store information.
Weak Entity :
A weak entity is an entity that must defined by a foreign key relationship with another entity as it cannot
be uniquely identified by its own attributes alone.
Entity
Entity
35. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 35
Key attributes :
A key attribute is the unique, distinguishing characteristic of the entity. For example, an employee's social
security number might be the employee's key attribute.
Multivalve attribute:
A multivalve attribute can have more than one value. For example, an employee entity can have multiple
skill values.
Derived attribute:
A derived attribute is based on another attribute. For example, an employee's monthly salary is based on
the employee's annual salary.
Relationships :
Relationships illustrate how two entities share information in the database structure.
Attribute
Attribute
Attribute
Relationship
36. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 36
Tips for Effective ER Diagrams :
1) Make sure that each entity only appears once per diagram.
2) Name every entity, relationship, and attribute on your diagram.
3) Examine relationships between entities closely. Are they necessary? Are there any relationships
Missing? Eliminate any redundant relationships. Don't connect relationships to each other.
4) Use colors to highlight important portions of your diagram.
37. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 37
ER DIAGRAM:
ADMIN
USERNAME PASSWORD
CARD_TYPE
ID CARD_NAME
CARD_HOLDER
ID NAME
FAMILY_MEMBERS
ID NAME
GRAINS
ID NAME
DISTRIBUTION
ID GRAIN_ID
DIST_DATE MONTH_LIABLE
CRITERIA
ADDRESS CARD_TYPE
CARD_HOLDER
CARD_HOLDER
ADD/FE
TCH
ADD/FET
CH
ADD/F
ETCH
ADD/FET
CH
STOCK
TYPE OF
CARD
HOLDER
ADD/FE
TCH
1
N
1
N
1
N
1
N
1
N
M
N
M
N
38. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 38
77 .. CCOODDIINNGG
LOGIN PAGE CODE :
Imports System.Data.OleDb
Public Class Login
Dim db As OleDbConnection
Dim cm As OleDbCommand
Dim dr As OleDbDataReader
Dim st As String
Dim x As Integer
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
db = GetConn()
db.Open()
End Sub
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
Private Sub ButtonClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClear.Click
TextBox_UName.Text = ""
TextBox_Pass.Text = ""
End Sub
39. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 39
Private Sub ButtonLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonLogin.Click
If TextBox_UName.Text <> "" Then
If TextBox_Pass.Text <> "" Then
st = "select password from admin where username='" + TextBox_UName.Text + "'"
dr = ReadRecs(st)
If dr.HasRows() = True Then
If dr.Read() = True Then
If (TextBox_Pass.Text = dr("password").ToString()) Then
Dim f1 As New MainForm
f1.Show()
Me.Hide()
Else
MsgBox("Invalid User")
End If
End If
Else
MsgBox("No User exists")
End If
Else
MsgBox("Enter Password")
End If
Else
MsgBox("Enter Username")
End If
End Sub
End Class
40. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 40
MAIN FORM CODE :
Public Class MainForm
Inherits System.Windows.Forms.Form
Private Sub TreeViewMain_AfterSelect(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.TreeViewEventArgs) Handles TrwMain.AfterSelect
If TrwMain.Nodes(0).Nodes(0).IsSelected = True Then
Dim frm As New Card_Information
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(0).Nodes(1).IsSelected = True Then
Dim frm As New CardHolderDetails
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(0).Nodes(2).IsSelected = True Then
Dim frm As New FamilyMembers
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(0).Nodes(3).IsSelected = True Then
Dim frm As New Grains_Info
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
41. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 41
ElseIf TrwMain.Nodes(1).Nodes(0).IsSelected = True Then
Dim frm As New Distribution
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(2).Nodes(0).IsSelected = True Then
Dim frm As New ViewCardInfo
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(2).Nodes(1).IsSelected = True Then
Dim frm As New ViewCardHolderDetails
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(2).Nodes(2).IsSelected = True Then
Dim frm As New ViewDistributions
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(2).Nodes(3).IsSelected = True Then
Dim frm As New ViewGrains
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
42. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 42
ElseIf TrwMain.Nodes(2).Nodes(4).IsSelected = True Then
Dim frm As New ViewFamilyMem
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(3).Nodes(0).IsSelected = True Then
Dim frm As New CardTypeRepFrm
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(3).Nodes(1).IsSelected = True Then
Dim frm As New CardHolderRepFrm
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(3).Nodes(2).IsSelected = True Then
Dim frm As New DistributionsRepFrm
Me.AddOwnedForm(frm)
frm.ShowDialog()
TrwMain.SelectedNode = Nothing
ElseIf TrwMain.Nodes(4).IsSelected = True Then
TrwMain.SelectedNode = Nothing
Me.Close()
End If
End Sub
43. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 43
Private Sub TrwMain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
TrwMain.Click
'If TrwMain.Nodes(5).IsSelected = True Then
' Me.Close()
'End If
End Sub
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
End Sub
End Class
44. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 44
CARD INFORMATION CODE :
Private Sub Card_Information_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'--- Opens Database Connection-----------
db = GetConn()
db.Open()
'----------------------------------------
Cmb_CardID.Visible = False
TxtCardID.Text = GetNewNo(TxtCardID, "CARD_TYPE", "ID")
st = "select ID from CARD_TYPE order by ID"
LoadCombo(Cmb_CardID, st)
Call clear()
RdBtnAdd.Checked = True
End Sub
Private Sub BtnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
BtnClear.Click
Call clear()
End Sub
45. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 45
Private Sub clear()
'RdBtnAdd.Checked = True
x = GetNewNo("CARD_TYPE", "ID")
If x = 0 Then
Cmb_CardID.Text = 1
Else
Cmb_CardID.Text = x.ToString()
End If
TextBox_CD_Name.Text = ""
TxtCriteria.Text = ""
'ButtonCmd.Text = "Save"
'Cmb_CardID.SelectedIndex = 0
End Sub
Private Sub ButtonCmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonCmd.Click
If ButtonCmd.Text = "Save" Then
If Valid() = True Then
st = "INSERT INTO CARD_TYPE VALUES(" + TxtCardID.Text + ",'" +
TextBox_CD_Name.Text + "','" + TxtCriteria.Text + "')"
res = FunExecute(st)
If (res = 1) Then
MsgBox("Record Saved")
Card_Information_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Saved")
End If
End If
Else
46. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 46
If Cmb_CardID.SelectedIndex > 0 Then
If Valid() = True Then
Dim str As String
str = "UPDATE CARD_TYPE SET CARD_NAME='" + TextBox_CD_Name.Text +
"',CRITERIA='" + TxtCriteria.Text + "' WHERE ID=" + Cmb_CardID.SelectedItem.ToString + ""
res = FunExecute(str)
If (res = 1) Then
MsgBox("Record Updated sucessfully")
Card_Information_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Updated")
End If
End If
Else
MsgBox("Select card no to be be Updated")
End If
End If
End Sub
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonDisplay.Click
Dim frm As New ViewCardInfo
frm.Show()
End Sub
47. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 47
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Delete.Click
If Cmb_CardID.SelectedIndex > 0 Then
st = "delete from CARD_TYPE where ID=" + Cmb_CardID.SelectedItem.ToString() + ""
Dim res As Integer = FunExecute(st)
If res = 1 Then
MsgBox("Record deleted Successfully")
Card_Information_Load(Nothing, Nothing)
Else
MsgBox("Problems encountered in record deletion")
End If
Else
MsgBox("Select card name to be be deleted")
End If
End Sub
Private Sub RdBtnAdd_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles RdBtnAdd.CheckedChanged
If (RdBtnAdd.Checked = True) Then
ButtonCmd.Text = "Save"
TxtCardID.Visible = True
Cmb_CardID.Visible = False
TxtCardID.Text = GetNewNo(TxtCardID, "CARD_TYPE", "ID")
Call clear()
Delete.Visible = False
End If
End Sub
48. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 48
Private Sub RdBtnModify_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles RdBtnModify.CheckedChanged
If (RdBtnModify.Checked = True) Then
ButtonCmd.Text = "Modify"
TxtCardID.Visible = False
Cmb_CardID.Visible = True
Cmb_CardID.SelectedIndex = 0
Delete.Visible = True
'st = "select ID from CARD_TYPE order by ID"
'LoadCombo(Cmb_CardID, st)
End If
End Sub
Private Sub Cmb_CandID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Cmb_CardID.SelectedIndexChanged
If (Cmb_CardID.SelectedIndex = 0) Then
TextBox_CD_Name.Text = ""
TxtCriteria.Text = ""
End If
If Cmb_CardID.SelectedIndex > 0 Then
st = "Select * from CARD_TYPE where ID=" & Cmb_CardID.SelectedItem.ToString()
cm = New OleDb.OleDbCommand(st, db)
dr = cm.ExecuteReader()
If dr.Read() = True Then
TxtCardID.Text = Cmb_CardID.SelectedItem
TextBox_CD_Name.Text = dr("CARD_NAME")
TxtCriteria.Text = dr("CRITERIA")
End If
End If
End Sub
49. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 49
Private Function Valid() As Boolean
Valid = True
If Trim(TextBox_CD_Name.Text) = "" Then
MsgBox("Enter Card Name")
TextBox_CD_Name.Focus()
Valid = False
Exit Function
End If
If Trim(TxtCriteria.Text) = "" Then
MsgBox("Enter Criteria")
TxtCriteria.Focus()
Valid = False
Exit Function
End If
End Function
Private Sub TextBox_CD_Name_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox_CD_Name.KeyPress
If e.KeyChar = vbBack Or e.KeyChar = " " Then Exit Sub
e.Handled = ChrOnly(e.KeyChar)
End Sub
Private Sub TextBox_ContactNo_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs)
If e.KeyChar = vbBack Or e.KeyChar = " " Then Exit Sub
e.Handled = NumOnly(e.KeyChar)
End Sub
End Class
50. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 50
CARD HOLDER DETAILS CODE :
Private Sub CardHolderDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'--- Opens Database Connection-----------
db = GetConn()
db.Open()
'----------------------------------------
CmbCHID.Visible = False
TxtCHID.Text = GetNewNo(TxtCHID, "CARD_HOLDER", "ID")
st = "select ID from CARD_HOLDER order by ID"
LoadCombo(CmbCHID, st)
st1 = "select ID,CARD_NAME from CARD_TYPE order by ID"
LoadCombo(ComboBox1, st1, "CARD_TYPE", "ID", "CARD_NAME", "Select Card")
Call clear()
RdBtnAdd.Checked = True
End Sub
Private Sub ButtonCmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonCmd.Click
If ButtonCmd.Text = "Save" Then
If Valid() = True Then
Dim str As String
'str = "INSERT INTO CARD_HOLDER
(ID,NAME,ADDRESS,ANNUAL_INCOME,CARD_TYPE_ID) VALUES(" + TxtCHID.Text + ",'" +
TxtCHName.Text + "','" + TxtLoc.Text + "'," + TxtAnnualIncome.Text + "," +
ComboBox1.SelectedValue + ")"
51. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 51
str = "INSERT INTO CARD_HOLDER
(ID,NAME,ADDRESS,ANNUAL_INCOME,CARD_TYPE_ID)VALUES(" + TxtCHID.Text + ",'" +
TxtCHName.Text + "','" + TxtLoc.Text + "'," + TxtAnnualIncome.Text + "," +
ComboBox1.SelectedValue.ToString() + ")"
res = FunExecute(str)
If (res = 1) Then
MsgBox("Record Saved")
CardHolderDetails_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Saved")
End If
End If
Else
If CmbCHID.SelectedIndex > 0 Then
If Valid() = True Then
Dim str1 As String
str1 = "UPDATE CARD_HOLDER SET Name='" + TxtCHName.Text + "',ADDRESS='" +
TxtLoc.Text + "',ANNUAL_INCOME=" + TxtAnnualIncome.Text + ",CARD_TYPE_ID=" +
ComboBox1.SelectedValue.ToString() + " WHERE ID=" + CmbCHID.SelectedItem.ToString() + ""
res = FunExecute(str1)
If (res = 1) Then
MsgBox("Record Updated sucessfully")
CardHolderDetails_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Updated")
End If
End If
Else
MsgBox("Select card no to be be Updated")
End If
End If
End Sub
52. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 52
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonDisplay.Click
Dim frm As New ViewCardHolderDetails
frm.Show()
End Sub
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Delete.Click
If CmbCHID.SelectedIndex > 0 Then
st = "delete from CARD_HOLDER where ID=" + CmbCHID.SelectedItem.ToString() + ""
Dim res As Integer = FunExecute(st)
If res = 1 Then
MsgBox("Record deleted Successfully")
CardHolderDetails_Load(Nothing, Nothing)
Else
MsgBox("Problems encountered in record deletion")
End If
Else
MsgBox("Select card name to be be deleted")
End If
End Sub
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
Private Sub RdBtnAdd_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnAdd.CheckedChanged
If (RdBtnAdd.Checked = True) Then
ButtonCmd.Text = "Save"
TxtCHID.Visible = True
CmbCHID.Visible = False
TxtCHID.Text = GetNewNo(TxtCHID, "CARD_HOLDER", "ID")
Call clear()
53. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 53
Delete.Visible = False
BtnClear.Visible = True
End If
End Sub
Private Sub RdBtnModify_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnModify.CheckedChanged
If (RdBtnModify.Checked = True) Then
ButtonCmd.Text = "Modify"
TxtCHID.Visible = False
CmbCHID.Visible = True
CmbCHID.SelectedIndex = 0
Delete.Visible = True
'st = "select ID from CARD_TYPE order by ID"
'LoadCombo(Cmb_CardID, st)
End If
End Sub
Private Sub CmbCHID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmbCHID.SelectedIndexChanged
If (CmbCHID.SelectedIndex = 0) Then
TxtCHName.Text = ""
TxtLoc.Text = ""
TxtAnnualIncome.Text = ""
ComboBox1.Text = ""
End If
If CmbCHID.SelectedIndex > 0 Then
Dim st1 As String
st1 = "Select * from CARD_HOLDER where ID=" + CmbCHID.SelectedItem.ToString() + ""
cm = New OleDb.OleDbCommand(st1, db)
dr = cm.ExecuteReader()
54. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 54
If dr.Read() = True Then
TxtCHName.Text = dr("NAME").ToString()
TxtLoc.Text = dr("ADDRESS").ToString()
TxtAnnualIncome.Text = dr("ANNUAL_INCOME").ToString()
ComboBox1.Text = dr("cARD_TYPE_ID").ToString()
End If
End If
End Sub
Private Sub BtnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
BtnClear.Click
Call clear()
'RdBtnAdd.Checked = True
'x = obj.GetMaxID("CARD_HOLDER", "ID")
'If x = 0 Then
' CmbCHID.Text = 1
'Else
' CmbCHID.Text = x.ToString()
'End If
End Sub
Private Function Valid() As Boolean
Valid = True
If Trim(TxtCHName.Text) = "" Then
MsgBox("Enter Cardholder Name")
TxtCHName.Focus()
Valid = False
Exit Function
End If
55. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 55
If Trim(TxtLoc.Text) = "" Then
MsgBox("Enter Address")
TxtLoc.Focus()
Valid = False
Exit Function
End If
If Trim(TxtAnnualIncome.Text) = "" Then
MsgBox("Enter Annual Income")
TxtAnnualIncome.Focus()
Valid = False
Exit Function
End If
End Function
Private Sub TxtContactNo_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TxtAnnualIncome.KeyPress
If e.KeyChar = vbBack Or e.KeyChar = " " Then Exit Sub
e.Handled = NumOnly(e.KeyChar)
End Sub
Private Sub clear()
TxtCHName.Text = ""
TxtLoc.Text = ""
TxtAnnualIncome.Text = ""
ComboBox1.Text = ""
'CmbCHID.SelectedIndex = 0
End Sub
56. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 56
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex > 0 Then
'MsgBox(ComboBox1.SelectedValue.ToString)
End If
End Sub
Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint
End Sub
End Class
57. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 57
DISTRIBUTION CODE :
Private Sub Distribution_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
'--- Opens Database Connection-----------
db = GetConn()
db.Open()
'----------------------------------------
TxtID.Text = GetNewNo(TxtID, "DISTRIBUTION", "ID")
st = "select ID from CARD_HOLDER order by ID"
LoadCombo(Cmb_CardID, st)
st = "select ID from Grains order by ID"
LoadCombo(CmbGrainID, st)
Call clear()
End Sub
Private Sub clear()
TxtQty.Text = ""
TxtCHName.Text = ""
TxtGrainName.Text = ""
CmbMonth.SelectedIndex = 0
DateTimePicker1.Value = Today
End Sub
58. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 58
Private Function Valid() As Boolean
Valid = True
If Trim(TxtQty.Text) = "" Then
MsgBox("Enter Quantity")
TxtCHName.Focus()
Valid = False
Exit Function
End If
End Function
Private Sub TxtQty_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TxtQty.KeyPress
If e.KeyChar = vbBack Or e.KeyChar = " " Then Exit Sub
e.Handled = NumOnly(e.KeyChar)
End Sub
Private Sub ButtonCmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonCmd.Click
If ButtonCmd.Text = "Save" Then
If Valid() = True Then
Dim str As String
str = "INSERT INTO DISTRIBUTION
(ID,CARD_HOLDER_ID,GRAIN_ID,DIST_DATE,MONTH_LIABLE,QTY)VALUES(" + TxtID.Text
+ "," + Cmb_CardID.SelectedItem.ToString() + "," + CmbGrainID.SelectedItem.ToString + ",to_date('" +
DateTimePicker1.Value + "','yyyy/mm/dd'),'" + CmbMonth.SelectedItem.ToString + "'," + TxtQty.Text +
")"
res = FunExecute(str)
If (res = 1) Then
MsgBox("Record Saved")
Distribution_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Saved")
End If
End If
59. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 59
'Else
' If CmbCHID.SelectedIndex > 0 Then
' If Valid() = True Then
' Dim str1 As String
' str1 = "UPDATE CARD_HOLDER SET Name='" + TxtCHName.Text + "',ADDRESS='"
+ TxtLoc.Text + "',ANNUAL_INCOME=" + TxtAnnualIncome.Text + ",CARD_TYPE_ID=" +
ComboBox1.SelectedValue.ToString() + " WHERE ID=" + CmbCHID.SelectedItem.ToString() + ""
' res = FunExecute(str1)
' If (res = 1) Then
' MsgBox("Record Updated sucessfully")
' Distribution_Load(Nothing, Nothing)
' Else
' MsgBox("Record could not be Updated")
' End If
' End If
' Else
' MsgBox("Select card no to be be Updated")
' End If
End If
End Sub
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonDisplay.Click
Dim frm As New ViewDistributions
frm.Show()
End Sub
Private Sub BtnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
BtnClear.Click
Call clear()
End Sub
60. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 60
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
Private Sub Cmb_CardID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Cmb_CardID.SelectedIndexChanged
Dim st1 As String
st1 = "Select NAME from CARD_HOLDER where ID=" + Cmb_CardID.SelectedItem.ToString() +
""
cm = New OleDb.OleDbCommand(st1, db)
dr = cm.ExecuteReader()
If dr.Read() = True Then
TxtCHName.Text = dr("NAME").ToString()
End If
End Sub
Private Sub CmbGrainID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmbGrainID.SelectedIndexChanged
Dim st1 As String
st1 = "Select NAME from GRAINS where ID=" + CmbGrainID.SelectedItem.ToString() + ""
cm = New OleDb.OleDbCommand(st1, db)
dr = cm.ExecuteReader()
If dr.Read() = True Then
TxtGrainName.Text = dr("NAME").ToString()
End If
End Sub
End Class
61. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 61
FAMILY MEMBERS CODE :
Private Sub FamilyMembers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'--- Opens Database Connection-----------
db = GetConn()
db.Open()
'----------------------------------------
CmbMemID.Visible = False
TxtFmID.Text = GetNewNo(TxtFmID, "FAMILY_MEMBERS", "ID")
st = "select ID from FAMILY_MEMBERS order by ID"
LoadCombo(CmbMemID, st)
st1 = "select ID from CARD_HOLDER order by ID"
LoadCombo(cmbCHID, st1)
'st1 = "select ID,NAME from CARD_HOLDER order by ID"
' LoadCombo(cmbCHID, st1, "CARD_HOLDER", "ID", "NAME", "Select")
Call clear()
RdBtnAdd.Checked = True
End Sub
62. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 62
Private Sub clear()
'RdBtnAdd.Checked = True
x = GetNewNo("FAMILY_MEMBERS", "ID")
If x = 0 Then
CmbMemID.Text = 1
Else
CmbMemID.Text = x.ToString()
End If
TxtName.Text = ""
'ButtonCmd.Text = "Save"
'cmbCHID.SelectedIndex = 0
End Sub
Private Sub ButtonCmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonCmd.Click
If ButtonCmd.Text = "Save" Then
If Valid() = True Then
st = "INSERT INTO FAMILY_MEMBERS VALUES(" + TxtFmID.Text + ",'" +
TxtName.Text + "'," + cmbCHID.SelectedItem.ToString() + ")"
res = FunExecute(st)
If (res = 1) Then
MsgBox("Record Saved")
FamilyMembers_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Saved")
End If
End If
Else
If CmbMemID.SelectedIndex > 0 Then
63. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 63
If Valid() = True Then
Dim str2 As String
str2 = "UPDATE FAMILY_MEMBERS SET NAME='" + TxtName.Text + "',CARD_HOLDER_ID="
+ cmbCHID.Text + " WHERE ID=" + CmbMemID.SelectedItem.ToString + ""
res = FunExecute(str2)
If (res = 1) Then
MsgBox("Record Updated sucessfully")
FamilyMembers_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Updated")
End If
End If
Else
MsgBox("Select Family no to be be Updated")
End If
End If
End Sub
Private Sub ButtonClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClear.Click
Call clear()
End Sub
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
64. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 64
Private Sub RdBtnAdd_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnAdd.CheckedChanged
If (RdBtnAdd.Checked = True) Then
ButtonCmd.Text = "Save"
TxtFmID.Visible = True
CmbMemID.Visible = False
TxtFmID.Text = GetNewNo(TxtFmID, "FAMILY_MEMBERS", "ID")
Call clear()
BtnDelete.Visible = False
End If
End Sub
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
BtnDelete.Click
If CmbMemID.SelectedIndex > 0 Then
st = "delete from FAMILY_MEMBERS where ID=" + CmbMemID.SelectedItem.ToString() + ""
Dim res As Integer = FunExecute(st)
If res = 1 Then
MsgBox("Record deleted Successfully")
FamilyMembers_Load(Nothing, Nothing)
Else
MsgBox("Problems encountered in record deletion")
End If
Else
MsgBox("Select card name to be be deleted")
End If
End Sub
65. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 65
Private Function Valid() As Boolean
Valid = True
If Trim(TxtName.Text) = "" Then
MsgBox("Enter Name")
TxtName.Focus()
Valid = False
Exit Function
End If
End Function
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonDisplay.Click
Dim frm As New ViewFamilyMem
frm.Show()
End Sub
Private Sub RdBtnModify_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnModify.CheckedChanged
If (RdBtnModify.Checked = True) Then
ButtonCmd.Text = "Modify"
TxtFmID.Visible = False
CmbMemID.Visible = True
CmbMemID.SelectedIndex = 0
'cmbCHID.SelectedIndex = 0
BtnDelete.Visible = True
'st = "select ID from CARD_TYPE order by ID"
'LoadCombo(Cmb_CardID, st)
End If
End Sub
66. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 66
Private Sub CmbMemID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmbMemID.SelectedIndexChanged
If (CmbMemID.SelectedIndex = 0) Then
TxtName.Text = ""
End If
If CmbMemID.SelectedIndex > 0 Then
st = "Select * from FAMILY_MEMBERS where ID=" & CmbMemID.SelectedItem.ToString()
cm = New OleDb.OleDbCommand(st, db)
dr = cm.ExecuteReader()
If dr.Read() = True Then
TxtName.Text = dr("NAME")
cmbCHID.Text = dr("CARD_HOLDER_ID")
End If
End If
End Sub
Private Sub TxtName_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TxtName.KeyPress
If e.KeyChar = vbBack Or e.KeyChar = " " Then Exit Sub
e.Handled = ChrOnly(e.KeyChar)
End Sub
Private Sub cmbCHID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmbCHID.SelectedIndexChanged
'If cmbCHID.SelectedIndex > 0 Then
' MsgBox(cmbCHID.SelectedValue.ToString)
'End If
End Sub
End Class
67. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 67
GRAIN TYPES CODE :
Private Sub Grains_Info_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
'--- Opens Database Connection-----------
db = GetConn()
db.Open()
'----------------------------------------
CmbGrainID.Visible = False
TxtID.Text = GetNewNo(TxtID, "GRAINS", "ID")
st = "select ID from GRAINS order by ID"
LoadCombo(CmbGrainID, st)
Call clear()
RdBtnAdd.Checked = True
End Sub
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonDisplay.Click
Dim frm As New ViewGrains
frm.Show()
End Sub
68. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 68
Private Sub RdBtnAdd_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnAdd.CheckedChanged
If (RdBtnAdd.Checked = True) Then
ButtonCmd.Text = "Save"
TxtID.Visible = True
Delete.Visible = False
CmbGrainID.Visible = False
TxtID.Text = GetNewNo(TxtID, "GRAINS", "ID")
Call clear()
End If
End Sub
Private Sub RdBtnModify_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RdBtnModify.CheckedChanged
If (RdBtnModify.Checked = True) Then
ButtonCmd.Text = "Modify"
TxtID.Visible = False
CmbGrainID.Visible = True
CmbGrainID.SelectedIndex = 0
Delete.Visible = True
'st = "select ID from CARD_TYPE order by ID"
'LoadCombo(Cmb_CardID, st)
End If
End Sub
69. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 69
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Delete.Click
If CmbGrainID.SelectedIndex > 0 Then
st = "delete from GRAINS where ID=" + CmbGrainID.SelectedItem.ToString() + ""
Dim res As Integer = FunExecute(st)
If res = 1 Then
MsgBox("Record deleted Successfully")
Grains_Info_Load(Nothing, Nothing)
Else
MsgBox("Problems encountered in record deletion")
End If
Else
MsgBox("Select grain to be be deleted")
End If
End Sub
Private Sub CmbGrainID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmbGrainID.SelectedIndexChanged
If (CmbGrainID.SelectedIndex = 0) Then
TxtName.Text = ""
End If
If CmbGrainID.SelectedIndex > 0 Then
Dim st1 As String
st1 = "Select * from GRAINS where ID=" + CmbGrainID.SelectedItem.ToString() + ""
cm = New OleDb.OleDbCommand(st1, db)
dr = cm.ExecuteReader()
If dr.Read() = True Then
TxtName.Text = dr("NAME").ToString()
End If
End If
End Sub
70. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 70
Private Sub ButtonClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClear.Click
Call clear()
End Sub
Private Sub ButtonCmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonCmd.Click
If ButtonCmd.Text = "Save" Then
If Valid() = True Then
Dim str As String
str = "INSERT INTO GRAINS (ID,NAME) VALUES (" + TxtID.Text + ",'" + TxtName.Text + "')"
res = FunExecute(str)
If (res = 1) Then
MsgBox("Record Saved")
Grains_Info_Load(Nothing, Nothing)
Else
MsgBox("Record could not be Saved")
End If
End If
Else
If CmbGrainID.SelectedIndex > 0 Then
If Valid() = True Then
Dim str1 As String
str1 = "UPDATE GRAINS SET Name='" + TxtName.Text + "' WHERE ID=" +
CmbGrainID.SelectedItem.ToString() + ""
res = FunExecute(str1)
If (res = 1) Then
MsgBox("Record Updated sucessfully")
Grains_Info_Load(Nothing, Nothing)
Else
71. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 71
MsgBox("Record could not be Updated")
End If
End If
Else
MsgBox("Select card no to be be Updated")
End If
End If
End Sub
Private Sub clear()
TxtName.Text = ""
End Sub
Private Function Valid() As Boolean
Valid = True
If Trim(TxtName.Text) = "" Then
MsgBox("Enter Grain Name")
TxtName.Focus()
Valid = False
Exit Function
End If
End Function
Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonExit.Click
Me.Close()
End Sub
Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint
End Sub
End Class
72. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 72
VIEW CARDHOLDER DETAILS CODE :
Private Sub ViewCardHolderDetails_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
DB = GetConn()
DB.Open()
ST = "SELECT * FROM CARD_HOLDER order by ID"
cm = New OleDbCommand(ST, DB)
oleda = New OleDbDataAdapter(cm)
oleda.Fill(ds, "CARD_HOLDER")
If ds.Tables("CARD_HOLDER").Rows.Count > 0 Then
DataGridView1.DataSource = ds.Tables("CARD_HOLDER")
End If
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClose.Click
Me.Close()
End Sub
End Class
73. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 73
VIEW CARD TYPE CODE :
Private Sub ViewCardInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
DB = GetConn()
DB.Open()
ds.Clear()
ST = "SELECT * FROM CARD_TYPE order by ID"
cm = New OleDbCommand(ST, DB)
oleda = New OleDbDataAdapter(cm)
oleda.Fill(ds, "CARD_TYPE")
If ds.Tables("CARD_TYPE").Rows.Count > 0 Then
DataGridView1.DataSource = ds.Tables("CARD_TYPE")
End If
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClose.Click
Me.Close()
End Sub
End Class
74. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 74
VIEW DISTRIBUTION CODE :
Private Sub ViewDistributions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
DB = GetConn()
DB.Open()
ds.Clear()
ST = "SELECT * FROM DISTRIBUTION order by ID"
cm = New OleDbCommand(ST, DB)
oleda = New OleDbDataAdapter(cm)
oleda.Fill(ds, "DISTRIBUTION")
If ds.Tables("DISTRIBUTION").Rows.Count > 0 Then
DataGridView1.DataSource = ds.Tables("DISTRIBUTION")
End If
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClose.Click
Me.Close()
End Sub
End Class
75. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 75
VIEW FAMILY MEMBERS CODE :
Private Sub ViewFamilyMem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
DB = GetConn()
DB.Open()
ST = "select ID from CARD_HOLDER order by ID"
LoadCombo(ComboBox1, ST)
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClose.Click
Me.Close()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ds.Clear()
If ComboBox1.SelectedIndex > 0 Then
ST = "select * from Family_members where CARD_HOLDER_ID=" +
ComboBox1.SelectedItem.ToString + ""
cm = New OleDbCommand(ST, DB)
oleda = New OleDbDataAdapter(cm)
oleda.Fill(ds, "FAMILY_MEMBERS")
If ds.Tables("FAMILY_MEMBERS").Rows.Count > 0 Then
DataGridView1.DataSource = ds.Tables("FAMILY_MEMBERS")
End If
Else
MsgBox("Select Card Holder Id")
End If
End Sub
End Class
76. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 76
VIEW GRAINS CODE :
Private Sub ViewGrains_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
DB = GetConn()
DB.Open()
ds.Clear()
ST = "SELECT * FROM GRAINS order by ID"
cm = New OleDbCommand(ST, DB)
oleda = New OleDbDataAdapter(cm)
oleda.Fill(ds, "GRAINS")
If ds.Tables("GRAINS").Rows.Count > 0 Then
DataGridView1.DataSource = ds.Tables("GRAINS")
End If
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ButtonClose.Click
Me.Close()
End Sub
End Class
77. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 77
8 . FORM DESIGN
LOGIN PAGE :
78. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 78
MAIN FORM :
79. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 79
FAMILY MEMBER DETAILS :
80. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 80
CARD TYPE :
81. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 81
CARD HOLDER DETAILS :
82. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 82
GRAINS DETAILS :
83. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 83
DISTRIBUTION DETAILS :
84. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 84
VIEW CARD TYPE DETAILS :
85. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 85
VIEW CARD HOLDER DETAILS :
86. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 86
VIEW GRAINS DETAILS :
87. GLOBAL COLLEGE OF COMPUTER APPLICATION
FOOD DISTRIBUTION MANAGEMENT SYSTEM 87
8 . LIST OF REFERENCES :
Visual Basic .NET PROGRAMING -2008
DATABASE MANAGEMENT SYSTEM
ELMARIS & NAMATHE
WWW.GOOGLE.COM
http://www.vb-helper.com/vbgp.htm
www.wikibooks.com
SOFTWARE ENGENERING
IAN SOMARVILLI
SYSTEM ANALYSIS AND DESIGN
M.R PATIL