OOP Project: Product Inventory System by R.M. Sandali Rathnayake, Study Guides, Projects, Research of Object Oriented Programming

The code and instructions for a Product Inventory System implemented using Object Oriented Programming in C# as part of an HND in Computing and System Development project by R.M. Sandali Geethma Rathnayake. The system includes features such as logging in, ordering products, updating inventory, and deleting entries.

Typology: Study Guides, Projects, Research

2017/2018

Uploaded on 08/27/2021

john12_3
john12_3 🇱🇰

4.7

(3)

6 documents

1 / 97

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
R.M. Sandali Geethma Rathnayake Page no 1
Object Oriented Programming
HND in Computing and System Development
Executive summary
This is an assignment comes under Object Oriented Programming module at HND in IT
program. For the completion of this assignment, I have to produce an Inventory System for
Zeus Pvt Limited assuming that I work as a C# programmer.
Zeus Pvt Limited is a Small Medium Enterprise, which renounce for importing a very rare
“Power™” branded nutrition supplements for patients who are suffering from Diabetes in Sri
Lanka. Therefore, I had to create a transaction processing system for Zeus Pvt Ltd.
To complete the Task1 in this assignment, I have described the characteristics and principles
of Object Oriented Programming and provided a comprehensive report on how these
characteristics could apply in the required system.
For the Task 2, I have been identified the objects (Classes) from the scenario and list all the
attributes and methods of each object.
Within Task 3, I have drawn use case diagram, class diagram and sequence diagram for
Inventory System of Zeus Pvt Limited to create better and effective system solution.
To complete Task 4, I have designed and proposed an effective Inventory system solution for
Zeus Pvt Limited considering all functions should perform through the system by aid of the
Object Oriented solution using C#.Net.
In Task 5, I have provided the evidences of use of association, aggregation, composition and
generalization relationships from Inventory System of Zeus Pvt Limited.
There are two subtasks inside the Task 6 and within first subtask I have explain how the
concept of polymorphism used in Inventory System of Zeus Pvt Limited. In second subtask,
briefly explained about control structures and how those effectively have used in Inventory
System.
In Task 7, I have discussed the advantages of using Integrated Development Environment
when developing the system.
To complete Task 8, I had to prepare a test plan for Inventory System of Zeus Pvt Limited,
and then, I have critically reviewed and tested Inventory System according to the plan.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61

Partial preview of the text

Download OOP Project: Product Inventory System by R.M. Sandali Rathnayake and more Study Guides, Projects, Research Object Oriented Programming in PDF only on Docsity!

R.M. Sandali Geethma Rathnayake Page no 1

Object Oriented Programming

Executive summary

This is an assignment comes under Object Oriented Programming module at HND in IT

program. For the completion of this assignment, I have to produce an Inventory System for

Zeus Pvt Limited assuming that I work as a C# programmer.

Zeus Pvt Limited is a Small Medium Enterprise, which renounce for importing a very rare

“Power™” branded nutrition supplements for patients who are suffering from Diabetes in Sri

Lanka. Therefore, I had to create a transaction processing system for Zeus Pvt Ltd.

To complete the Task 1 in this assignment, I have described the characteristics and principles

of Object Oriented Programming and provided a comprehensive report on how these

characteristics could apply in the required system.

For the Task 2 , I have been identified the objects (Classes) from the scenario and list all the

attributes and methods of each object.

Within Task 3 , I have drawn use case diagram, class diagram and sequence diagram for

Inventory System of Zeus Pvt Limited to create better and effective system solution.

To complete Task 4, I have designed and proposed an effective Inventory system solution for

Zeus Pvt Limited considering all functions should perform through the system by aid of the

Object Oriented solution using C#.Net.

In Task 5, I have provided the evidences of use of association, aggregation, composition and

generalization relationships from Inventory System of Zeus Pvt Limited.

There are two subtasks inside the Task 6 and within first subtask I have explain how the

