68
CHAPTER ONE 1.Introduction Our project focuses on the automation of Harmaz buildings materials shop.Our project will solve problems related to IT aspects of the shop. Our new Application (software) will help the shop management by providing daily transaction record database and provides an easily registration of the materials, update of the materials and registering the items or materials that are taken through loan by the other shops. The new Application (software) will also help the shop employee to make their work fast, easy and well organized. 1.1. Background Harmaz building material shop is located in centre of Mekelle city in Kebele20 which is called Jubruk and it starts to give service to the society in the mid of 1992. This shop sales different building materials for organization and individuals with fair amount of costs. The company buy or brings those building materials from Addis Abeba and sale them to some building material shops, organizations and to the individual. 1.2. Statement of the problem Since the Harmaz building materials shop is used paper based or manualsystem . It faces the following problems 1

inventory system

Embed Size (px)

Citation preview

Page 1: inventory system

CHAPTER ONE

1. IntroductionOur project focuses on the automation of Harmaz buildings materials shop.Our project

will solve problems related to IT aspects of the shop. Our new Application (software)

will help the shop management by providing daily transaction record database and

provides an easily registration of the materials, update of the materials and registering the

items or materials that are taken through loan by the other shops. The new Application

(software) will also help the shop employee to make their work fast, easy and well

organized.

1.1. Background

Harmaz building material shop is located in centre of Mekelle city in Kebele20 which is

called Jubruk and it starts to give service to the society in the mid of 1992. This shop

sales different building materials for organization and individuals with fair amount of

costs. The company buy or brings those building materials from Addis Abeba and sale

them to some building material shops, organizations and to the individual.

1.2. Statement of the problem

Since the Harmaz building materials shop is used paper based or manualsystem . It

faces the following problems

The materials were not registered so it is difficult for the seller to

remember all the type of materials or the available items.

It makes mistakes in calculating the price of items and other

activities.

The management process for the manager is very tedious and

complex.

It was time consumes.

