1. Topic:- Develop store Manegement application
No. of student names Enrollment No Branch
1] VedikaVispute 2216290037 EXTC
2] SpandanNarvekar 2216290038 EXTC
Lecturer’s
Name
MrsagarMeheta Submission Date 12/04/2023
Under the guidance of
Department of EXTC (Diploma)
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
2. CERTIFICATE
This Micro Project Report “Develop Store Manegement Application using
C” By Ms. VedikaVispute, Mr. SpandanNarvekar Approved for The Diploma of
EXTC Engineering (DIPLOMA) (First Year) For Academic Year 2023 - 2024.
Examiners
1.__________________
2.___________________
Supervisor
1. ___________________
Prof. SagarMeheta
Head of the Department Principal
Date:
Place
3. INTRODUCTION
In C programming language, store management refers to the efficient
allocation and management of memory resources in a computer program.
Memory allocation and deallocation are critical aspects of programming, as
programs need to use and release memory resources in an organized and
efficient way to avoid memory leaks and crashes.
In C, the programmer can explicitly allocate and deallocate memory using
functions like malloc(), calloc(), realloc(), and free(). These functions allow
the program to allocate memory dynamically, based on the needs of the
program at runtime.
Proper store management is important for ensuring that a program uses
memory efficiently, avoids memory leaks and crashes, and runs smoothly. It is
also an important aspect of writing secure code, as poorly managed memory
can be exploited by attackers to execute malicious code.
4. KEY TOPICS
Here are some of the key topics related to store management in C:
Memory allocation and deallocation: C provides functions like malloc(), calloc(),
realloc(), and free() to allocate and deallocate memory dynamically at runtime.
These functions can be used to allocate memory for variables, arrays, and
structures.
Pointers: Pointers are variables that store memory addresses. They are a critical
part of store management in C, as they allow the programmer to manipulate
memory directly. Pointers can be used to access and modify data stored in
memory, and to allocate and deallocate memory dynamically.
Dynamic memory allocation: C allows the programmer to allocate memory
dynamically, which means that memory can be allocated and released during
program execution. This is useful when the size of the data to be stored is not
known at compile time, or when memory needs to be allocated in response to
user input.
Memory leaks: Memory leaks occur when a program fails to release memory
that is no longer needed. This can lead to inefficient use of memory, and can
eventually cause the program to crash. Proper store management in C involves
identifying and fixing memory leaks.
Memory corruption: Memory corruption occurs when a program writes to
memory outside of the allocated range, or when memory is accessed after it has
been freed. This can lead to unpredictable behavior, crashes, and security
vulnerabilities. Proper store management in C involves preventing memory
corruption through careful allocation and deallocation of memory.
Overall, store management is an important aspect of programming in C, as it
directly impacts the performance, stability, and security of the program
5.
6. CONTENTS
Add new products of your store with their details
Maintain the buyer’s records
Update Product
Edit/Delete items if needed
View all product and their quantity
View daily sales of the items
Create new users in the system
Create or offer a discount system for products while selling
Change Admin passwords
View, Generate Bill.
Add New Product
7. SOURCE CODE FOR STORE
MANAGEMENT SYSTEM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data;
namespace MyStore.Code
{
public class Query_DB
{
BussinessLogic bl = new BussinessLogic();
public int ID {
get;
set;
}
public String EMAIL
{
get;
set;
}
public String PASSWORD
{
get;
set;
}
public int TYPE
{
get;
set;
}
public bool VerifyUser(Query_DB qdb)
{
bool temp = false;
string query = string.Format("select count(*) from
Admin where Email='{0}' and Password = '{1}'", qdb.EMAIL,
qdb.PASSWORD);
OleDbDataReader rec = bl.SelectQuery(query);
while (rec.Read())
{
if (rec[0].ToString().Equals("1"))
8. {
temp = true;
}
}
return temp;
}
public Query_DB GetUserDetails(Query_DB cdb)
{
string query = string.Format("select
ID,Email,Password,Type from Admin where Email='{0}' and
Password = '{1}'", cdb.EMAIL, cdb.PASSWORD);
OleDbDataReader rec = bl.SelectQuery(query);
while (rec.Read())
{
if (!rec[0].ToString().Equals(" ") &&
Convert.ToInt32(rec[0].ToString()) >= 1)
{
Query_DB utb = new Query_DB();
utb.ID =
Convert.ToInt32(rec[0].ToString());
utb.EMAIL = rec[1].ToString();
utb.PASSWORD = rec[2].ToString();
utb.TYPE =
Convert.ToInt32(rec[3].ToString());
return utb;
}
}
return null;
}
public bool CheckUser(String email)
{
bool temp = false;
string query = string.Format("select count(*) from
UserData where UEmail= '{0}' ", email);
OleDbDataReader rec = bl.SelectQuery(query);
while (rec.Read())
{
if (Convert.ToInt32((rec[0].ToString())) >= 1)
{
temp = true;
}
}
9. return temp;
}
public int CheckUserExist(String name,String mobile)
{
string query = string.Format("select ID from
UserData where UName= '{0}' and UMobile='{1}' ", name,mobile);
OleDbDataReader rec = bl.SelectQuery(query);
while (rec.Read())
{
if (Convert.ToInt32((rec[0].ToString())) >= 1)
{
return Convert.ToInt32(rec[0].ToString());
}
else {
return 0;
}
}
return 0;
}
public int GetMaxID(String tab)
{
String query = String.Format("Select Max(id) From
{0}", tab);
OleDbDataReader rec = bl.SelectQuery(query);
while (rec.Read())
{
if (!rec[0].ToString().Equals(""))
{
return Convert.ToInt32(rec[0].ToString());
}
else
{
return 0;
}
}
return 0;
}
public bool CreateUser(String email, String name,
String mobile, String address, String gender)
{
10. bool temp = false;
String query = String.Format("insert into UserData
values({0}+1,'{1}','{2}','{3}','{4}','{5}')",GetMaxID("UserDat
a"), email,name,mobile,address,gender);
if (bl.NonQuery(query) == 1)
{
temp = true;
}
return temp;
}
public bool ChangePassword(Query_DB cdb)
{
bool temp = false;
string query = string.Format("update Admin set
[Password]='{0}' where [ID]={1}", cdb.PASSWORD, cdb.ID);
if (bl.NonQuery(query) == 1)
{
temp = true;
}
return temp;
}
public bool CreateSell(String date,int uid,int
discount,int total,int aby)
{
bool temp = false;
String query = String.Format("insert into Sell
values({0}+1,'{1}',{2},{3},{4},{5})",
GetMaxID("Sell"),date,uid,discount,total,aby);
if (bl.NonQuery(query) == 1)
{
temp = true;
}
return temp;
}
public bool CreateSellProduct(int sid, int pid, int
qty, int price)
{
bool temp = false;
11. String query = String.Format("insert into
SellProduct values({0}+1,{1},{2},{3},{4})",
GetMaxID("SellProduct"), sid, pid,qty,price);
if (bl.NonQuery(query) == 1)
{
temp = true;
}
return temp;
}
public bool AddProduct(String name,int price,int qty)
{
String query = String.Format("insert into Product
values({0}+1,'{1}',{2},{3})",GetMaxID("Product"), name, price,
qty);
if (bl.NonQuery(query) == 1) {
return true;
}
return false;
}
public void GetProduct(DataGridView dg)
{
string query = "select PName,PPrice,PQuantity,ID
as pid from Product";
bl.filldataGrid(dg, query);
}
public void GetProductBySearch(DataGridView dg,String
se)
{
string query = "select PName,PPrice,PQuantity,ID
as pid from Product where PName like('%" + se + "%')";
bl.filldataGrid(dg, query);
}
public void GetSell(DataGridView dg)
{
string query = "select
UName,Date,Discount,Total,Sell.ID as pid,Email as ad from
Sell,UserData,Admin where Sell.Uid=UserData.ID and
Admin.ID=Sell.ABy";
bl.filldataGrid(dg, query);
}
public void GetSaleBySearch(DataGridView dg,String se)
{
12. string query = "select
UName,Date,Discount,Total,Sell.ID as pid,Email as ad from
Sell,UserData,Admin where Sell.Uid=UserData.ID and
Admin.ID=Sell.ABy and UName like('%" + se + "%')";
bl.filldataGrid(dg, query);
}
public void GetUserSell(DataGridView dg,int id)
{
string query = "select
PName,Quantity,Price,(Price*Quantity) as total from
SellProduct,Product where SellProduct.Productid=Product.ID
and Sellid="+ id +"";
bl.filldataGrid(dg, query);
}
public void GetUserSaleBySearch(DataGridView dg,int
id, String se)
{
string query = "select
PName,Quantity,Price,(Price*Quantity) as total from
SellProduct,Product where SellProduct.Productid=Product.ID
and Sellid=" + id + " and PName like('%" + se + "%')";
bl.filldataGrid(dg, query);
}
public void GetUser(DataGridView dg)
{
string query = "select UName,UMobile from
UserData";
bl.filldataGrid(dg, query);
}
public void GetUserBySearch(DataGridView dg,String ae)
{
string query = "select UName,UMobile from UserData
where UName like ('%"+ae+"%')";
bl.filldataGrid(dg, query);
}
public void GetSellProduct(DataGridView dg,int sid)
{
string query = "select
PName,Quantity,Price,(Quantity*Price) as total from
SellProduct,Product where SellProduct.Sellid=" + sid + " and
SellProduct.Productid=Product.ID";
bl.filldataGrid(dg, query);
}
public bool UpdateProduct(String name,String
price,String qty,int id) {
13. string query = string.Format("update Product set
[PName]='{0}',[PPrice]={1},[PQuantity]={2} where ID={3}",
name, price, qty,id);
if (bl.NonQuery(query) == 1)
{
return true;
}
return false;
}
}
}
17. In conclusion, store management is an important aspect of
programming in C. C provides functions like malloc(), calloc(),
realloc(), and free() for memory allocation and deallocation. These
functions allow the programmer to allocate memory dynamically
based on program needs. Proper store management involves
identifying and fixing memory leaks and preventing memory
corruption. Effective store management is crucial for ensuring
efficient use of memory, program stability, and security.
CONCLUSION