concept of polymorphism used in Inventory System of Zeus Pvt Limited. In second subtask,

briefly explained about control structures and how those effectively have used in Inventory

System.

In Task 7, I have discussed the advantages of using Integrated Development Environment

when developing the system.

To complete Task 8, I had to prepare a test plan for Inventory System of Zeus Pvt Limited,

and then, I have critically reviewed and tested Inventory System according to the plan.

R.M. Sandali Geethma Rathnayake Page no 2

Object Oriented Programming

Within Task 9, I have to analyze the actual test results against the expected results and have

to identify whether there are any inconsistencies in Inventory System.

To complete the Task 10, I have to gather the independent feedbacks from different users on

Inventory System, which I have implemented. In order to gather feedbacks from users I used

interviews as a feedback collecting method. Using feedbacks, I was able to get more

recommendations and improvements about Inventory System.

To complete Task 11, I have to explain and prove the user friendliness of Inventory System

for Zeus Pvt Limited.

In final Task, I prepared technical documentation for the supporting and maintenance of the

Inventory System including an installation and maintenance guide.

Object Oriented Programming

Discuss the characteristics and principles of Object Oriented Programming and provide

a comprehensive report on how these characteristics could be apply in the required system.

  • R.M. Sandali Geethma Rathnayake Page no
  • Executive summary.................................................................................................................... Table of Contents
  • Acknowledgement
  • TASK
  • TASK
    • Identifying the objects (Classes) from the scenario and list all the data and methods.
  • TASK
    • Use Case Diagram................................................................................................................
    • Class Diagram
    • Sequence diagram
  • TASK
    • Implement the Object Oriented solution using C#.Net for the proposed Design
  • TASK
    • relationships from your system. Provide evidences of use of association, aggregation, composition and generalization
  • TASK
    • a) Demonstrate how concept of polymorphism used in your system.
    • b) Explain briefly how effectively control structures have used in your system.
  • TASK
    • development. Discuss the advantages of using Integrated Development Environment in the system
  • TASK
    • Prepare a test plan, then critically review and test your solution according to the plan.
  • TASK
    • Analyze actual test results against expected results and identify inconsistencies.
  • R.M. Sandali Geethma Rathnayake Page no
  • TASK Object Oriented Programming
    • other feedback collecting method) and suggest recommendations and improvements. Get independent feedback on your solution (use surveys, questioners, interviews or any
  • TASK
    • Explain and prove user friendliness of your solution.
  • TASK
    • Prepare the technical documentation for the support and maintenance of the software
    • Zeus Inventory Control System Support Guide
    • Zeus Inventory Control System Maintenance Guide
  • Conclusion
  • Self-Evaluation
  • Gantt chart
  • References

R.M. Sandali Geethma Rathnayake Page no 7

Object Oriented Programming

2) Polymorphism

The word Polymorphism means having many forms. In OOP the polymorphisms is achieved

by using many different techniques named method overloading, operator overloading, and

method overriding, The following example shows using function print () to print different

data types:

Table1. 2 : Coding example for Polymorphism

Code classPrintData{ void print(int i){ Console.WriteLine("Printing int: {0}", i);} void print(string s){ Console.WriteLine("Printing string: {0}", s);} static void Main(string[] args){ PrintData p=newPrintData(); p.print(5); p.print("Hello C++"); Console.ReadKey();}}

3) Inheritance

Inheritance allows us to define a class in terms of another class, which makes it easier to

create and maintain an application. This also provides an opportunity to reuse the code

functionality and speeds up implementation time.

Table1. 3 : Coding example for Inheritance

Code class Shape{ public void setWidth(int w){ width=w;} public void setHeight(int w){ height=h;} protect dint width; protect dint height;} class Rectangle: Shape{ public int getArea(){ return(width * height);}} classRectangleTester{ static void Main(string[] args){ Rectangle rect=new Rectangle(); rect.setHeight(5); rect.setWidth(7); Console.WriteLine("Total area: {0}", rect.getArea()); Console.ReadKey();}}