It doesn`t show how many materials are left for sale.

The loans are kept in paper, the paper may lost or is not secure

Unable to prepare accurate and clear report.

1

Page 2: inventory system

1.3. Objective

The main objective of this project is to develop a system to make the system easy and

helps to improve the way that was used previously. It is aimed to help the

users/employees do their work effectively. It is also aimed to make the system much

faster than the existing system.

The specific objective of this project is:

The developed system provides credit management.

It register the building materials items.

It calculates the price of the materials accurately or with no mistake.

Manages the privilege easily.

To update the price or the available materials easily.

To register the building material shops that buys from this shop.

It registers individual customers when they buy items that have

guarantee.

1.4. Scope of the project

The proposed system will be used to get the information from the three customers; those

are: the building material shops customers, the individual customer, and the organisation

(governmental or non-governmental) and prepare that data for future use. The current

system in use is manual or paper based system, it is slow and can’t provide updated lists

of building items within a reasonable time frame the intentions of the system is to change

the existing system that is manual/paper based in to computerized system. This helps the

organization to provide fast and accurate service it can also be able to protect an

authorized access; registering, updating ,searching and deletion(if needed) of an building

material items and registration, Updating ,searching and deleting( if needed)of the

employs and the building material shop customers information.

2. Proposed System The new system is designed to solve the problems found in the current system. In the

new system Harmaz building material shop will be automated using OOP.The system can

be able to register new customers, updating customer information and delete customer

2

Page 3: inventory system

information (if needed), and searching customer information. It can be able to prepare

reports as needed. It can be able to add, delete or update user accounts by the

administrator. The system uses to register new building materials; it updates when the

material items are sold or new items are added and searches the items that are found in

that shop. It supports credit management. It also helps to perform calculating of the

material price. This proposed system provides fast and easy access to the customers and

to the employers and it will avoid the complexity and wastage of time of the working

process and the customer can get quick access to register and other activities done by the

System.

This proposed system it have several advantages like

It have user friendly interface (the user can use it easily without

difficulty).

It have fast access

It have accurate and clear item storage

2.1. Functional Requirements

The functional requirements describe the core functionality of the application. This

section includes the data and functional process requirements. It consists of what task the

system should perform, the processes involved, which data should the system holds and

the interfaces with the user. The proposed system has the following

Functionalities:

It registers new items; the items are identified by different methods

such as product number, brand, size etc.

It updates items, when items are sold, the system subtract from the

available items by the number of items that are sold.

It checks for availability of items.

It provides registration form for the individual customers who buy

an item that have warranty for specific items.

It provides loan (credit) form for those building material shops that

have relation with this shop.

3

Page 4: inventory system

2.2. Non-Functional Requirements

The system that we are going to develop is an interactive, current software

development technologies using Microsoft visual studio 2010 based on objected oriented

development approach. Here are some non-functionality requirements:

Error handling – display message when inappropriate character is typed or display

message when some unauthorized people try to access.

Reusability – once the software is developed you can update the content of system.

Documentation: In the first stage of the development (analysis and design), external

documentation are available and in the second phase of the development (coding, testing)

internal documentation will be taken A documentation of all the tasks performed and all

the different models used will be done, so that it’s used for communication between

developers, maintenance engineer or as a user guides.

Security– since we will use MYSQL has its own authorization privileges.

It is fast and reliable

2.3. System Models

2.3.1. Use Cases

- Login

- Change account setting

- add property type

- update property type

- search property type

- registering customers

- search customers

- update customers details

-

4

Page 5: inventory system

Figure 1

5

Page 6: inventory system

Figure 2

6

Page 7: inventory system

2.3.1.1. Use Case Description1. [Use case name: Add Property Item

Participating Actors:clerk and admin

Purpose: to register property details

Preconditions:property actors should login.

Flow of events:

1. A property actors asks the system to create a new property type

2. The property actor adds the property type details

3. The property actor asks the system to persist the property type details

4. The system checks if property details are valid

5. The system persists the details in the database

6. The system displays success information to the property actor.

Post-conditions:successful registration message

2. Use case name: Search Property Type

Participating Actors: clerk and admin

Purpose: to search materials from database

Preconditions:property actors should login.

Flow of events:

1. A property actor asks the system to search the property type.

2. The property actor adds the property name and identification for search.

3. The property actor asks the system to persist the property name and identification

4. the system checks if property name and identification exist in database

5. The system display the property details from the database  

Post-conditions: display successful message

3. Use case name: Update Property Type

Participating Actors: clerk and admin

Purpose: to update material details

7

Page 8: inventory system

Preconditions: property actors should login.

Flow of events:

1. A property actor asks the system to update the property type.

2. The property actor adds the property name and identification.

3. The property actor asks the system to persist the property name identification.

4. The system checks if property name and identification exist id database.

5. The system changes the property details in the database.

6. The system displays success information to the property actor.    

Post-conditions: successful message update property details

4. Use case name: Login

Participating Actors: clerk and admin

Purpose: It helps the actors mentioned above to log in to his or her form.

Preconditions: The actor should have an account.

Flow of events:

1. Admin actor asks the system to login

2. The admin actor adds the username and password for login to the main page.

3. The admin actors ask the system to persist the username and password.

4. The system checks if username and password exist exist in database.

5. The system displays the provided page.  

Post-condition:themain menu page will be display.

5. Use case name: registering customers

Participating Actors: clerk and admin

Purpose: to register customers

Preconditions: property actor should login

Flow of events:

1. A property actor asks the system to add the customer details.

2. The property actor adds the customer details.

3. The property actor asks the system to persist the customer details.

8

Page 9: inventory system

4. The system checks if customer details are valid.

5. The system persist the details in the database.

6. The system displays success information to the property actor.

Post-condition: display successful registration message.

6. Use case name: Delete customer details

Participating Actors: clerk and admin

Purpose: to delete customer from database

Preconditions: property actor should login

Flow of events:

1. A property actor asks the system to delete the customer detail.

2. The property actor adds the customer tin number or customer name.

3. The property actor asks the system to persist the customer tin number or customer na

me.

4. The system checks if customer tin number exists in database.

5. The system deletes the customer details from the database.

6. The system displays success message to the property actor.

Post-condition:delivered successful message

7. Use case name: Search Customer details

Participating Actors: clerk and admin

Purpose: to search customer details from database

Preconditions: property actor should login

Flow of events:

1.  A property actor asks the system to search the customer details.

2. The property actor adds the customer tin number or customer name for search.

3. The property actor asks the system to persist the customer tin number or customer n

ame.

4. The system checks if customer tin number or customer name exist in database.

5. The system display the details from the database

Post-condition:delivered successful message

9

Page 10: inventory system

8. Use case name: Update customer details

Participating Actors: clerk and admin

Purpose:

Preconditions: property actor should login

Flow of events:

1. A property actor asks the system to update the customer details.

2. The property actor adds the customer tin number or customer name. 

3. The property actor asks the system to persist the customer tin number or customer na

me.     

4. The system checks if customer tin number in database.

5. The system changes the customer details in the database.

6. The system displays success information to the property actor  

Post-condition:successful message update customer details.

Actor Description[This section contains detail description of the actor, see the example below]

1. Administrator: a person having the role of -

o maintaining user account

o maintaining staff list

10

Page 11: inventory system

2.3.2. Use Case Diagram

11

Page 12: inventory system

12

Page 13: inventory system

2.3.3. Class Diagram

A system’s structure made up of a collection of piece often referred to as objects. Class

describes different types of objects that the system can have, and class diagram shows

these class and their relationship.

13

Page 14: inventory system

2.3.4. Sequence Diagram

Sequence diagrams define the interactions between objects in order toexecute a use case.

Interactions are called messages

Sequence Diagrams are

Simple

Powerful

Readable

used to describe interaction sequences

14

Page 15: inventory system

15

Page 16: inventory system

16

Page 17: inventory system

17

Page 18: inventory system

18

Page 19: inventory system

19

Page 20: inventory system

20

Page 21: inventory system

21

Page 22: inventory system

CHAPTER TWO

1. IntroductionThis system Design Document establishes the Database design for the Harmaz building

material shop and transaction management system. It is dominant significance to build

secured Store management system to support easy and fast store materials and reporting.

As it is mentioned in the Requirements Analysis Document, most materials from the

Harmaz building material shop store provide different types of building materials, selling

materials to the customers. Borrowers shop or organization of the materials will be

registered in the credit form. Based on our prior assessment of the Harmaz building

material shop, the above mentioned processes are conducted manually. Therefore, our

team strongly recommends the use of a database which facilitates effective materials and

transaction management system in the Harmaz building material shop. To this effect, the

team will develop materials and transaction management system to solve the problem

stated in required analysis document.

1.1. Purpose

The purpose of this Harmaz building material shopand transaction management system is

to provide a well-organized and fast materials management for Harmaz building material

shop. In previous system (i.e. Manual System) users or store worker has to go to the store

for checking the building material availability on the store. This is time consuming,

expensive and needs much more workers etc. Through this Database, the workers or

managers can easily and effectively manage the materials.

1.2. Design Goals

Security: The system should also be designed to prompt the user with password and user

name. This provides security in such a way that unauthorized users can not have access to

22

Page 23: inventory system

the system’s resources. Moreover, the system should be designed to reject invalid user

inputs to ensure the system’s robustness for all interacting users.

End user: The system should provide user friendly and self-explanatory graphical user

interface that eases the interaction of the user with the system. In addition, the

navigational schema should be flexible.

Performance:The response time to users request should be tolerable.

1.3. Definitions, Abbreviations, and Acronyms

AS: Automated System

2. System Design Model

2.1. Subsystem Decomposition

Harmaz building material provides several services.To effectively provide these services

as per the goals specified, the system is decomposed into three main subsystems. These

main subsystems are called AS User Interface subsystem, AS Application subsystem, and

Database. The subsystems are described as follows

1. AS User Interface subsystem

This subsystem is mainly responsible to facilitate the interaction of the user with the

system. The services at this subsystem are accepting user inputs, shaping them in such

way that they can be used by the system, and displaying results processed by the system.

This subsystem has smaller subsystems:

Registration UI subsystem: The main concern of this UI subsystem is providing

an interface to register materials, customer details, and calculate price of the

materials.

User Management UI subsystem: It provides an interface for the administrator

to create account, delete and to view list of users etc.

23

Page 24: inventory system

2. AS Application and Database subsystem

I. Application

This subsystem is mainly responsible for managing in relation to registration,

user management

II. Database

The main task of this subsystem is providing facilities for data storage, executing the

SQL statements that come from the application subsystem, and ensuring data

consistency. It also facilitates storage and retrieval of files.

.

2.1. Hardware/ Software Mapping

The architecture of Harmaz buildings materials shop automated system is designed to

have two tiers namely data and business application.

The data tier comprises AS database and DBMS components are deployed. The

business application tier, which communicates with the data tier, comprises the AS UI

and AS application is deployed.

The hardware/software mapping of the AS is given by the deployment diagram in

24

Page 25: inventory system

2.2. Access Control

In multiuser systems, different actors have access (privilege) to different functionality

and data. Hence, the various actors of the AS have different access to the classes of the

AS. This access control is represented using access matrix. In the access matrix, rows

represent actors and columns represent classes; an intersecting cell represents the type of

access an actor can have on the corresponding class. An empty cell represents that the

actor is denied access to the corresponding class. The access matrix of the ARS is given

in table

Classe

s

Actors

property item sales Employ customers

details

account

admin addAccount()

login()

changePassword()

updateAccount()

disableAccount()

enableAccount()

deleteAccount()

resetPassword()

viewAccount()

clerk addPropertDetail()

viewPropertyDetail

s()

updatePropoert

y()

viewProperty()

registerPropert

y()

searchProperty(

)

updateCustomer()

viewCustomer()

login()

changePassword()

manag

er

addPropertDetail()

viewProperty()

viewProperty() registreEmploy(

)

viewEmployr()

updateCustomer()

viewCustomer()

login()

changePassword()

25

Page 26: inventory system

updateEmploy()

deleteEmploy()

3. Detailed Design

3.1. Object Design Model

In this section, detailed description will be given for classes that are behind the main

services of AS. The purpose, type, and constraints that should hold on attributes; the

purpose and signature of operations will be discussed. Moreover, the conditions that

should hold before and after an operation invocation will be described.

property item

-PropertyID: int

-propertiName: string

-Propertyprice: float

-quantity: int

-purchasedDate: date

~Property(PropertyID: int

, propertyName: string )

+getPropertNames(): string[]

+viewProperty(propertyID: string):

Attributes PropertyID: this is ainteger type that holds property id which uniquely identifies

the property.

26

Page 27: inventory system

PropertyName: this is a string type that holds name of the property.

Propertyprice:this is a float data type that holds the price of the material.

Quantity: this is an integer type that holds property code which uniquely identifies

the property.

purchasedDate:this is a date data type that holds the purchased date of the

material.

Operations

property(propertyID:int, propertyName:string): this is a constructor which is used

to initialize the property object during object creation.

getpropertyNames(): this operation is used to retrieve all property names as array

of strings.

viewProperty(propertyID: string): this operation is used to view

propertyinformation for given property code.

Contracts Invariant: PropertyName, PropertyIDshould not be null.

Precondition:Property(propertyID,…) : the property should not exist before the

creation of this object.

- getPropertyNames(): string[], deleteProperty(propertID: int): void,

up: the Property should exist for all the operations mentioned.

Post condition: property(propertyID,…) : Property information is added to

property table and the number of Property in property table is increased by one.

- getPropertyNames(): string[]: the Property name is retrieved

from property table.

- updateProperty(propertyID:string): void: property information

should be modified.

sales

27

Page 28: inventory system

-PropertyID: int

-propertiName: string

-Propertyprice: float

-quantity: int

~Property(PropertyID: int

, propertyName: string )

+getPropertNames(): string[]

+viewProperty(propertyID: string):

Attributes PropertyID: this is ainteger type that holds property id which uniquely identifies

the property.

PropertyName: this is a string type that holds name of the property.

Propertyprice:this is a float data type that holds the price of the material.

Quantity: this is an integer type that holds property code which uniquely identifies

the property.

Operations

property(propertyID:int, propertyName:string): this is a constructor which is used

to initialize the property object during object creation.

getpropertyNames(): this operation is used to retrieve all property names as array

of strings.

viewProperty(propertyID: string): this operation is used to view

propertyinformation for given property code.

Contracts Invariant: PropertyName, PropertyIDshould not be null.

Precondition:Property(propertyID,…) : the property should not exist before the

creation of this object.

28

Page 29: inventory system

- getPropertyNames(): string[], deleteProperty(propertyID: int):

void, up: the property should exist for all the operations mentioned.

Post condition: property(propertyID,…) : Property information is added to

property table and the number of Property in property table is increased by one.

- getPropertyNames(): string[]: the Property name is retrieved

from property table.

- updateProperty(propertyID:string): void: property information

should be modified.

customers details

#customer: string

#firstName: string

#lastName: string

#sex:char

#phoneNumber:int

#profession:string

~Customer( customerID: string, firstName: string, lastName: string, profession :

string, phoneNumber:int, sex:int,)

+get customer ( customer ID: string): string

+delete customer ( customer ID: string : string): void

+edit customer ( customer ID: string : string): void

+search customer ( customer ID: string : string)

Attributes customer ID: this is a string type which uniquely identifies a customer.

firstName: this is a string type that holds the name of a customer.

29

Page 30: inventory system

lastName: this is a string type that holds the father name of a customer.

Sex:this is a char type that holds the sex of customer.

profession :this is a string type that holds the profession.

phoneNumber:this is aninteger type that holds the phone number of the

customer.

Operations Customer (customer ID: string, firstName: string, lastName: string,

phoneNumber:int,profession:string,): this a constructor which is used

to initialize the person object when it is created .

getCustomer (Customer ID: string): this operation is used to retrieve

Customer as of string type for a given Customer ID.

editCustomer (Customer ID: string): this is an operation which is used

to modifyCustomer’s as of string type.

deleteCustomer t (Customer ID: string): this is an operation which is

used to deleteCustomer’s as of string type.

Contracts

getCustomer (Customer ID: string),

updateCustomer (Customer ID: string, editCustomer (Customer: string),

deleteCustomer (Customer ID: string)Customer should exist.

Customer object should exist and the number of objects should increaseby one.

getCustomer (Customer ID: string): the list of the Customer can be

retrieved.

30

Invariant :Customer ID: string,firstName: string,lastName:

string,sex:char,phoneNumber:int,prodession:string,string should not be null.

Precondition:Person(Customer ID: string,firstName: string, lastName:

stringsex:char, phoneNumber:int,profession:string: studentobjectshould not exist.

Post condition: Customer (Customer ID: string

firstName: string, lastName: stringsex:char, phoneNumber:int,profession:string)

Page 31: inventory system

editCustomer (Customer ID: string): Customer status already

modified.

deleteCustomer (Customer ID: string): Customer deleted.

3.2. Database Design

The database schema of the relational model described below

Material table (materials that are in store)sale table(materials that are sold)

Material table (materials that are purchased)

Account table (Clerk account)

31

Field Type Keymaterial_name char(20)

materialid char(20)

unit int(11)

unitcost double

totalcost double

salesdate date

Field Type Keymaterial_name char(20)

materialid char(20)

Unit int(11)

unitcost double

madein char(20)

Purchaseddate Date

Field Type Keymaterial_name char(20)

materialid char(20)

Unit int(11)

purchasedcost double

Totalcost double

Salescost double

Purchaseddate Date

madein char(20)

Field Type Keyidno char(5) PRI

fname char(20)

Lastname char(20)

username char(20)

Password char(20)

Page 32: inventory system

Manaccount (manager account) admiaccount table (admin account)

Employee table (employer detail)

32

Field Type Keyidno char(20) PRI

fname char(20)

Lastname char(20)

username char(20)

Password char(20)

Field Type Keyidno char(20) PRI

fname char(20)

Lastname char(20)

username char(20)

Password char(20)

Field Type Keyempid char(20) PRI

fname char(20)

Lname Char(20)

Sex Char(6)

edulevel Char(20)

Age Int(11)

Salary Double

address char(20)

Pno Char(12)

Page 33: inventory system

Chapter three

3. System Implementation

33

Field Type Keyempid char(20) PRI

fname char(20)

Lname Char(20)

Sex Char(6)

Edulevel Char(20)

Age Int(11)

Salary Double

address char(20)

Pno Char(12)

Page 34: inventory system

3.1 objective of implementation

The objective of implementation is the stage in the project where the theoretical design is

turned into a working system. The implementation phase constructs, install, and operates

the new system. The most crucial stage in achieving a new successful system is that it

will work efficiently and effectively.

3.2 System Implementation Structure System implementation structure will show the overall hierarchy of how the system is

implemented and which operations and pages/forms are visible to whom an authorized

person to see. This section will be implementing to show and relate with diagram

structure and the implementation structure.

The implementation structure starts by showing what will be showing when the

page/form will start to run i.e. it starts from the Form1.

The starting form contains the login form which has three alternative privileges. Those

are clerk, manager and administrator. The clerk page contains sale materials, change

account setting, Deliver report, and view available materials forms. A manager page

contains sale materials, view available material, purchased material, employees, change

account setting, profit audit, and view report forms. Finally the administrator page

contains create account setting, change account setting forms.

34

Page 35: inventory system

Sample code for purchasing material

using System;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingMySql.Data.MySqlClient;namespaceHarmaz_building_materials

{

35

Page 36: inventory system

publicpartialclassForm4 : Form {MySqlConnectionssm = newMySqlConnection(@"server=localhost;User Id=root;database=harmaz");DataTabledt;DataSet ds;MySqlDataAdapter da;MySqlCommandBuildercb; public Form4() {InitializeComponent(); }privatevoid linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {Form7 j = newForm7();j.Show();this.Visible = false; }privatevoid button5_Click(object sender, EventArgs e) {int unit = Convert.ToInt32(textBox4.Text);doublepurchasedcost = Convert.ToDouble(textBox5.Text);doubletotalcost = unit * purchasedcost; textBox6.Text = totalcost.ToString();if (comboBox1.Text == "" || comboBox2.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "") {

36

Page 37: inventory system

MessageBox.Show("fill the data "); }else {MySqlCommand t = newMySqlCommand(); t.CommandType = CommandType.Text; t.CommandText = "select * from material where (material_name='" + comboBox1.Text + "' &&materialid='"+comboBox2.Text+"' &&madein='"+textBox8.Text+"')"; t.Connection = ssm;ssm.Open();MySqlDataReader y; y = t.ExecuteReader(); if (y.Read()) { t.CommandText = "update material set unit=unit + '" + textBox4.Text + "' where (material_name='" + comboBox1.Text+ "' &&materialid='" + comboBox2.Text + "' )";

MySqlCommand cd = ssm.CreateCommand();cd.CommandType = CommandType.Text;cd.Connection = ssm;cd.CommandText = "Insert into purchase(material_name,materialid,unit,purchasedcost,totalcost,salescost,purchaseddate,madein) values(@material_name,@materialid,@unit,@purchasedcost,@totalcost,@salescost,@purchaseddate,@madein)";cd.Parameters.AddWithValue("@material_name", comboBox1.Text);

37

Page 38: inventory system

cd.Parameters.AddWithValue("@materialid", comboBox2.Text);cd.Parameters.AddWithValue("@unit", Convert.ToInt32(textBox4.Text));cd.Parameters.AddWithValue("@purchasedcost", Convert.ToDouble(textBox5.Text));cd.Parameters.AddWithValue("@totalcost", Convert.ToDouble(textBox6.Text));cd.Parameters.AddWithValue("@salescost", textBox7.Text);cd.Parameters.AddWithValue("@purchaseddate", dateTimePicker1.Value);cd.Parameters.AddWithValue("@madein", textBox8.Text);y.Close();t.ExecuteNonQuery();cd.ExecuteNonQuery();MessageBox.Show("the materials in store is updated"); }else {MySqlCommand c = ssm.CreateCommand();c.CommandType = CommandType.Text;c.CommandText = "Insert into material(material_name,materialid,unit,unitcost,madein,purchaseddate) values(@material_name,@materialid,@unit,@unitcost,@madein,@purchaseddate)";c.Parameters.AddWithValue("@material_name", comboBox1.Text);c.Parameters.AddWithValue("@materialid", comboBox2.Text);c.Parameters.AddWithValue("@unit", Convert.ToInt32(textBox4.Text));c.Parameters.AddWithValue("@unitcost", textBox7.Text);

38

Page 39: inventory system

c.Parameters.AddWithValue("@madein", textBox8.Text);c.Parameters.AddWithValue("@purchaseddate", dateTimePicker1.Value);MySqlCommand cd = ssm.CreateCommand();cd.CommandType = CommandType.Text;cd.CommandText = "Insert into purchase(material_name,materialid,unit,purchasedcost,totalcost,salescost,purchaseddate,madein) values(@material_name,@materialid,@unit,@purchasedcost,@totalcost,@salescost,@purchaseddate,@madein)";cd.Parameters.AddWithValue("@material_name", comboBox1.Text);cd.Parameters.AddWithValue("@materialid", comboBox2.Text);cd.Parameters.AddWithValue("@unit", Convert.ToInt32(textBox4.Text));cd.Parameters.AddWithValue("@purchasedcost", Convert.ToDouble(textBox5.Text));cd.Parameters.AddWithValue("@totalcost", Convert.ToDouble(textBox6.Text));cd.Parameters.AddWithValue("@salescost", textBox7.Text);cd.Parameters.AddWithValue("@purchaseddate", dateTimePicker1.Value);cd.Parameters.AddWithValue("@madein", textBox8.Text); y.Close();// t.ExecuteNonQuery();c.ExecuteNonQuery();cd.ExecuteNonQuery();MessageBox.Show("you have register the purchased material successfully"); }ssm.Close();

39

Page 40: inventory system

} }privatevoid button2_Click(object sender, EventArgs e) {comboBox1.Items.Clear();comboBox2.Items.Clear();textBox4.Clear();textBox5.Clear();textBox6.Clear();textBox7.Clear();textBox7.Clear(); }privatevoid button3_Click(object sender, EventArgs e) {ssm.Open();DataSet h = newDataSet();DataTable f = newDataTable();h.Tables.Add(f);MySqlDataAdapterabc = newMySqlDataAdapter("select * from purchase ", ssm);abc.Fill(f); dataGridView1.DataSource = f.DefaultView; dataGridView1.Enabled = true; ssm.Close(); }privatevoid button4_Click(object sender, EventArgs e) {if (comboBox1.Text == ""|| comboBox2.Text =="") {MessageBox.Show("fill the material name and its identification");

40

Page 41: inventory system

}else {MySqlCommandcmd = newMySqlCommand();cmd.CommandType = CommandType.Text;cmd.CommandText = "select * from purchase where (material_name='" + comboBox1.Text + "'&&materialid='"+ comboBox2.Text +"')";cmd.Connection = ssm;ssm.Open();MySqlDataReader y; y = cmd.ExecuteReader();if (y.Read()) {MySqlCommand c = newMySqlCommand();c.CommandType = CommandType.Text;c.CommandText = "select * from purchase where (material_name='" + comboBox1.Text + "'&&materialid='"+ comboBox2.Text +"')";c.Connection = ssm;y.Read(); comboBox1.Text = y[0].ToString(); comboBox2.Text = y[1].ToString(); textBox4.Text = y[2].ToString(); textBox5.Text = y[3].ToString(); textBox6.Text = y[4].ToString(); textBox7.Text = y[5].ToString(); dateTimePicker1.Text = y[6].ToString(); textBox8.Text = y[7].ToString();y.Close(); }

41

Page 42: inventory system

elseMessageBox.Show("the name of the material you entered doesn't exist");ssm.Close(); } }privatevoid comboBox1_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsLetter(e.KeyChar)) {e.Handled = false; }elseif (char.IsWhiteSpace(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only letter is allowed"); }

}privatevoid comboBox2_KeyPress(object sender, KeyPressEventArgs e) {

42

Page 43: inventory system

if (char.IsLetterOrDigit(e.KeyChar)) {e.Handled = false; }elseif (char.IsWhiteSpace(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only letter and/or number is allowed"); } }privatevoid textBox4_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsNumber(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {

43

Page 44: inventory system

e.Handled = true;MessageBox.Show("only nubmber is allowed "); } }privatevoid textBox5_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsNumber(e.KeyChar)) {e.Handled = false; }elseif (char.IsPunctuation(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only nubmber and dot is allowed "); }

}privatevoid textBox6_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsNumber(e.KeyChar)) {

44

Page 45: inventory system

e.Handled = false; }elseif (char.IsPunctuation(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only nubmber is allowed "); } }privatevoid textBox7_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsNumber(e.KeyChar)) {e.Handled = false; }elseif (char.IsPunctuation(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }

45

Page 46: inventory system

else {e.Handled = true;MessageBox.Show("only nubmber and dot is allowed "); } }privatevoid textBox8_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsLetter(e.KeyChar)) {e.Handled = false; }elseif (char.IsWhiteSpace(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only letter is allowed"); } }privatevoid comboBox1_MouseClick(object sender, MouseEventArgs e) {comboBox1.Items.Clear();

46

Page 47: inventory system

ssm.Open();da = newMySqlDataAdapter("SELECT * FROM material", ssm);cb = newMySqlCommandBuilder(da);ds = newDataSet();da.Fill(ds);dt = ds.Tables[0];ssm.Close();for (intcurRecord = 0; curRecord<dt.Rows.Count; curRecord++) {comboBox1.Items.Add(dt.Rows[curRecord]["material_name"]); } }privatevoid comboBox2_MouseClick(object sender, MouseEventArgs e) {comboBox2.Items.Clear();ssm.Open();da = newMySqlDataAdapter("SELECT * FROM material", ssm);cb = newMySqlCommandBuilder(da);ds = newDataSet();da.Fill(ds);dt = ds.Tables[0];ssm.Close();for (intcurRecord = 0; curRecord<dt.Rows.Count; curRecord++) {comboBox2.Items.Add(dt.Rows[curRecord]["materialid"]); } } }

47

Page 48: inventory system

}

Chapter Four

4. System Testing

4.1. IntroductionTesting is the basic part of every system. Since it is the basic part of our application, we

try to test individual forms as well as the whole system. This process involves any

activity aimed at evaluating an attribute of form, or capability of application and

determined that it meets its intended objectives. In short, it is the execution of the system

to see its capability and effectiveness. Our main objective in this phase is finding errors

and correcting them.

Generally, the objective of testing is confirming that the system satisfying its

requirement. There are different types of testing like unit testing, integration testing,

system testing and acceptance.

4.2 Unit testing

48

Page 49: inventory system

We have to test each subsystem individually whether it meets the requirement

functionality or not within the group. If any error happens we would try to solve it until

the system meets the required goal. Each of individual form accepts the valid input and

gives the expected output. Each and every procedure on the system is tested to be flexible

and produce exact output to achieve the exact objective of the proposed system.

4.3 Application Related services

There are different privileges like clerk, manager and admin so each privilege can

access their own page only.

4.4 Functionality Testing

During this testing each and every individual module has been test to ensure that they

have meets the requirement operation by taking input different kinds of data, and also we

have checked that valid input is entered or not.

4.5 Error Handling

In our project we have used key press method in order to handle errors by displaying the

message alert when inappropriate input in used.

Inappropriate input System response

Trying to input letter in steady of number only number is allowed

Trying to input number in steady of letter only letter is allowed

Empty Control

Error during entering some detail information without fulfilment of all data record is

handled in message alert.

Empty Box System response

Trying to save information without filling

the data

Please enter the data

Sample code for checking empty control for selling materials

if (comboBox1.Text == "" ||comboBox2.Text == "" || textBox3.Text == "" || comboBox3.Text=="") {MessageBox.Show("please enter the data ");

49

Page 50: inventory system

}

privatevoid comboBox1_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsLetter(e.KeyChar)) {e.Handled = false; }elseif (char.IsWhiteSpace(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only letter is allowed"); } }

privatevoid comboBox2_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsLetterOrDigit(e.KeyChar)) {e.Handled = false;

50

Page 51: inventory system

}elseif (char.IsWhiteSpace(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only letter and/or number is allowed");} }privatevoid textBox3_KeyPress(object sender, KeyPressEventArgs e) {if (char.IsNumber(e.KeyChar)) {e.Handled = false; }elseif (char.IsControl(e.KeyChar)) {e.Handled = false; }else {e.Handled = true;MessageBox.Show("only nubmber is allowed ");}

51

Page 52: inventory system

}

4.6 Integration Testing

After the unit testing of one component is successfully tested there must be combine the

two or three components together and test them together. In short, it is the process of

bringing together the some module that page comprises for testing purpose.

52

Page 53: inventory system

Chapter Five

5. Group Members responsibilities

Name ID_NO Organization ResponsibilityMekdes Abate 0086/03 MU Requirement

Analysis

documentRuhama hailu 0110/03 MU System design

53

Page 54: inventory system

documentTanawork ayelign 0124/03 MU TestingTemesgen Meressa 0126/03 MU Implementation

6 Glossary

UML: - uniform Medaling Language

RAD: - requirement analysis document

SDD: - System design document

GUI: - Graphical user interface.

DLL: - Dynamic link library

IT : Information technology

54