R.M. Sandali Geethma Rathnayake Page no 8

Object Oriented Programming

4) Abstract Class

The abstract modifier can use with classes, methods, properties, indexers, and events.

Members marked as abstract or included in an abstract class, must implement by classes that

derive from the abstract class.

Table1. 4 : Coding example for Abstract Class

Code class Square : ShapeClass{ int side = 0; public Square(int n){ side = n; } Public override int Area(){ return side * side; } static void Main(){ Square sq = new Square(12); Console.WriteLine("Area of Square = {0}", sq.Area()); } Interface Intl{ void M(); } Abstract class C : I { Public abstract void M(); }

5) Interface

Interfaces define properties, methods, and events, which are the members of the interface. It

is the responsibility of the deriving class to define the members.

Table1. 5 : Coding example for Interface

Code Public class ITransactions{ void showTransaction(); double getAmount(); } Public class Transaction: ITransactions{ Private string tCode,date; Private double amount; public Transaction(){ tCode = ""; date = ""; amount = 00; } public Transaction(string c, string d, double a){

R.M. Sandali Geethma Rathnayake Page no 10

Object Oriented Programming

7) Constructor

Constructors have the same name as the class or struct, and they usually initialize the data

members of the new object.

Table1. 7 : Coding example for Constructor

Code Public class Taxi{ Public bool isInitialized; public Taxi();{ isInitialized = true; }} class TestTaxi{ static void Main(){ Taxi t = new Taxi(); Console.WriteLine(t.isInitialized);}}

8) Destructor

As we all know, ‘Destructors’ are used to destruct instances of classes. When using

destructors in C#, keep in mind the following things:

1. A class can only have one destructor.

2. Destructors cannot inherit or overload.

3. A destructor does not take modifiers or have parameters.

The following is a declaration of a destructor for the class MyClass:

Table1. 8 : Coding example for Destructor

Code ~MyClass() { //Cleaning up code goes here }

9) Instant Variable

Instance variables declare in a class, but outside a method, constructor or any block. Instance

variables create when an object is created with the use of the keyword 'new' and destroyed

when the object destroys. Access modifiers can give for instance variables.

R.M. Sandali Geethma Rathnayake Page no 11

Object Oriented Programming

Table1. 9 : Coding example for Instant Variable

Code Public class Employee { Public String name; Private double salary; public Employee(String empName) { name = empName; } public voi setSalary(double empSal) { salary = empSal; }

10) Instant Method

Instance methods in a class can make use of any of the public or private static data that

belongs to that class.

Table1. 10 : Coding example for Instant Method

Code Public string Name{get; set} Public int Age{get; set} Public static Dog LastGuyThatBarked{get; protected set} Public readonly static string TheDogMotto = "Man's Best Friend"; Public static int TotalNumDogs = 0; public Dog(string name, int age) { Name =name; Age = age; TotalNumDogs++; } Public void Bark() { Console.WriteLine("{0} says Woof", Name); Dog.LastGuyThatBarked{get = this; Console.WriteLine("There are {0} total dogs", Dog.TotalNumDogs); Console.WriteLine("Remember our motto: {0}", Dog.TheDogMotto);}}

R.M. Sandali Geethma Rathnayake Page no 13

Object Oriented Programming

TASK 02

Identifying the objects (Classes) from the scenario and list all the data and

methods.

Table2. 12 : Attributes and Method of Classes

Zeus Pvt Limited Hospital Company Name : varchar Address : varchar Name : varchar Address : varchar Import(numberOfItems ) : int Deliver() : int Make_Order() : int Send_Order() : int Inventory Registry Zeus Office Product_ID : int Product_Name : varchar Name : varchar Location : varchar Balance_Invenory() : int Update_Inventory() : int Collect_purchasedOrder() : varchar Send_purchasedOrder() : varchar Zeus Warehouse Issue Officer Name : varchar Location : varchar Emp_ID : int Name : varchar Collect_Invoice() : varchar Issue_Product() : varchar Update_Inventory() : varchar Issue_Products() : varchar Sales Officer Emp_ID : int Name : varchar Send_Order() : varchar Make_Order(): varchar

R.M. Sandali Geethma Rathnayake Page no 14

Object Oriented Programming

TASK 03

Use Case Diagram

Figure3. 1 : Use Case Diagram for Zeus Inventory System

R.M. Sandali Geethma Rathnayake Page no 16

Object Oriented Programming

Sequence diagram

Figure3. 3 : Sequence Diagram for Zeus Inventory System

R.M. Sandali Geethma Rathnayake Page no 17

Object Oriented Programming

TASK 04

Implement the Object Oriented solution using C#.Net for the proposed

Design

Table4. 13 : Login Form Interface and coding

Login Form Interface

Figure4. 4 : Login Form

Code

namespace ZeusInventoryControlSystem{ public partial class frmLogin : Form { public frmLogin(){ InitializeComponent(); } Private void btnLogIn_Click(object sender, EventArgs e){ if (txtUserName.Text == "Zeuspvt"&& txtPassword.Text == "inventory@zeus"){ this.Hide(); frmMain objMain = new frmMain(); objMain.Show();} else{ Message box Show ("Sorry! You have entered wrong username or password. Try it again!", "Zeus Pvt Limited", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUserName.Clear(); txtPassword.Clear(); } }

R.M. Sandali Geethma Rathnayake Page no 19

Object Oriented Programming

frmOrderingProducts objOder = new frmOrderingProducts(); objOder.MdiParent = this; objOder.Show(); } Private void toolStripMenuItem3_Click(object sender, EventArgs e) { frmDeleteEntry objOder = new frmDeleteEntry(); objOder.MdiParent = this; objOder.Show(); } Private void toolStripMenuItem4_Click(object sender, EventArgs e) { frmHelp objHelp = new frmHelp(); objHelp.MdiParent = this; objHelp.Show(); } Private void toolStripMenuItem5_Click(object sender, EventArgs e) { Application.Exit(); }

Table4. 15 : Purchase Product Interface and coding

Purchase Product Interface

Figure4. 6 : Purchase Product Form

Code Private void btnPAdd_Click_2(object sender, EventArgs e){ if (txtPName.Text == "" || txtPPrice.Text == "" || txtPQuantity.Text == "") { MessageBox.Show("Please fill the value", "Product Inventory Control System, Zeus PVT Limited", MessageBoxButtons.OK, MessageBoxIcon.Error); }

R.M. Sandali Geethma Rathnayake Page no 20

Object Oriented Programming

else { ClassConnection objConnection = new ClassConnection(); string getString = objConnection.conMethod(); SqlConnection con = new SqlConnection(getString); try { string productName = txtPName.Text; float productPrice = float.Parse(txtPPrice.Text); int productQuantity = int.Parse(txtPQuantity.Text); con.Open(); SqlCommand command = new SqlCommand("INSERT INTO [Product] (ProductName,Price,Quantity) VALUES('" + productName + "'," + productPrice + "," + productQuantity + ")", con); command.ExecuteNonQuery(); MessageBox.Show("Data Inserted successfully", "Product Inventory Control System, Zeus PVT Limited", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { con.Close;}}}

Table4. 16 : Update Product Interface and coding

Update Product Interface

Figure4. 7 : Update Product Form

Code Private void btnUpdate_Click(object sender, EventArgs e) { if (txtUPName.Text == "" || txtUPPrice.Text == "" || txtUPQuantity.Text == "") { MessageBox.Show("Please Fill the value", "Product Inventory Control System, Zeus PVT Limited", MessageBoxButtons.OK, MessageBoxIcon.Error); } else