0% found this document useful (0 votes)
43 views110 pages

Stock Management

This project report details the development of a Stock Management System aimed at improving the management of electronic item stocks. It includes system analysis, specifications, design, and feasibility studies to assess technical, economic, and operational aspects. The report serves as documentation for the project undertaken by students of Late P.S. Hirapara Mahila BCA College, under the guidance of Prof. Darshit Somaiya.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views110 pages

Stock Management

This project report details the development of a Stock Management System aimed at improving the management of electronic item stocks. It includes system analysis, specifications, design, and feasibility studies to assess technical, economic, and operational aspects. The report serves as documentation for the project undertaken by students of Late P.S. Hirapara Mahila BCA College, under the guidance of Prof. Darshit Somaiya.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 110

A Project Report on: Stock Management

Project ID
08
A
Project Report On
Stock Management
Submitted in the Partial fulfillment of the requirement for awarding the degree of

Bachelor of Computer Application (BCA)

SEM VI, Year 2022-23

By
Uravi Movaliya
Riddhi Ghadiya

Under the Guidance of


Prof.Darshit Somaiya

DEPARTMENT OF COMPUTER SCIENCE


LATE P.S. HIRAPARA MAHILA BCA COLLEGE JETPUR
Affiliated to
SAURASHTRA UNIVERSITY - RAJKOT

P S Hirapara Mahila College -JETPUR Page I


Preface

This report contains all the outputs of a project undertaken to develop a working
model of Stock Management and to study the existing working system. As part of this
study, we analyzed the requirements of the working model and tried to improve it using the
technological functionality that the current computer science provides.

This volume contains the documentation summary of the working system, the
background study and analysis, the technical requirements and the working specification of
the developed system.

We recommend the user to take the advantage of the study presented here and
implement the system with their required improvisation. We hope this study will reduce
the burden of the reanalysis of the development phase.
Acknowledgment

“It is not possible to prepare a project report without the assistance &
encouragement of other people. This one is certainly no exception.”

On the very outset of this report, We would like to extend our sincere & heartfelt
obligation towards all the personages who have helped us in this endeavor. Without their
active guidance, help, cooperation & encouragement, we would not have made headway in
the project. We are ineffably indebted to our HOD / Prof. Jitendra Kabariya for
conscientious guidance and encouragement to accomplish this assignment.

We are extremely thankful and pay our gratitude to our project guide
Prof. Darshit Somaiya his valuable guidance and support on completion of this project in
its presently.

We extend our gratitude to Department Of Computer Science, Late P.S. Hirapara


Mahila BCA College -Jetpur for giving us this opportunity.

Thanking You

Riddhi Ghadiya (003203203065)


Uravi Movaliya (003203203099)
INDEX
Sr. No. Title Page No.

1 Project Profile
1.1 Definition 1

1.2 Scope 1

1.3 Objective 1

2 System Analysis and Specification


2.1 Introduction 2

2.2 Feasibility Study 2

2.3 Problem Analysis 6

2.4 Need of New System 7

3 System Requirement Specification


3.1 Proposed System and Advantages 8

4 System Design
4.1 Data Flow Diagram 10

4.2 E-R Diagram 13

4.3 Data Dictionary 14

5 Screen Design 16

6 Coding 30

7 Testing (Manual, Test Cases and Test Data)


7.1 Manual Testing 99

7.2 Test Cases 101

8 Enhancements
8.1 Advantages 104

8.2 Limitation 104

8.3 Future Scope 104

9 References 105
A Project Report on: Stock Management

1-Project Profile

1.1 Definition

Our Project defination is Stock Management. Our Site is


special for manage any item stock like,electronic items.Stock
Management System can provide selling of product or manage the
stock of any electronic items.

1.2 Scope

This System work on mozila firefox and version of any System.

It will be developed for the good management of System.

1.3 Objective

In this System is worked properly.

Our main aim is manage the stock.

P S Hirapara Mahila College -JETPUR Page 1


A Project Report on: Stock Management

2-System Analysis and Specification

INTRODUCTION

Preliminary Investigation

The Computer Marketing System is web application which can be used by the user
whenever new user came at a time.They required to register.

People can see the television advertisement and get the information about of
electronic shopping.

Such as TV, Hair Machine, AC, Fan, Laptop, Mobile, Washing Machine in etc. Item
stock: Admin can manage the stock and product.

User can show the category and product.user can show the product and purchase the
product and get the information about our stock.

FEASIBILTY STUDY

Feasibility study is the likelihood that whether the system will be useful to the
organization or not. After studying the requirements, whether the proposed project is feasible
or not is determined by checking the various feasibilities.

The main aim of the feasibility study is to determine whether developing system is
financially and technically feasible. The feasibility study involves analysis of the problem
and collection of data which would be input to the system, the processing required to be
carried out on these data, the output data required to be produced by the system, as well as
study of various constraints on the behavior of the system.
The three aspects in the feasibility study portion are:

 Technical Feasibility
 Economical Feasibility
 Operational Feasibility

Brief introduction of above 3 feasibilities is as under:

P S Hirapara Mahila College -JETPUR Page 2


A Project Report on: Stock Management

Technical Feasibility

Technical feasibility is considered in terms of technical requirements and their


availability in the market. It determines whether the current level of technology supports the
proposed system or not. The technical possibility of proposed system is as follow:
 Since the main aim of technical feasibility study is to determine whether unit posses
the hardware as well as related software for the project.
 Proposed system does not require much technical detail.
 The current manual system is not so much sufficient for processing of all kinds of
tasks.
 It needs low configuration computer system or high configuration computer system
and the required operation system.
 It just required windows operating system.
 The organization is ready to purchase the entire required device, required by the
proposed system.
 This technical specification is easily available in the market. Therefore the proposed
system is technical feasible.

Technical feasibility is considered in terms of technical requirements and their


availability in the market. It determines whether the current level of technology supports the
proposed system or not. The technical possibility of proposed system is as follow.

In order to develop the web-application except some basic requirement there is no need of
extra technology. Also no other workforce is required to develop the application. Yes,
Internet is required but you can also run it off-line by sharing

P S Hirapara Mahila College -JETPUR Page 3


A Project Report on: Stock Management

Technical Feasibility

Hardware Specification

Processor 1 GHz or Higher Intel

Motherboard Compatible with the processor

Hard Disk 250 GB or More

RAM 1 or 2 GB

Monitor Any CRT/LCD/LED

SMPS 450 Watt

Keyboard Any Multimedia

Mouse Optical
.

Software Specification

Front End ASP .NET, CSS, JS

Back End SQL Server

Any web browser (Preferable Mozilla


Browser
Firefox, Chrome)

Operating System Microsoft Windows 8 or higher version

Server Technology Windows Server

P S Hirapara Mahila College -JETPUR Page 4


A Project Report on: Stock Management

Economical Feasibility

The economical feasibility is considered in terms of money or rupees value. The


organization measures the cost effectiveness of the project. The economical feasibility of the
proposed system is as under.

 The organization is ready to invest in the proposed system for latest technology and
better result.
 As the personnel and the manager know the computer operating, the unit need not
have to appoint any computer operator.
 If any of the staff in the firm knows how to operate the computer, than the firm needs
number to recruit a new person.
 The unit has to spend not much amount for the computer hardware and software.
 The organization is capable for paying the money for proposed system.
 Therefore the project possesses the economical feasibility.

The economical feasibility is considered in terms of money or rupees value. It measures


the cost effectiveness of the project. The economical feasibility of the proposed system is as
under.

As it is an on-line application a minimal cost of web-hosting will be charged. But it will


be affordable. There would not be any charge to have look to site off-line while under
construction.

P S Hirapara Mahila College -JETPUR Page 5


A Project Report on: Stock Management

Economical Feasibility

Hardware Specification Price

Processor Intel core i3 ₹ 8,675

Motherboard GA H61M D2-B3 ₹ 3230

Hard Disk Seagate 500 GB ₹ 1660

RAM DDR3 4GB ₹ 495

Monitor Dell 18.5” LED ₹ 4500

SMPS Circle 450 Watt ₹ 500

Keyboard Logitech Wired keyboard ₹ 500

Mouse Logitech Optical USB ₹ 250

Software Specification Price

CSS, JS Free
Front End
ASP .NET ₹ 1,999

Back End SQL Server 2016 ₹ 8000

Any web browser (Preferable


Browser Free
Mozilla Firefox)
₹ 4800
Operating System Microsoft Windows 10

Server Technology Windows Server 12 ₹ 3000 approx

P S Hirapara Mahila College -JETPUR Page 6


A Project Report on: Stock Management

Operational feasibility

The operational feasibility deals with the matter whether the proposed system fulfills
the requirement of the firm or the department requirement.

The possibility of the operational feasibility is as under.


 The proposed system will fulfill the firm’s requirements.
 The proposed system covers all the aspect of the working system.
 The expected users of the proposed system re honestly ready for the new system.
 The changes made in this system are quite beneficial or not.

We can say that proposed system is operationally beneficial.

The operational feasibility deals with the matter whether the proposed system fulfills the
requirement of the user or not. The possibility of the operational feasibility is as under.

Those who have the knowledge of Internet and regularly surfing the sites can easily make
a visit to the site. They would not require special skills, just follow the links or use site-maps.

P S Hirapara Mahila College -JETPUR Page 7


A Project Report on: Stock Management

3-System Requirement And Specification

 User side

Home:

It is display the mean about our website.

Register:

User can register the site.

Login:

User can Login in the site.

Feedback:

User can insert the feedback in the site.

Product:

User can see the different product in the site.

Purchase:

User can purchase the product in the site.

P S Hirapara Mahila College -JETPUR Page 8


A Project Report on: Stock Management

 Admin side

Login:

Admin can login in the site.

Register:

Admin can register in the site.

Category:

Admin can add category in the site.

Sub Category:

Admin can view, add, update or delete the sub category in the site.

Stock:

Admin can view, add, update or delete the stock in the side.

View Feedback:

Admin can view Feedback in the site.

View Product:

Admin can insert, update, delete or view product in the site.

View Purchase:

Admin can view the purchase detail in the site.

View Stock:

Admin can view and insert the stock in the site.

P S Hirapara Mahila College -JETPUR Page 9


A Project Report on: Stock Management

4-System Design

4.1Data Flow Diagram:

This System is used the data flow diagram array following meaning.

Symbol Name Use

Rectangle It Symbolize the Source.

It Symbolized the use data


Circle process.

It Symbolized Connectivity
Unmarked Line without a.

It Symbolized Connectivity
Marked Line without a.

It Symbolized Connectivity
Round Rectangle without a.

P S Hirapara Mahila College -JETPUR Page 10


A Project Report on: Stock Management

4.2 0-level:

4.3 1-level:

P S Hirapara Mahila College -JETPUR Page 11


A Project Report on: Stock Management

4.5 E-R Diagram:

P S Hirapara Mahila College -JETPUR Page 12


A Project Report on: Stock Management

4.4 Data dictionary:

P S Hirapara Mahila College -JETPUR Page 13


A Project Report on: Stock Management

Registration:

Field name Date type Key


u_id Int(10) Primary key
username Varchar(20) -
password Varchar(20) -
fname Varchar(20) -
lname Varchar(20) -
city Varchar(50) -
address Varchar(50) -
contactno Varchar(10) -
s_question Varchar(20) -
answer Varchar(100) -
emailid Varchar(50) -
u_type Int(5) -

Feedback:

Field name Data type Key


f_id Int(5) Primary key
u_id Int(5)
username Varchar(50) -
comment Varchar(500) -

Category:

Field name Data type key

c_id Int(5) Primary key


c_name Varchar(20) -

Sub category:

Field name Data type key

s_id Int Primary key


name Varchar(20) -
c_id Int -

Product:

P S Hirapara Mahila College -JETPUR Page 14


A Project Report on: Stock Management

Field name Data type Key


p_id Int(5) Primary key
c_id Int(5) Foreign key
p_nm Varchar(20) -
p_img Varchar(50) -
p_price Varchar(10) -
p_quantity Varchar(10) -
p_desc Varchar(200) -

Add to cart:

Field name Data type Key


a_id Int(5) Primary key
u_id Int(5) Foreign key
p_id Int(5) Foreign key
a_quantity Int(5) -

Bill :

Field name Data type Key


b_id Int(5) Primary key
u_id Int(5) Foreign key
b_total Varchar(10) -
pur_date Date -
b_status Varchar(50) -
b_nm Varchar(50) -
b_eid Varchar(20) -
b_con Varchar(200) -
b_city Varchar(50) -
b_add Varchar(50) -

Bill 1:

Field name Data type Key


b1_id Int(5) Primary key
b_id Int(5) Foreign key
p_id Int(5) Foreign key
p_quantity Int(5) Foreign key
5-ScreenShots

P S Hirapara Mahila College -JETPUR Page 15


A Project Report on: Stock Management

Home:

-User can view home page.

Registration:

-User can register in the site.

Login:

P S Hirapara Mahila College -JETPUR Page 16


A Project Report on: Stock Management

-User can login in the site.

Changepassword:

-User can change password in site.

Forgot password1:

P S Hirapara Mahila College -JETPUR Page 17


A Project Report on: Stock Management

-User can forgot password in site.

Forgot password2:

-User can forget password in site.

Forgot password3:

P S Hirapara Mahila College -JETPUR Page 18


A Project Report on: Stock Management

-User can forget password in site.

 User side:-

Home1:

-User can view home page.


About us:

P S Hirapara Mahila College -JETPUR Page 19


A Project Report on: Stock Management

-User can view aboutus page.

Contact us:

-User can view Contactus page.

Product:

P S Hirapara Mahila College -JETPUR Page 20


A Project Report on: Stock Management

-User can view product.

Shopping cart:

P S Hirapara Mahila College -JETPUR Page 21


A Project Report on: Stock Management

-User can purchase product.

User purchase:

-User can find pyment detail.

Thankyou:

P S Hirapara Mahila College -JETPUR Page 22


A Project Report on: Stock Management

-User can view thanyou page.

Feedback:

-User can write feedback for our site.

Admin side:-

P S Hirapara Mahila College -JETPUR Page 23


A Project Report on: Stock Management

View Registration:

-Admin can view Registration in site.

View feedback:

-Admin can view feedback in site.

View category:

P S Hirapara Mahila College -JETPUR Page 24


A Project Report on: Stock Management

-Admin can view category in site.

Add category:

-Admin can add category in site.

View subcategory:

P S Hirapara Mahila College -JETPUR Page 25


A Project Report on: Stock Management

-Admin can view subcategory in site.

Add subcategory:

-Admin can add subcategory in site.

View product:

P S Hirapara Mahila College -JETPUR Page 26


A Project Report on: Stock Management

-Admin can view product in site.

Add product:

P S Hirapara Mahila College -JETPUR Page 27


A Project Report on: Stock Management

-Admin can add product in site.

View purchase:

-Admin can view purchase page in site.


View purchase detail:

P S Hirapara Mahila College -JETPUR Page 28


A Project Report on: Stock Management

-Admin can view purchase detail in site.

6-Coding

Stock.master:

P S Hirapara Mahila College -JETPUR Page 29


A Project Report on: Stock Management

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="stock.master.cs"


Inherits="stock" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="stylesheet/style.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="wrapper">
<div id="header">
<div id="float_left">
<asp:Image ID="image1" runat="server" ImageUrl="~/image/9.jpg"
Height="100px" Width="119px" />
</div>
<div id="float_right">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="user_login" runat="server"
PostBackUrl="~/user/login.aspx"><img src="../image/4.jpg" height="50" width="50"
/></asp:LinkButton>
<asp:LinkButton ID="user_logout" runat="server"
OnClick="user_logout_Click"><img src="../image/69.gif" height="50" width="60"
/></asp:LinkButton></br>
<asp:Label ID="wel_msg" runat="server" Text=""
ForeColor="Black"></asp:Label></br>
<asp:LinkButton ID="user_changepass" runat="server"
PostBackUrl="~/user/changepass.aspx"
ForeColor="Black">Changepassword</asp:LinkButton>
</div>
<div id="header_title">
<b>Stock Management </b>
</div>
</div>
<div id="menu" align="left">

<b>
<asp:LinkButton ID="user_home" runat="server"
PostBackUrl="~/user/home.aspx">Home</asp:LinkButton>
<asp:LinkButton ID="user_about_us" runat="server"
PostBackUrl="~/user/about_us.aspx">About us</asp:LinkButton>
<asp:LinkButton ID="user_contact_us" runat="server"
PostBackUrl="~/user/contact_us.aspx">Contact us</asp:LinkButton>
<%--- %><asp:LinkButton ID="user_feedback" runat="server"
PostBackUrl="~/user/feedback.aspx">Feedback</asp:LinkButton>---%>

P S Hirapara Mahila College -JETPUR Page 30


A Project Report on: Stock Management

<asp:LinkButton ID="user_product" runat="server"


PostBackUrl="~/user/product.aspx">Product</asp:LinkButton>
<asp:LinkButton ID="user_feedback" runat="server"
PostBackUrl="~/user/feedback.aspx">Feedback</asp:LinkButton>
<%-- <asp:LinkButton ID="user_forgotpwd1" runat="server"
PostBackUrl="~/user/forgotpwd1.aspx" >Forgot password</asp:LinkButton>--%>
<%-- <asp:LinkButton ID="user_changepass" runat="server"
PostBackUrl="~/user/changepass.aspx">Changepassword</asp:LinkButton>--%>
<asp:LinkButton ID="adm_home" runat="server"
PostBackUrl="~/admin/home.aspx">Home</asp:LinkButton>
<%--- <asp:LinkButton ID="user_contact_us" runat="server"
PostBackUrl="~/user/contact_us.aspx">Contact us</asp:LinkButton>---%>
<asp:LinkButton ID="adm_viewreg" runat="server"
PostBackUrl="~/admin/view_reg.aspx">view registration</asp:LinkButton>
<asp:LinkButton ID="adm_viewfeedback" runat="server"
PostBackUrl="~/admin/view_feed.aspx">view feedback</asp:LinkButton>
<asp:LinkButton ID="adm_viewcategory" runat="server"
PostBackUrl="~/admin/view_category.aspx">view category</asp:LinkButton>
<asp:LinkButton ID="adm_viewproduct" runat="server"
PostBackUrl="~/admin/view_product.aspx">view product</asp:LinkButton>
<asp:LinkButton ID="adm_viewpurchase" runat="server"
PostBackUrl="~/admin/view_purchase.aspx">view purchase</asp:LinkButton>
<%--- %> <asp:LinkButton ID="adm_viewpurchasedetail" runat="server"
PostBackUrl="~/admin/view_purchsedetail.aspx">view purchasedetail</asp:LinkButton>---
%>
</div>
<div id="content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<div id="footer">
<center> Develop by:Uravi movaliya & Riddhi ghadiya</center>
</div>
</div>
</div>
</form>
</body>
</html>

Stock.master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class stock : System.Web.UI.MasterPage


{
protected void Page_Load(object sender, EventArgs e)

P S Hirapara Mahila College -JETPUR Page 31


A Project Report on: Stock Management

{
if(Session.Contents.Keys.Count>0)
{
if(Session["u_type"].ToString()=="0")
{
wel_msg.Text = "welcome..." + Session["username"].ToString();
wel_msg.Visible = true;
user_login.Visible = false;
user_logout.Visible = true;
user_home.Visible = true;
user_product.Visible = true;
user_contact_us.Visible = true;
user_feedback.Visible = true;
user_changepass.Visible = true;
user_about_us.Visible = true;
adm_viewreg.Visible = false;
adm_viewfeedback.Visible = false;
adm_viewcategory.Visible = false;
adm_viewproduct.Visible = false;
adm_viewpurchase.Visible = false;
adm_home.Visible = false;
// adm_viewpurchasedetail.Visible = false;

}
else
{
wel_msg.Text = "welcome..." + Session["username"].ToString();
wel_msg.Visible = true;
user_login.Visible = false;
user_logout.Visible = true;
user_home.Visible = true;
user_product.Visible = false;
user_contact_us.Visible = false;
user_feedback.Visible = false;
user_changepass.Visible = true;
user_about_us.Visible = false;
adm_viewreg.Visible = true;
adm_viewfeedback.Visible =true;
adm_viewcategory.Visible = true;
adm_viewproduct.Visible = true;
adm_viewpurchase.Visible =true;
adm_home.Visible = false;
// adm_viewpurchasedetail.Visible = true;
}
}
else
{
wel_msg.Visible = false;
user_login.Visible = true;
user_logout.Visible = false;

P S Hirapara Mahila College -JETPUR Page 32


A Project Report on: Stock Management

user_home.Visible = true;
user_product.Visible = false;
user_contact_us.Visible = true;
user_feedback.Visible = false;

user_about_us.Visible = true;
adm_viewreg.Visible = false;
adm_viewfeedback.Visible = false;
adm_viewcategory.Visible = false;
adm_viewproduct.Visible = false;
adm_viewpurchase.Visible = false;
adm_home.Visible = false;
// adm_viewpurchasedetail.Visible = false;
}
}
protected void user_logout_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Remove("username");
Session["username"] = "";
Response.Redirect("home.aspx");
}
}

home.aspx:

<%@ Page Title=”” Language=”C#” MasterPageFile=”~/stock.master”


AutoEventWireup=”true”
CodeFile=”home.aspx.cs” Inherits=”user_home” %>

<asp:Content ID=”Content1” ContentPlaceHolderID=”head” runat=”Server”>


</asp:Content>
<asp:Content ID=”Content2” ContentPlaceHolderID=”ContentPlaceHolder1”
runat=”Server”>

<div id=”home_content”>
<center><h1 style=”font-family:’MV Boli’;font-size:xx-large;color:black;”>Welcome
to our site…</h1>
</center>
<center>
<img src=”../image/28.jpg” height=”200” width=”300” />
<img src=”../image/23.jpg” height=”200” width=”300” />
<img src=”../image/27.jpg” height=”200” width=”300” />
</center>
</div>
</asp:Content>
Web.config:

<?xml version=”1.0”?>

P S Hirapara Mahila College -JETPUR Page 33


A Project Report on: Stock Management

<!—
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433

<configuration>

<connectionStrings>
<add name=”stock” connectionString=”Data Source=(LocalDB)\
v11.0;AttachDbFilename=E:\tybca\stockmanagement\App_Data\
stockmanagement.mdf;Integrated Security=True”
providerName=”System.Data.SqlClient”/>

</connectionStrings>
<system.web>
<compilation debug=”true” targetFramework=”4.5” />
<httpRuntime targetFramework=”4.5” />
</system.web>
<appSettings>
<add key=”ValidationSettings:UnObtrusiveValidationMode” value=”none”/>
</appSettings>
</configuration>

Registration.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="registration.aspx.cs" Inherits="user_registration"
unobtrusiveValidationMode="none" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<link href="stylesheet/style.css" rel="stylesheet" />
<center>
<th align="center" colspan="2">

<h1> Registration</h1>
</th>
<table class="table" border="2">
<tr>
<td class="label">

<asp:Label ID="Label1" runat="server"


Text="FirstName"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp
<asp:TextBox Id="fnm" runat="server" CssClass="textbox" pattern="^[a-z A-Z]
+$" placeholder="Enter firstname" ToolTip="please enter firstname"></asp:TextBox>

P S Hirapara Mahila College -JETPUR Page 34


A Project Report on: Stock Management

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"


ErrorMessage="Enter only character" ControlToValidate="fnm" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label2" runat="server"
Text="LastName"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;
<asp:TextBox Id="lnm" runat="server" CssClass="textbox" pattern="^[a-z A-Z]
+$" placeholder="Enter Lastname" ToolTip="please enter lastname"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Enter only character" ControlToValidate="lnm" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label10" runat="server"
Text="Adress"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="add" runat="server" CssClass="textbox" placeholder="Enter
address" ToolTip="please enter address"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ErrorMessage="Enter Address" ControlToValidate="add" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label3" runat="server"
Text="city"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="city" runat="server" CssClass="textbox" placeholder="Enter
city" ToolTip="please enter city"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ErrorMessage="Enter city" ControlToValidate="city" ForeColor="Red" Display="Dynamic"
CssClass ="error"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="req_city" runat="server"
ControlToValidate="city" ErrorMessage="Enter only Character" Font-Bold="True"
ForeColor="Red" ValidationExpression="^[a-z A-Z]+$"
Display="Dynamic"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label4" runat="server"
Text="ContactNo"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="cono" runat="server" MaxLength="10" CssClass="textbox"
placeholder="Enter ContactNo" ToolTip="please enter contactno"></asp:TextBox>

P S Hirapara Mahila College -JETPUR Page 35


A Project Report on: Stock Management

<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"


ErrorMessage="Enter only 10 digit" ControlToValidate="cono" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="req_cono" runat="server"


ControlToValidate="cono" Display="Dynamic" ErrorMessage="Allow only 10 digit.."
ForeColor="Red" ValidationExpression="\d{10}">Allow only 10
digit..</asp:RegularExpressionValidator>

</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label5" runat="server"
Text="Email-Id"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="emailid" runat="server" TextMode="Email"
CssClass="textbox" placeholder="Enter Email" ToolTip="please enter
email-id"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ErrorMessage="Enter emailid" ControlToValidate="emailid" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label6" runat="server"
Text="UserName"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="username" runat="server" CssClass="textbox"
placeholder="Enter username" ToolTip="please enter username"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ErrorMessage="Enter only character" ControlToValidate="username" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label7" runat="server"
Text="Password"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="password" runat="server" TextMode="Password"
CssClass="textbox" placeholder="Enter Password" ToolTip="please enter
password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"
ErrorMessage="Enter password" ControlToValidate="password" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label8" runat="server"
Text="Question"></asp:Label>&nbsp;&nbsp;

P S Hirapara Mahila College -JETPUR Page 36


A Project Report on: Stock Management

<asp:DropDownList ID="s_question" runat="server" Height="30px"


Width="210px" CssClass="textbox">
<asp:ListItem>
Which is Your Favourite Food??
</asp:ListItem>
<asp:ListItem>
Which is Your Favourite Game??
</asp:ListItem>
<asp:ListItem>
Which is Your Favourite Movie??
</asp:ListItem>
<asp:ListItem>
Which is Your Favourite Hobby??
</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label9" runat="server"
Text="Answer"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox Id="answer" runat="server" CssClass="textbox"
placeholder="Enter Answer" ToolTip="please enter answer"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ErrorMessage="Enter answer" ControlToValidate="answer" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr><br />
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" Text="submit" CssClass="button"
OnClick="Button1_Click" ></asp:Button>
<asp:Button ID="Button2" runat="server" Text="Clear" CssClass="button"
OnClick="Button2_Click"></asp:Button>
</td>
</tr>
</table>
</center>
</asp:Content>

registration.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

P S Hirapara Mahila College -JETPUR Page 37


A Project Report on: Stock Management

public partial class user_registration : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender,EventArgs e)
{
String str=ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(str);
con.Open();
string s = "insert into registration
(fname,lname,address,city,contactno,emailid,username,password,s_question,answer)values('"
+ fnm.Text + "','" + lnm.Text + "','"+add.Text+"','" + city.Text + "','" + cono.Text + "','" +
emailid.Text + "','" + username.Text + "','" + password.Text + "','" +
s_question.SelectedItem.ToString() + "','" + answer.Text + "')";
cmd=new SqlCommand(s,con);

// con.Open();
int i = cmd.ExecuteNonQuery();
if(i>0)
{
Response.Redirect("login.aspx");
}
con.Close();
}

protected void Button2_Click(object sender,EventArgs e)


{
fnm.Text = "";
lnm.Text = "";
add.Text = "";
city.Text = "";
cono.Text = "";
emailid.Text="";
username.Text="";
password.Text="";
s_question.SelectedValue="0";
answer.Text="";
}

login.aspx:

P S Hirapara Mahila College -JETPUR Page 38


A Project Report on: Stock Management

<%@ Page Title="" Language="c#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="login.aspx.cs" Inherits="user_login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<link href="../stylesheet/style.css" rel="stylesheet" />
<center>

<th align="center" colspan="2">


<h1>Login</h1>
</th>
<div id="float_center">
<img src="../image/2.png" style="height: 75px; width: 162px; margin-top: 0px" />
</div>
<asp:Label ID="lblmsg" runat="server" Visible="true" CssClass="error"></asp:Label>
<table class="table" border="2">
<tr>
<td class="label">
<asp:Label ID="Label2" runat="server" Text="Username"></asp:Label>
<asp:TextBox ID="usernm" runat="server" placeholder="Enter Username"
ToolTip="please Enter Username" ValidationGroup="login"
CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Enter only character" ControlToValidate="usernm" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="label">
<asp:Label ID="Label1" runat="server" Text="Password"></asp:Label>&nbsp;
<asp:TextBox ID="password" runat="server" placeholder="Enter password"
TextMode="Password" CssClass="textbox" ToolTip="Please Enter
password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"
ErrorMessage="Enter password" ControlToValidate="password" ForeColor="Red"
Display="Dynamic" CssClass ="error"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" class="label">
<asp:Button ID="Button1" runat="server" Text="Login" Height="44px"
Width="92px" CssClass="button" OnClick="Button1_Click"></asp:Button>
<asp:Button ID="Button2" runat="server" Text="Clear" Height="44px"
Width="92px" CssClass="button" OnClick="Button2_Click"></asp:Button>
</td>
</tr>

P S Hirapara Mahila College -JETPUR Page 39


A Project Report on: Stock Management

<tr>
<td colspan="2" align="center">
<a href="registration.aspx" class="for" style="text-
decoration:underline">Create A New Account</a><br />
<a href="forgetpass1.aspx" class="for" style="text-
decoration:underline">Forgot PAssword???</a>
</td>
</tr>
</table>
</center>
</asp:Content>

login.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class user_login : System.Web.UI.Page


{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\
v11.0;AttachDbFilename=E:\tybca\stockmanagement\App_Data\
stockmanagement.mdf;Integrated Security=True");
SqlCommand cmd;
SqlDataReader dr;
int i;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("select * from registration where username='" + usernm.Text
+ "' AND Password='" + password.Text + "'", con);
con.Open();
dr = cmd.ExecuteReader();
if(dr.HasRows)
{
dr.Read();
if(i==0)
{
Session["u_id"] = dr["u_id"].ToString();
Session["u_type"] = dr["u_type"].ToString();
Session["username"] = dr["username"].ToString();

P S Hirapara Mahila College -JETPUR Page 40


A Project Report on: Stock Management

Response.Redirect("../admin/home.aspx");

}
else
{
Session["u_id"] = dr["u_id"].ToString();
Session["u_type"] = dr["u_type"].ToString();
Session["username"] = dr["username"].ToString();
Response.Redirect("../user/home.aspx");
}
}
else
{
lblmsg.Text = "Invalid username and password";
}
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
usernm.Text = "";
password.Text = "";
}
}

changepass.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="changepass.aspx.cs" Inherits="user_changepass" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr></div>
<center>
<br />
<table align="center" class="table" border="2">
<th colspan="3" class="th" >
<h1>Change password</h1>
</th>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Old Password"></asp:Label>
</td>

P S Hirapara Mahila College -JETPUR Page 41


A Project Report on: Stock Management

<td>
<asp:TextBox ID="txt_old" runat="server" type="password" placeholder="Old
password" CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_oldpassword" runat="server"
ErrorMessage="Enter old password" ControlToValidate="txt_old" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>

</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="New
Password"></asp:Label>
</td>

<td>
<asp:TextBox ID="txt_new" runat="server" type="password"
placeholder="New password" CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_newpassword" runat="server"
ErrorMessage="Enter new password" ControlToValidate="txt_new" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>

</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Confirm
Password"></asp:Label>
</td>

<td>
<asp:TextBox ID="txt_con" runat="server" type="password"
placeholder="Confrom password" CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_confirmpassword" runat="server"
ErrorMessage="Enter confirm password" ControlToValidate="txt_con" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>

</td></tr>
<tr>
<th colspan="3"class="th">
<asp:Button ID="submit" runat="server" Text="submit" CssClass="button"
OnClick="submit_Click"/>
<input type="reset" runat="server" text="Clear" class="button" />
</th>
</tr>
</table><br />
</center>
</asp:Content>
changepass.aspx.cs:

P S Hirapara Mahila College -JETPUR Page 42


A Project Report on: Stock Management

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_changepass : System.Web.UI.Page


{
SqlConnection con;
SqlCommand com;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
con = new
SqlConnection(ConfigurationManager.ConnectionStrings["stock"].ConnectionString);
}
protected void submit_Click(object sender, EventArgs e)
{

con.Open();
com = new SqlCommand("select * from registration where u_id=" + Session["u_id"]
+ "", con);
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
if (txt_old.Text == dr["password"].ToString())
{
dr.Close();
if (txt_new.Text == txt_con.Text)
{
com = new SqlCommand("update registration set password='" + txt_con.Text
+ "' where u_id=" + Session["u_id"] + "", con);
int i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("login.aspx");
}
else
{
Response.Redirect("changepass.aspx");
}
}
}
}

P S Hirapara Mahila College -JETPUR Page 43


A Project Report on: Stock Management

else
{
Response.Redirect("forgetpass1.aspx");
}
con.Close();
}
}

forgetpass1.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="forgetpass1.aspx.cs" Inherits="user_forgetpass1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr>
<center>
<br />
<table align="center" class="table" border="2">
<th colspan="3" class="th">Forgot UserName</th>
<tr>
<td><asp:Label ID="Label1" runat="server"
Text="Username"></asp:Label></td>
<td><asp:TextBox ID="txt_unm" runat="server" CssClass="textbox"
placeholder="Username"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_name" runat="server"
ControlToValidate="txt_unm" ErrorMessage="Enter name" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="reqname" runat="server"
ControlToValidate="txt_unm" ErrorMessage="Enter only Character" Font-Bold="True"
ForeColor="Red" ValidationExpression="^[a-z A-Z]+$"
Display="Dynamic"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<a href="forgetpass2.aspx"><asp:Button ID="next" runat="server" Text="Next"
CssClass="button" OnClick="next_Click"/> </a>
<input type="reset" runat="server" text="Cancle" class="button" /> </td>
</tr>
</table><br />

P S Hirapara Mahila College -JETPUR Page 44


A Project Report on: Stock Management

</center>
</asp:Content>

forgetpass1.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_forgetpass1 : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
string s =
ConfigurationManager.ConnectionStrings["stock"].ConnectionString.ToString();
con = new SqlConnection(s.ToString());

}
protected void next_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("select * from registration where username='" + txt_unm.Text
+ "'", con);
con.Open();
{
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
int u_id = Convert.ToInt16(dr["u_id"].ToString());
Response.Redirect("forgetpass2.aspx?u_id=" + u_id);
}
}
con.Close();
}
}

forgetpass2.aspx:

P S Hirapara Mahila College -JETPUR Page 45


A Project Report on: Stock Management

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="forgetpass2.aspx.cs" Inherits="user_forgetpass2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr>
<center>
<br />

<table align="center" class="table" border="2">


<th colspan="3" class="th"> Forget Answer</th>
<tr>
<td><asp:Label ID="Label1" runat="server" Text="Security
Que."></asp:Label></td>

<td> <asp:TextBox ID="txt_sq" runat="server" placeholder="Seque Que"


CssClass="textbox" ></asp:TextBox>

</td>
</tr>
<tr>
&nbsp;
<td>
<asp:Label ID="Label2" runat="server" Text="Answer"></asp:Label>
</td>
<td><asp:TextBox ID="txt_ans" runat="server" placeholder="Answer"
CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="Reqanswer" runat="server"
ControlToValidate="txt_ans" ErrorMessage="Enter your answer" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>

</td>
</tr>
<tr><th class="th" colspan="2">
<asp:Button ID="next" runat="server" Text="Next" CssClass="button"
OnClick="next_Click"></asp:Button>
<asp:Button ID="reset" runat="server" Text="Reset" CssClass="button"
></asp:Button>
</th></tr>

</table><br />
</center>

P S Hirapara Mahila College -JETPUR Page 46


A Project Report on: Stock Management

</asp:Content>

forgetpass2.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class user_forgetpass2 : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
string s =
ConfigurationManager.ConnectionStrings["stock"].ConnectionString.ToString();
con = new SqlConnection(s.ToString());
con.Open();

if (IsPostBack == false)
{
cmd = new SqlCommand("select * from registration where u_id=" +
Convert.ToInt16(Request.QueryString["u_id"]).ToString()+"", con);

dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txt_sq.Text = dr["s_question"].ToString();
}
else
{
Response.Redirect("forgetpass2.aspx");
}
}
con.Close();
}
protected void next_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand("select * from registration where u_id=" +
Convert.ToInt16(Request.QueryString["u_id"].ToString()) + "", con);

P S Hirapara Mahila College -JETPUR Page 47


A Project Report on: Stock Management

dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
int u_id = Convert.ToInt16(Request.QueryString["u_id"].ToString());
if (txt_ans.Text == dr["answer"].ToString())
{
Response.Redirect("forgetpass3.aspx?u_id=" + u_id);
}
else
{
Response.Redirect("forgetpass2.aspx");
}
}
else
{
Response.Redirect("forgetpass2.aspx");
}
con.Close();
}
}

forgetpass3.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="forgetpass3.aspx.cs" Inherits="user_forgetpass3" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr>
<center>
<br />
<table align="center" class="table" border="2">
<th colspan="3" class="th"> Forget Password</th>
<tr>
<td><asp:Label ID="Label1" runat="server" Text="New
Password"></asp:Label></td>
<td><asp:TextBox ID="new_pwd" runat="server" TextMode="Password"
CssClass="textbox" placeholder="new password"></asp:TextBox>

P S Hirapara Mahila College -JETPUR Page 48


A Project Report on: Stock Management

<asp:RequiredFieldValidator ID="req_newpassword" runat="server"


ErrorMessage="Enter new password" ControlToValidate="new_pwd" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Confirm Password"></asp:Label>
</td>
<td> <asp:TextBox ID="con_pwd" runat="server" TextMode="Password"
CssClass="textbox" placeholder="confrom password"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_confirmpassword" runat="server"
ErrorMessage="Enter confirmpassword" ControlToValidate="con_pwd" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<th colspan="3">
<asp:Button ID="submit" runat="server" Text="Submit" CssClass="button"
OnClick="submit_Click"/>
<input type="reset" runat="server" text="Cancle" class="button" />
</th>
</tr>
</table><br />

</asp:Content>

forgetpass3.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_forgetpass3 : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
string s =
ConfigurationManager.ConnectionStrings["stock"].ConnectionString.ToString();
con = new SqlConnection(s.ToString());

P S Hirapara Mahila College -JETPUR Page 49


A Project Report on: Stock Management

}
protected void submit_Click(object sender, EventArgs e)
{
if (new_pwd.Text == con_pwd.Text)
{
int u_id = Convert.ToInt16(Request.QueryString["u_id"].ToString());
Response.Write(u_id);
con.Open();
cmd = new SqlCommand("update Registration set password='" + con_pwd.Text + "'
where u_id=" + u_id + "", con);
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("login.aspx");
}
else
{
Response.Redirect("forgetpass3.aspx");
}
con.Close();
}
else
{
Response.Redirect("forgetpass3.aspx");
}
}
}

about_us.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="about_us.aspx.cs" Inherits="user_about_us" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div style="font-family:'MV Boli'; font-size:medium; text-align:center;">
<center><h1> About us</h1></center>
<marquee derection="up">
<img src="../image/12.jpg" height="100" width="100" />
<img src="../image/20.jpg" height="100" width="100" />
<img src="../image/31.jpg" height="100" width="100" />
<img src="../image/15.jpg" height="100" width="100" />
<img src="../image/37.jpg" height="100" width="100" />
<img src="../image/16.jpg" height="100" width="100" />
<img src="../image/fr3.jpg" height="100" width="100" />
<img src="../image/17.jpg" height="100" width="100" />
<img src="../image/13.jpg" height="100" width="100" />

P S Hirapara Mahila College -JETPUR Page 50


A Project Report on: Stock Management

<img src="../image/54.jpg" height="100" width="100" />


<img src="../image/50.jpg" height="100" width="100" />
<img src="../image/51.jpg" height="100" width="100" />
</marquee>
<br>
<font size="4px">
Stock management is the practice of ordering,storing,tracking and controlling
inventory.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Stock management applies to every item a business uses to produce its
products or
services-from raw materials to finished goods.<br />
In other words,stock management covers every aspect of a business's
inventory.
</font> </br>
<h1></h1>
</align>
</div>
</asp:Content>

contact_us.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="contact_us.aspx.cs" Inherits="user_contact_us" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center><h1> Contact us </h1></center>
<div id="float_right">
<img src="../image/cot2.jpg" style="height: 265px; width: 330px; margin-top: 20px;
margin-left: 0px;"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div style="font-family:'MV Boli'; font-size:medium; text-align:left;">
<link href="../stylesheet/style.css" rel="stylesheet">
<center>
<h2> Riddhi Ghadiya </h2>
<img src="../image/phone.gif" height="30" width="40"/>&nbsp;
&nbsp;1234567897<br/>
<img src="../image/g5.gif" height="30" width="40"/>&nbsp;
&nbsp;[email protected]<br/>
<h> ___________</h>
<h2> Uravi Movaliya</h2>
<img src="../image/phone.gif" height="30" width="40"/>&nbsp;&nbsp;4546565345<br/>
<img src="../image/g5.gif" height="30" width="40"/> &nbsp;&nbsp;[email protected]<br/>
</center><h1></h1>
</div>
</asp:Content>

P S Hirapara Mahila College -JETPUR Page 51


A Project Report on: Stock Management

feedback.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="feedback.aspx.cs" Inherits="user_feedback" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<link href="../stylesheet/style.css" rel="stylesheet" />
<center>
<table class="table" border="50" style="border-radius:10px;">
<h2>Feedback</h2>
</th>
<tr>
<%--- <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="username" Display="Dynamic" CssClass="error" ErrorMessage="Enter
username"></asp:RequiredFieldValidator>---%>
<td>
<asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
&nbsp;<asp:TextBox ID="usernm" runat="server" placeholder="Enter
username" ToolTip="plase Enter username" ValidationGroup="login"
CssClass="textBox"></asp:TextBox>
</td></tr>
<tr>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="comment" Display="Dynamic" CssClass="error" ErrorMessage="Enter
Comment"></asp:RequiredFieldValidator>
<td>
<asp:Label ID="Label2" runat="server" Text="Comment"></asp:Label>
&nbsp;&nbsp;<asp:TextBox ID="comment" runat="server" placeholder="Enter
comment" ToolTip="plase Enter comment" ValidationGroup="login"
CssClass="textBox"></asp:TextBox>
</td> </tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" Text="Submit" CssClass="button"
OnClick="Button1_Click" Width="90px"></asp:Button >&nbsp;
<asp:Button ID="Button2" runat="server" Text="Reset" CssClass="button"
OnClick="Button2_Click" ></asp:Button >
</td></tr>
</table>
<br />
</center>
</asp:Content>

feedback.aspx.cs:

using System;
using System.Collections.Generic;

P S Hirapara Mahila College -JETPUR Page 52


A Project Report on: Stock Management

using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class user_feedback : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\
v11.0;AttachDbFilename=E:\tybca\stockmanagement\App_Data\
stockmanagement.mdf;Integrated Security=True");
con.Open();
int u_id=Convert.ToInt16(Session["u_id"]);
string s="insert into feedback1
(u_id,username,comment)values('"+u_id+"','"+usernm.Text+"','"+comment.Text+"')";
SqlCommand cmd=new SqlCommand(s,con);
cmd.ExecuteNonQuery();
Response.Redirect("home.aspx");
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
comment.Text = "";
usernm.Text = "";
}
}

product.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="product.aspx.cs" Inherits="user_product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center><div align="center">
<table class="table">
<tr><td><asp:Label ID="Label2" runat="server" Text="Category"></asp:Label></td>
<td><asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True"

P S Hirapara Mahila College -JETPUR Page 53


A Project Report on: Stock Management

OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList
></td></tr></center>
<tr><td><asp:Label ID="Label5" runat="server" Text="SubCategory"></asp:Label></td>
<td><asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged"></asp:DropDownList
></td></tr></center>
</table>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$


ConnectionStrings:stock %>" SelectCommand="SELECT product.* FROM
product"></asp:SqlDataSource>
<asp:DataList ID="DataList1" runat="server" DataSourceID="sqlDataSource1"
DataKeyField="p_id" RepeatColumns="3" CellPadding="10" CellSpacing="10"
RepeatDirection="Horizontal">
<ItemTemplate>
<table class="table">
<tr> <td>
<asp:Image ID="Image1" runat="server" Height="200px" ImageUrl='<%#
Eval("p_img") %>' Width="200px" /><br />
</td></tr>
<tr> <td>
<asp:Label ID="Label3" runat="server" Text="Name:"></asp:Label>
<asp:Label ID="p_nm" runat="server" Text='<%#Eval("p_nm")
%>'></asp:Label><br />
</td></tr>

<tr><td>
<asp:Label ID="Label1" runat="server" Text="Price:"></asp:Label>
<asp:Label ID="p_price" runat="server" Text='<%#Eval("p_price")
%>'></asp:Label><br />

<tr> <td>
<asp:Label ID="Label4" runat="server" Text="Stock:"></asp:Label>
<asp:Label ID="p_quantity" runat="server" Text='<
%#Eval("p_quantity") %>'></asp:Label><br />

<tr><td>
<asp:Label ID="Label5" runat="server"
Text="Description:"></asp:Label>
<asp:Label ID="p_desc" runat="server" Text='<%#Eval("p_desc")
%>'></asp:Label><br />

<center><a href="productdetail.aspx?p_id=<%# Eval("p_id")


%>">Add To Cart</a>
</td></tr>
</center>
</table>
</ItemTemplate>
</asp:DataList>

P S Hirapara Mahila College -JETPUR Page 54


A Project Report on: Stock Management

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$


ConnectionStrings:stock %>" SelectCommand="SELECT * FROM [product] WHERE
([s_id]=@s_id)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" DefaultValue="0"
Name="s_id" PropertyName="selectedvalue" Type="Int32" />

</SelectParameters>
</asp:SqlDataSource>
<asp:DataList ID="DataList2" runat="server" DataKeyField="p_id"
DataSourceID="sqlDataSource2" RepeatColumns="4" RepeatDirection="Horizontal">
<ItemTemplate>
<div class="product">
<asp:Image ID="Image1" runat="server" Height="120px" Width="110px"
ImageUrl='<%#Eval("p_img") %>'></asp:Image> <br />
Name:
<asp:Label ID="Label1" runat="server" Text='<%#Eval("p_nm")
%>'></asp:Label><br />

Price:
<asp:Label ID="Label2" runat="server" Text='<%#Eval("p_price")
%>'></asp:Label><br />

Detail:
<asp:Label ID="Label3" runat="server" Text='<%#Eval("p_desc")
%>'></asp:Label><br />

Quantity:
<asp:Label ID="Label4" runat="server" Text='<%#Eval("p_quantity")
%>'></asp:Label><br />

<a href="productdetail.aspx" p_id=<%#Eval("p_id") %>">add to cart</a>


<br />
</div>
</ItemTemplate>
</asp:DataList>
</table>
</center>
<td align="center" colspan="3"><a href="home.aspx">back</a></td></center>
</asp:Content>

product.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

P S Hirapara Mahila College -JETPUR Page 55


A Project Report on: Stock Management

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_product : System.Web.UI.Page


{

SqlConnection con;
SqlCommand com;
SqlDataReader dr;
int c_id;
protected void Page_Load(object sender, EventArgs e)
{
string s = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(s.ToString());
if (IsPostBack == false)
{
int id = 0;
DropDownList1.Items.Insert(id, new ListItem("--selected--", "0"));
com = new SqlCommand("select * from category", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
id++;
DropDownList1.Items.Insert(id, new ListItem(dr["c_name"].ToString(),
dr["c_id"].ToString()));
DataList1.Visible = true;
DataList2.Visible = false;
}
}
con.Close();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DataList1.Visible = true;
int i = 0;
DropDownList2.Items.Clear();
if (DropDownList1.SelectedValue.ToString() == "0")
{
DropDownList2.Items.Insert(0, new ListItem("--select--", "0"));
}
else
{
com = new SqlCommand("select * from subcategory where c_id=" +
DropDownList1.SelectedValue.ToString() + "", con);
con.Open();

P S Hirapara Mahila College -JETPUR Page 56


A Project Report on: Stock Management

dr = com.ExecuteReader();
DataList2.Visible = true;
if (dr.HasRows)
{
DropDownList2.Items.Insert(0, new ListItem("--selected--", "0"));
while (dr.Read())
{
i++;
DropDownList2.Items.Insert(i, new ListItem(dr["name"].ToString(),
dr["s_id"].ToString()));
DataList1.Visible = false;
DataList2.Visible = true;

}
}
con.Close();
}

}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

productdetail.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="productdetail.aspx.cs" Inherits="user_productdetail"
%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
</br>
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr><%--</center>--%>

<th class="th" colspan="2"><h1>Product Detail</h1></th>


<tr><table border="1" align="center" class="table">
<tr><td style="width: 1px">
<asp:Label ID="lbl_img" runat="server" Text="Image"
CssClass="label"></asp:Label></td>

P S Hirapara Mahila College -JETPUR Page 57


A Project Report on: Stock Management

<td><asp:Image ID="Image1" runat="server" Height="150"


Width="230"></asp:Image></td></tr>
<tr><td><asp:Label ID="lbl_nm" runat="server" Text="Name"
CssClass="label"></asp:Label></td>
<td><asp:Label ID="lbl_name" runat="server" Text=""
CssClass="label"></asp:Label></td></tr>
<tr><td><asp:Label ID="lbl1_price" runat="server" Text="Price"
CssClass="label"></asp:Label></td>
<td><asp:Label ID="lbl_price" runat="server" Text=""
CssClass="label"></asp:Label></td></tr>
<tr><td><asp:Label ID="lbl1_quantity" runat="server" Text="Quantity"
CssClass="label"></asp:Label></td>
<td><asp:Label ID="lbl_quantity" runat="server" Text=""
CssClass="label"></asp:Label></td></tr>
<tr><td><asp:Label ID="lbl2_qua" runat="server" Text="Quantity"
CssClass="label"></asp:Label></td>
<td><asp:TextBox ID="txt_quantity" runat="server" CssClass="textbox" pattern="^[0-
9]+$"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_qua" runat="server" ErrorMessage="Enter
Quantity" ControlToValidate="txt_quantity" Display="Dynamic" ForeColor="Red"
ValidationGroup="product"></asp:RequiredFieldValidator></td></tr>
<tr><td align="center" colspan="2" style="color:teal;">
<asp:Button ID="Button1" runat="server" Text="OK" Font-Italic="false" Font-
Bold="true" CssClass="button" ForeColor="black" ValidationGroup="product"
OnClick="Button1_Click"/></td></tr>
</table><br /></center></div></div>
</asp:Content>

productdetail.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class user_productdetail : System.Web.UI.Page
{
SqlCommand cmd;
SqlConnection con;
SqlDataReader dr;
int id;
int p_qty;

protected void Page_Load(object sender, EventArgs e)

P S Hirapara Mahila College -JETPUR Page 58


A Project Report on: Stock Management

{
String str = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(str);
if (Session["username"] == null)
{
Response.Redirect("login.aspx");
}
string msg;
if (Request.QueryString["msg"] != null)
{
msg = Request.QueryString["msg"];

if (msg == "1")
{
lbl_msg.Visible = true;
lbl_msg.Text = "Stock not available ...";
}
if (msg == "2")
{
lbl_msg.Visible = true;
lbl_msg.Text = "Out of Stock ...";
}
if (msg == "3")
{
lbl_msg.Visible = true;
lbl_msg.Text = "Please Enter Quantity ...";
}
if (msg == "4")
{
lbl_msg.Visible = true;
lbl_msg.Text = "Only " + Request.QueryString["qt"] + " available ...";
}
}
id = Convert.ToInt16(Request.QueryString["p_id"].ToString());
cmd = new SqlCommand("select * from product where p_id=" + id, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
Image1.ImageUrl = dr["p_img"].ToString();
lbl_name.Text = dr["p_nm"].ToString();
lbl_price.Text = dr["p_price"].ToString();
p_qty = Convert.ToInt16(dr["p_quantity"].ToString());
lbl_quantity.Text = p_qty.ToString();
}
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{

P S Hirapara Mahila College -JETPUR Page 59


A Project Report on: Stock Management

int r_id = Convert.ToInt16(Session["u_id"].ToString());


int qty = 0;
if (txt_quantity.Text != null)
{
qty = Convert.ToInt16(txt_quantity.Text);
}
if (txt_quantity.Text == null || qty == 0)
{
Response.Redirect("productdetail.aspx?msg=3&p_id=" + id);
}
if (p_qty == 0)
{
Response.Redirect("productdetail.aspx?msg=1");
}
else if (p_qty >= qty)
{
cmd = new SqlCommand("select * from addtocart where p_id=" + id + " and
u_id=" + r_id, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
if (dr.Read())
{
int stock = 0;
stock = p_qty - Convert.ToInt16(dr["a_quantity"].ToString());
if (qty <= stock)
{
cmd = new SqlCommand("update addtocart set a_quantity=" +
(Convert.ToInt16(dr["a_quantity"].ToString()) + qty) + " where p_id=" + id, con);
con.Close();
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("shoppingcart.aspx?p_id=" + id);
}
else
{
if (stock == 0)
{
Response.Redirect("productdetail.aspx?msg=1&p_id=" + id);
}
else
{
Response.Redirect("productdetail.aspx?msg=2&p_id=" + id);
}
}
con.Close();
con.Open();

P S Hirapara Mahila College -JETPUR Page 60


A Project Report on: Stock Management

}
else
{
if (stock == 0)
{
Response.Redirect("productdetail.aspx?msg=1&p_id=" + id);
}
else
{
Response.Redirect("productdetail.aspx?msg=4&qt=" + stock + "&p_id="
+ id);
}
}
}
}
else
{
con.Close();
cmd = new SqlCommand("insert into addtocart(u_id,p_id,a_quantity)values(" +
r_id + "," + id + "," + txt_quantity.Text + ")", con);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("shoppingcart.aspx?p_id=" + id);
}
con.Close();
}
}
else
{
Response.Redirect("productdetail.aspx?msg=4&qt=" + p_qty + "&p_id=" + id);
}
}
}

purchase.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="purchase.aspx.cs" Inherits="user_purchase" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>

P S Hirapara Mahila College -JETPUR Page 61


A Project Report on: Stock Management

<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"


ForeColor="Red"></asp:Label>
</td></tr>
<br />
<div id="content">
<div id="login_content" align="center">

<tr>
<th class="th" colspan="2"><h1>User Purchase</h1></th>
</tr>
<table class="table" border="2">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Customer Name"></asp:Label>
</td>

<td><asp:TextBox ID="txt_uname" runat="server" CssClass="textbox" pattern="^[a-z


A-Z]+$" placeholder="CustomerName"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_username" runat="server"
ErrorMessage="Enter name" ControlToValidate="txt_uname" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>

</td></tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="City Name"></asp:Label>
</td>

<td><asp:TextBox ID="txt_city" runat="server" CssClass="textbox"


placeholder="City"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_city" runat="server" ErrorMessage="Enter
city" ControlToValidate="txt_city" Font-Bold="True" ForeColor="Red"
Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="reqcity" runat="server"
ControlToValidate="txt_city" ErrorMessage="Enter only Character" Font-Bold="True"
ForeColor="Red" ValidationExpression="^[a-z A-Z]+$"
Display="Dynamic"></asp:RegularExpressionValidator>
</td></tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Email-Id"></asp:Label>
</td>

<td><asp:TextBox ID="txt_mail" runat="server" CssClass="textbox" placeholder="E-


mail"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_emailid" runat="server" ErrorMessage="Enter
email-id" ControlToValidate="txt_mail" Font-Bold="True" ForeColor="Red"
Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regemailid" runat="server"
ControlToValidate="txt_mail" ErrorMessage="Not a Valid EmailId" Font-Bold="True"

P S Hirapara Mahila College -JETPUR Page 62


A Project Report on: Stock Management

ForeColor="Red" ValidationExpression="\S+@\S+\.\S+"
Display="Dynamic"></asp:RegularExpressionValidator>
</td></tr>
<tr>
<td><asp:Label ID="Label4" runat="server" Text="Contact No"></asp:Label></td>
<td><asp:TextBox ID="txt_contactno" runat="server" MaxLength="10"
CssClass="textbox" placeholder="ContactNo"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Enter contactno" Font-Bold="True" ForeColor="Red"
ControlToValidate="txt_contactno" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ErrorMessage="enter only 10 digit" Font-Bold="True"
ControlToValidate="txt_contactno" ValidationExpression="\d{10}" ForeColor="Red"
Display="Dynamic"></asp:RegularExpressionValidator>
</td></tr>
<tr><td align="center" colspan="2">
<asp:Button ID="Button1" runat="server" Text="Payment" Font-Italic="true" Font-
Bold="true" CssClass="button" OnClick="Button1_Click"
Width="87px"></asp:Button>&nbsp;
<asp:Button ID="Button2" runat="server" Text="Clear" Font-Italic="true" Font-
Bold="true" CssClass="button" OnClick="Button2_Click" Width="64px"></asp:Button>
</td></tr>
</table></div></div><br/>
</asp:Content>

purchase.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_purchase : System.Web.UI.Page


{

SqlConnection con;
SqlCommand cmd, cmd1, cmd2, cmd3;
SqlDataReader dr, dr1;
int k, id;
int qty1;
protected void Page_Load(object sender, EventArgs e)
{
String str = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;

P S Hirapara Mahila College -JETPUR Page 63


A Project Report on: Stock Management

con = new SqlConnection(str);


if (Session["username"] == null)
{
Response.Redirect("login.aspx");
}
}

protected void Button1_Click(object sender, EventArgs e)


{
k = Convert.ToInt16(Session["u_id"]);
cmd = new SqlCommand("insert into
bill(u_id,b_total,pur_date,b_status,b_nm,b_eid,b_con,b_city)values('" + k + "','" +
Convert.ToDouble(Session["total"]) + "','" + DateTime.Now.ToShortDateString() + "','" + 0
+ "','" + txt_uname.Text + "','" + txt_mail.Text + "','" + txt_contactno.Text + "','" +
txt_city.Text + "')", con);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{

cmd1 = new SqlCommand("select b_id from bill where b_nm='" +txt_uname.Text +


"'", con);
dr = cmd1.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
id = Convert.ToInt16(dr["b_id"].ToString());
}
dr.Close();
con.Close();
con.Open();
string str = "select * from addtocart where u_id='" + k + "'";
con.Close();
SqlDataAdapter da = new SqlDataAdapter(str, con);
DataTable dt = new DataTable();
da.Fill(dt);
for (int r = 0; r < dt.Rows.Count; r++)
{
int qty = Convert.ToInt16(dt.Rows[r]["a_quantity"].ToString());
int pid = Convert.ToInt16(dt.Rows[r]["p_id"].ToString());
cmd1 = new SqlCommand("select * from product where p_id='" + pid + "'", con);
con.Open();
dr1 = cmd1.ExecuteReader();
if (dr1.HasRows)
{
dr1.Read();
qty1 = Convert.ToInt16(dr1["p_quantity"].ToString());
}
int p_quantity = qty1 - qty;
dr1.Close();

P S Hirapara Mahila College -JETPUR Page 64


A Project Report on: Stock Management

con.Close();
cmd2 = new SqlCommand("update product set p_quantity=@p_quantity where
p_id=@p_id", con);
con.Open();
cmd2.Parameters.AddWithValue("@p_id", +pid);
cmd2.Parameters.AddWithValue("@p_quantity", p_quantity);
int i1 = cmd2.ExecuteNonQuery();
con.Close();
cmd3 = new SqlCommand("insert into
bill1(b_id,p_id,p_quantity)values(@b_id,@p_id,@p_quantity)", con);
con.Open();
cmd3.Parameters.AddWithValue("@b_id", id);
cmd3.Parameters.AddWithValue("@p_id", pid);
cmd3.Parameters.AddWithValue("@p_quantity", +qty);
int i2 = cmd3.ExecuteNonQuery();
con.Close();
}
cmd = new SqlCommand("delete from addtocart where u_id='" + k + "'", con);
con.Open();
cmd.Parameters.AddWithValue("@u_id", +k);
cmd.ExecuteNonQuery();
int u_id = Convert.ToInt16(Session["u_id"].ToString());
Response.Redirect("thankYou.aspx?u_id=" + u_id);
con.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{
txt_contactno.Text = "";
txt_city.Text = "";
txt_mail.Text = "";
txt_uname.Text = "";
}
}

shoppingcart.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="shoppingcart.aspx.cs" Inherits="user_shoppingcart"
%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<style type="text/css">
{
width: 263px;
}
</style>
</asp:Content>

P S Hirapara Mahila College -JETPUR Page 65


A Project Report on: Stock Management

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"


Runat="Server">
<div id="content">
<div id="login_content" align="center">
<center><tr><td>
<%--<asp:Image ID="Image1" runat="server" Height="34px"
ImageUrl="~/image/jjk.jpg" Width="37px" />--%>
</td></tr></center>
<tr>
<th class="th" colspan="2"><h1> Shoppingcart</h1></th></tr>
<table class="table" border="2">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand="SELECT addtocart.a_id, addtocart.u_id,
addtocart.a_quantity, product.p_nm, product.p_price, product.p_img, product.p_desc,
product.p_quantity FROM addtocart INNER JOIN product ON addtocart.p_id = product.p_id
WHERE (addtocart.u_id = @u_id)">
<SelectParameters>
<asp:SessionParameter Name="u_id" SessionField="u_id" Type="Int32" />
</SelectParameters></asp:SqlDataSource>
<tr><td class="auto-style1">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="a_id" DataSourceID="SqlDataSource1"
OnRowCreated="GridView1_RowCreated"
OnRowDataBound="GridView1_RowDataBound"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" BackColor="White"
BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4">
<Columns>
<asp:BoundField DataField="a_quantity" HeaderText="Quantity"
SortExpression="a_quantity" />
<asp:BoundField DataField="p_price" HeaderText="Price"
SortExpression="p_price" />
<asp:TemplateField HeaderText="Image" SortExpression="p_img">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("p_img")
%>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image3" runat="server" Height="42px" ImageUrl='<%#
Eval("p_img") %>' Width="56px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href="shoppingcart.aspx?a_id=<%#Eval("a_id") %>" onclick="return del();"><img
src="../image/del.gif" height="20" width="20" /></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>

</asp:GridView>

P S Hirapara Mahila College -JETPUR Page 66


A Project Report on: Stock Management

Total:- <asp:Label ID="Label1" runat="server" Text="" ForeColor="Red"


CssClass="label"></asp:Label>
<h5><a href="product.aspx" style"font-size: 20px">Continue Shopping</a><br /></h5>
<h5><a href="purchase.aspx" style"font-size: 20px">Check Out</a></h5>
</td></tr>
</table></div></div><br/>
</asp:Content>

shoppingcart.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class user_shoppingcart : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
String str = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(str);
if (Request.QueryString["a_id"] != null)
{
int a = Convert.ToInt32(Request.QueryString["a_id"].ToString());
cmd = new SqlCommand("delete from addtocart where a_id=@a_id", con);
con.Open();
cmd.Parameters.AddWithValue("@a_id", +a);
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("shoppingcart.aspx");
}
con.Close();
}
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
TableCell tc = new TableCell();
if (e.Row.RowIndex == -1)
{
tc.Text = "total";
tc.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

P S Hirapara Mahila College -JETPUR Page 67


A Project Report on: Stock Management

}
e.Row.Cells.Add(tc);
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int total = 0;
if (e.Row.RowIndex != -1)
{
string a = e.Row.Cells[0].Text;
string b = e.Row.Cells[1].Text;
double c = double.Parse(a) * double.Parse(b);
e.Row.Cells[e.Row.Cells.Count - 1].Text = c.ToString();
}
for (int i = 0; i < GridView1.Rows.Count; i++)
{
total = total + int.Parse(GridView1.Rows[i].Cells[4].Text);
}
Session["total"] = total;
if (e.Row.RowType == DataControlRowType.Footer)
{
Label1.Text = total.ToString();
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

thankyou.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="thankYou.aspx.cs" Inherits="user_thankYou" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr>
<center><br/>
<table class="table" border="1">

<tr><td><br/><h1>Thank You For Visit....</h1> <center>

P S Hirapara Mahila College -JETPUR Page 68


A Project Report on: Stock Management

<img src="../image/thx4.gif" height="300" width="400"/><h3></center>


Your Order Is Placed To You With In 7 To 10 days,<br />
if you Have
<br />
Any Query Regarding Your Order So Please Call Us...</h3>
</td></tr>
</table><br />
</center>
</asp:Content>

Admin side:-

home.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="home.aspx.cs" Inherits="admin_home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<center>
<marquee direction="right">
<tr><td>
<img src="../image/13.jpg" height="150" width="160" />
</td>
<td> <img src="../image/15.jpg" height="150" width="160" /> </td>
<td> <img src="../image/16.jpg" height="150" width="160" /></td>
<td><img src="../image/20.jpg" height="150" width="160" /></td>
<td> <img src="../image/14.jpg" height="150" width="160" /></td>
</tr></marquee>
</center>
<center>
<tr> <td><img src="../image/23.jpg" height="150" width="160" /></td>
<td><img src="../image/58.jpg" height="150" width="160" /></td>
<td><img src="../image/60.jpg" height="150" width="160" /></td>
<td><img src="../image/62.jpg" height="150" width="160" /></td>
<td><img src="../image/27.jpg" height="150" width="160" /></td>
<td><img src="../image/28.jpg" height="150" width="160" /></td>
<td><img src="../image/29.jpg" height="150" width="160" /></td>
<td><img src="../image/64.jpg" height="150" width="160" /></td>
</tr>
</center>
<center>
<marquee direction="left">
<tr><td><img src="../image/40.jpg" height="150" width="160" /></td>
<td><img src="../image/47.jpg" height="150" width="160" /></td>

P S Hirapara Mahila College -JETPUR Page 69


A Project Report on: Stock Management

<td><img src="../image/50.jpg" height="150" width="160" /></td>


<td><img src="../image/55.jpg" height="150" width="160" /></td>
<td><img src="../image/36.jpg" height="150" width="160" /></td>
</tr></marquee>
</center>
</asp:Content>

view_reg.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="view_reg.aspx.cs" Inherits="admin_view_reg" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<div id="content">
<div id="login_content">
<br />
<center>
<th align="center" colspan="2">
<h1>View Registration</h1>
</th>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand="SELECT * FROM
[registration]"></asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="u_id" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="u_id" HeaderText="No" InsertVisible="False"
ReadOnly="True" SortExpression="u_id" />
<asp:BoundField DataField="fname" HeaderText="First Name"
SortExpression="fname" />
<asp:BoundField DataField="lname" HeaderText="Last Name"
SortExpression="lname" />
<asp:BoundField DataField="city" HeaderText="City" SortExpression="city" />
<asp:BoundField DataField="contactno" HeaderText="Contact No"
SortExpression="contactno" />
<asp:BoundField DataField="emailid" HeaderText="Emailid"
SortExpression="emailid" />
<asp:BoundField DataField="username" HeaderText="Username"
SortExpression="username" />
<asp:BoundField DataField="password" HeaderText="Password"
SortExpression="password" />
<asp:BoundField DataField="s_question" HeaderText="Security question"
SortExpression="s_question" />
<asp:BoundField DataField="answer" HeaderText="Answer"
SortExpression="answer" />

P S Hirapara Mahila College -JETPUR Page 70


A Project Report on: Stock Management

<asp:BoundField DataField="address" HeaderText="Address"


SortExpression="address" />
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href="view_reg.aspx?u_id=<%#Eval("u_id") %>"><img
src="../image/del.gif" height="40px" width="45px" onclick= "return del();" /></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#8E4D44" CssClass="ac" Height="45" Font-
Bold="True" ForeColor="#FFFFCC" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"
HorizontalAlign="Center" />
<RowStyle BackColor="WhiteSmoke" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="#663399" Font-
Bold="True" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>
</center>
<h1></h1>
</table>
</div>
</div>
</asp:Content>

view_reg.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class admin_view_reg : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\
tybca\stockmanagement\App_Data\stockmanagement.mdf;Integrated Security=True");

if(Request.QueryString["u_id"]!=null)

P S Hirapara Mahila College -JETPUR Page 71


A Project Report on: Stock Management

{
int u_id=Convert.ToInt16(Request.QueryString["u_id"].ToString());
cmd=new SqlCommand("delete from registration where u_id='"+u_id+"'",con);
con.Open();
int i=cmd.ExecuteNonQuery();
if(i>0)
{
// Response.Write("record deleted");
}
else
{
//Response.Write("record not deleted");
}
con.Close();
}
}
}

view_feed.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="view_feed.aspx.cs" Inherits="admin_view_feed" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center>
<th align="center" colspan="2">
<h1>View Feedback</h1>
</th>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="f_id" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="f_id" HeaderText="No" InsertVisible="False"
ReadOnly="True" SortExpression="f_id" />
<%--- <asp:BoundField DataField="u_id" HeaderText="u_id"
SortExpression="u_id" />---%>
<asp:BoundField DataField="comment" HeaderText="Comment"
SortExpression="comment" />
<asp:BoundField DataField="username" HeaderText="Username"
SortExpression="username" />
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href="view_feed.aspx?f_id=<%#Eval("f_id") %>"><img
src="../image/del.gif" height="40px" width="45px" onclick="return del();" /></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />

P S Hirapara Mahila College -JETPUR Page 72


A Project Report on: Stock Management

<HeaderStyle BackColor="#8E4D44" CssClass="ac" Height="45" Font-


Bold="True" ForeColor="#FFFFCC" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"
HorizontalAlign="Center" />
<RowStyle BackColor="WhiteSmoke" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="#663399" Font-
Bold="True" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<
%$ ConnectionStrings:stock %>" SelectCommand="SELECT * FROM
[feedback1]"></asp:SqlDataSource>
</table> </center><h1></h1>
</asp:Content>

view_feed.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class admin_view_feed : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
Con=newSqlConnection(@"DataSource=(LocalDB)\v11.0;AttachDbFilename=E:\
tybca\stockmanagement\App_Data\stockmanagement.mdf;Integrated
Security=True");
if(Request.QueryString["f_id"]!=null)
{
int f_id=Convert.ToInt16(Request.QueryString["f_id"].ToString());
cmd = new SqlCommand("delete from feedback1 where f_id='"+f_id+"'", con);
con.Open();
int i = cmd.ExecuteNonQuery();
if(i>0)
{
// Response.Write("Record Delete");

P S Hirapara Mahila College -JETPUR Page 73


A Project Report on: Stock Management

else
{
// Response.Write("Record not delete");
}
con.Close();
}
}
}

category.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="category.aspx.cs" Inherits="admin_category" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content">
<center><tr><td>
<asp:Label ID="lbl_msg" runat="server" Text="" CssClass="label"
ForeColor="Red"></asp:Label>
</td></tr>
<br />
<tr><td><center>
<h1>Add Category</h1></td></tr>
</center>
<table align="center" border="2" class="table">
<td> <asp:Label ID="Label1" runat="server" Text="Category
Name"></asp:Label></td>
<td><asp:TextBox ID="txt_cnm" runat="server" CssClass="textbox"
placeholder="category"></asp:TextBox>
<asp:RequiredFieldValidator ID="Reqanswer" runat="server"
ControlToValidate="txt_cnm" ErrorMessage="Enter Category" Font-Bold="True"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
</td></tr>
<tr> <td colspan="3" align="center">

<% if(Request.QueryString["c_id"]==null)
{
%>
<asp:Button ID="add" runat="server" Text="Add" CssClass="button"
OnClick="add_Click"></asp:Button>
<%
}
else
{
%>

P S Hirapara Mahila College -JETPUR Page 74


A Project Report on: Stock Management

<asp:Button ID="edit" runat="server" Text="Edit" CssClass="button"


OnClick="edit_Click"></asp:Button>
<%
}
%>
<input type="reset" runat="server" text="cancle" class="button" />
</td>
</tr>
</table><br />
</asp:Content>

category.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class admin_category : System.Web.UI.Page


{
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
con = new
SqlConnection(ConfigurationManager.ConnectionStrings["stock"].ConnectionString);
if (!IsPostBack)
{
if (Request.QueryString["c_id"] != null)
{
int id = Convert.ToInt16(Request.QueryString["c_id"].ToString());
cmd = new SqlCommand("select * from category where c_id=" + id, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txt_cnm.Text = dr["c_name"].ToString();
}
con.Close();
}
}
}

P S Hirapara Mahila College -JETPUR Page 75


A Project Report on: Stock Management

protected void add_Click(object sender, EventArgs e)


{
cmd = new SqlCommand("insert into category(c_name) values('" + txt_cnm.Text + "')",
con);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_category.aspx");
}
}
protected void edit_Click(object sender, EventArgs e)
{
int c_id = Convert.ToInt16(Request.QueryString["c_id"].ToString());
cmd = new SqlCommand("update category set c_name='" + txt_cnm.Text + "' where
c_id=" + c_id, con);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_category.aspx");
}
}
}

view_category.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="view_category.aspx.cs"
Inherits="admin_view_category" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content" align="center">

<center><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$


ConnectionStrings:stock %>" OnSelected="SqlDataSource1_Selected"
SelectCommand="SELECT * FROM [category]">
</asp:SqlDataSource>

<tr><td> <center>
<h1>View Category&nbsp;</h1></td></tr></center>
<center>
<tr><td style="text-align:center;">

P S Hirapara Mahila College -JETPUR Page 76


A Project Report on: Stock Management

<tr><td>
<center>

<a href="category.aspx"><img src="../image/add35.png" Height="40"


Width="40" /></a></td></tr>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"


CellPadding="4" DataKeyNames="c_id" DataSourceID="SqlDataSource1"
BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px">

<Columns>
<%--<asp:BoundField DataField="c_id" HeaderText="c_id"
InsertVisible="False" ReadOnly="True" SortExpression="c_id" />--%>
<asp:BoundField DataField="c_name" HeaderText="Name"
SortExpression="c_name" />
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href='category.aspx?c_id=<%# Eval("c_id") %>'><img
src="../image/edit.gif" height="35" width="35" onclick="return upd();"/></a>
<a href='view_category.aspx?c_id=<%# Eval("c_id") %>'
onclick="return del();"><img src="../image/del.gif" height="35" width="35" onclick="return
del();"/></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#8E4D44" Font-Bold="True" ForeColor="#FFFFCC"
/>
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"
HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="#663399" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>
</td></tr>
</table></div></div>
</asp:Content>

view_category.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

P S Hirapara Mahila College -JETPUR Page 77


A Project Report on: Stock Management

using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class admin_view_category : System.Web.UI.Page


{
SqlCommand cmd;
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
con = new
SqlConnection(ConfigurationManager.ConnectionStrings["stock"].ConnectionString);
if (!IsPostBack)
{
if (Request.QueryString["c_id"] != null)
{
int c_id = Convert.ToInt16(Request.QueryString["c_id"].ToString());
cmd = new SqlCommand("delete from category where c_id=" + c_id, con);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
}
}
}
protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
{

}
protected void new_Click(object sender, EventArgs e)
{
Response.Redirect("category.aspx");
}
}

subcategory.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="subcategory.aspx.cs" Inherits="admin_subcategory"
%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"


Runat="Server">
<center>
<asp:Label ID="Label1" runat="server" Text="Sub Category" ForeColor="black" Font-
Size="XX-Large"></asp:Label>
<table border="3" align="center">
<div id="text">

P S Hirapara Mahila College -JETPUR Page 78


A Project Report on: Stock Management

<tr>
<td class="td">
<asp:Label ID="Label3" runat="server" Text="category"></asp:Label>
<asp:DropDownList ID="addcategory" runat="server"
OnSelectedIndexChanged="addcategory_SelectedIndexChanged"></asp:DropDownList>

</td></tr>
<tr>
<td> Sub Category

<asp:TextBox ID="txt_scat" runat="server" CssClass="Textbox"


placeholder="subcategory"></asp:TextBox><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="please select subcategory" ControlToValidate="txt_scat"
Display="Dynamic" Font-Bold="true" Font-Italic="false"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ErrorMessage="only character enter" ControlToValidate="txt_scat"
Display="Dynamic" Font-Bold="true" Font-Italic="false" ForeColor="Red"
ValidationExpression="^[a-z-A-Z]+$"></asp:RegularExpressionValidator>
</td> </tr>
<tr>
<td align="center">
<%
if(Request.QueryString["s_id"]==null)
{ %>
<asp:Button ID="btn_add" runat="server" Text="Add" OnClick="btn_add_Click"
ValidationGroup="subcategory"></asp:Button>
<%
}
else
{
%>
<asp:Button ID="btn_edit" runat="server" Text="edit"
OnClick="btn_edit_Click" ValidationGroup="subcategory"></asp:Button>
<%
} %>
</td></tr>
<tr><td><asp:Label ID="categoryname" runat="server" Text="" ForeColor="Red"
Font-Size="20px"></asp:Label>
</td></tr>
</div>
</table></center>
</asp:Content>

subcategory.aspx.cs:

using System;
using System.Collections.Generic;

P S Hirapara Mahila College -JETPUR Page 79


A Project Report on: Stock Management

using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class admin_subcategory : System.Web.UI.Page


{
SqlConnection con;
SqlCommand com;
SqlDataReader dr;
DataSet ds;

public static int i, id;


protected void Page_Load(object sender, EventArgs e)
{
string s = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(s);
if (!IsPostBack)
{
addcategory.Items.Clear();
addcategory.Items.Add("----selected-----");
con.Open();
int a = 1;
com = new SqlCommand("select * from category", con);
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
addcategory.Items.Insert(a, new ListItem(dr["c_name"].ToString(),
dr["c_id"].ToString()));
a++;
}
}
con.Close();
}
if (!IsPostBack)
{
if (Request.QueryString["s_id"] != null)
{
i = Convert.ToInt16(Request.QueryString["s_id"].ToString());
com = new SqlCommand("select * from subcategory where s_id='" + i + "'", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{

P S Hirapara Mahila College -JETPUR Page 80


A Project Report on: Stock Management

dr.Read();
addcategory.SelectedValue = dr["c_id"].ToString();
txt_scat.Text = dr["name"].ToString();
}
con.Close();
}
}
}
protected void addcategory_SelectedIndexChanged(object sender, EventArgs e)
{
com = new SqlCommand("select * from category where c_name='" +
addcategory.SelectedItem.Text.ToString() + "'", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
id = Convert.ToInt16(dr["c_id"].ToString());
}
con.Close();

}
protected void btn_add_Click(object sender, EventArgs e)
{
string s1 = "select * from subcategory where name='" + txt_scat.Text + "'";
SqlDataAdapter da = new SqlDataAdapter(s1, con);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Label1.Text = "already existing";
}
else
{
com = new SqlCommand("insert into subcategory(c_id,name) values('" +
addcategory.Text + "','" + txt_scat.Text + "')", con);
com.Parameters.AddWithValue("@name", txt_scat.Text);
con.Open();
int i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_subcategory.aspx");
txt_scat.Text = "";
}
con.Close();
}
}
protected void btn_edit_Click(object sender, EventArgs e)
{

P S Hirapara Mahila College -JETPUR Page 81


A Project Report on: Stock Management

int id = Convert.ToInt16(Request.QueryString["s_id"].ToString());
int c_id = 0;
com = new SqlCommand("select * from category where c_name='" +
addcategory.SelectedItem.ToString() + "'", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
c_id = Convert.ToInt16(dr["c_id"].ToString());
}
con.Close();
if (c_id != 0)
{
com = new SqlCommand("update subcategory set c_id=" + c_id + ",name='" +
txt_scat.Text + "' where s_id=" + id, con);
con.Open();
int i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_subcategory.aspx");
}
else
{
Response.Redirect("not updated");
}
}
con.Close();
}
}

view_subcategory.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master


AutoEventWireup="true" CodeFile="view_subcategory.aspx.cs"
Inherits="admin_view_subcategory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand="select * from
[subcategory]"></asp:SqlDataSource>
<center>
<asp:Label ID="Label1" runat="server" Text="viewsubcategory" ForeColor="black"
Font-Size="XX-Large"></asp:Label>
<br />
<asp:LinkButton ID="aecategory" runat="server"
PostBackUrl="~/admin/subcategory.aspx"><img src="../image/add.png" style="height:30px;
width:47px" /></asp:LinkButton>

P S Hirapara Mahila College -JETPUR Page 82


A Project Report on: Stock Management

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"


DataKeyNames="s_id" DataSourceID="sqlDataSource1" CellPadding="4"
ForeColor="Black" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
BorderWidth="3px" CellSpacing="2">
<Columns>
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href="subcategory.aspx?s_id=<%#Eval("s_id") %>" onclick="return upd();">
<img src="../image/edit.gif" height="20" width="20" />
<a href="view_subcategory.aspx?s_id=<%#Eval("s_id") %>" onclick="return
del();">
<img src="../image/del.gif" height="20" width="20" />
</a>
</ItemTemplate>

</asp:TemplateField>
</Columns>

<FooterStyle BackColor="#CCCCCC"/>
<HeaderStyle BackColor="Black" CssClass="ac" Height="45" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black"
HorizontalAlign="Left" />
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" ForeColor="White" Font-
Bold="True" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#808080" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
</center>
</asp:Content>

view_subcategory.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class admin_view_subcategory : System.Web.UI.Page


{

P S Hirapara Mahila College -JETPUR Page 83


A Project Report on: Stock Management

SqlCommand com;
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
string s = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(s.ToString());
if (Request.QueryString["s_id"] != null)
{
int i = Convert.ToInt16(Request.QueryString["s_id"].ToString());
com = new SqlCommand("delete from subcategory where s_id='" + i + "'", con);
con.Open();
i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_subcategory.aspx");
}
con.Close();
}
}
}

add_product.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="add_product.aspx.cs"
Inherits="admin_add_product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center><table class="table" align="center" border="3">
<h1 align="center">Add Product</h1>
<tr>
<td style="width: 158px">
<asp:Label ID="Label1" runat="server" Text="Category"></asp:Label>
</td>
<td class="auto-style2">
<asp:DropDownList ID="drop_category" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="drop_category_SelectedIndexChanged"></asp:DropDownList>

</td> </tr>
<tr> <td><asp:Label ID="Label2" runat="server" Text="Subcategory"></asp:Label>
</td>
<td style="width: 158px">
<asp:DropDownList ID="drop_subcategory" runat="server"
OnSelectedIndexChanged="drop_subcategory_SelectedIndexChanged"></asp:DropDownLis
t>
</td></tr>

P S Hirapara Mahila College -JETPUR Page 84


A Project Report on: Stock Management

<tr><td style="width: 158px">


<asp:Label ID="p_img" runat="server" Text="Image"
CssClass="label"></asp:Label></td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload><br />
<%if (Request.QueryString["p_id"] != null)
{ %>
<asp:Image ID="Image1" runat="server" Height="200"
Width="250"></asp:Image></td>
</tr>
<% } %>
<tr>
<td style="width: 158px">
<asp:Label ID="p_nm" runat="server" Text="Name"
CssClass="label"></asp:Label></td>
<td>
<asp:TextBox ID="txt_name" runat="server" CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_uname" runat="server"
ErrorMessage="Name can't be blank" ValidationGroup="product" ForeColor="red"
Display="Dynamic" ControlToValidate="txt_name"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 158px">
<asp:Label ID="p_price" runat="server" Text="Price"
CssClass="label"></asp:Label></td>
<td>
<asp:TextBox ID="txt_price" runat="server" CssClass="textbox" pattern="^[0-9]+
$"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_con" runat="server" ErrorMessage="Price
must be in a particulir formate." ForeColor="red" Display="Dynamic"
ControlToValidate="txt_price"
ValidationGroup="product"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 158px">
<asp:Label ID="p_quentity" runat="server" Text="Quantity"
CssClass="label"></asp:Label></td>
<td>
<asp:TextBox ID="txt_quantity" runat="server" CssClass="textbox" pattern="^[0-
9]+$"></asp:TextBox>
<asp:RequiredFieldValidator ID="req_quantity" runat="server"
ErrorMessage="Quantity must be in a particulir formate." ForeColor="red"
Display="Dynamic" ControlToValidate="txt_quantity"
ValidationGroup="product"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 158px">
<asp:Label ID="Label3" runat="server" Text="Description"
CssClass="label"></asp:Label></td>
<td>

P S Hirapara Mahila College -JETPUR Page 85


A Project Report on: Stock Management

<asp:TextBox ID="TextBox1" runat="server" CssClass="textbox" pattern="^[a-z


A-Z]+$"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Description can't be blank" ValidationGroup="product" ForeColor="red"
Display="Dynamic" ControlToValidate="TextBox1"></asp:RequiredFieldValidator></td>
</tr>
<tr align="center">
<td colspan="2" align="center">
<%if (Request.QueryString["p_id"] != null)
{ %>
<asp:Button ID="btn_edit" runat="server" Text="Edit" Font-Italic="true" Font-
Bold="true" ValidationGroup="product" CssClass="button" ForeColor="#F9DFBD"
OnClick="btn_edit_Click" />
<% }
else
{ %>
<asp:Button ID="btn_add" runat="server" Text="Add" Font-Italic="true" Font-
Bold="true" CssClass="button" ForeColor="#F9DFBD" OnClick="btn_add_Click"
ValidationGroup="product" />
<% } %>
</td>
</tr>
</table></center><br />
</asp:Content>

add_product.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class admin_add_product : System.Web.UI.Page


{

SqlCommand com;
SqlConnection con;
SqlDataReader dr;
String img;
public int i, cid;
protected void Page_Load(object sender, EventArgs e)
{

string s = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;

P S Hirapara Mahila College -JETPUR Page 86


A Project Report on: Stock Management

con = new SqlConnection(s.ToString());


string s_id = "";
if (IsPostBack == false)
{
int a = 0;
drop_category.Items.Insert(a, new ListItem("--select--", "0"));
com = new SqlCommand("select * from category", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
a++;
drop_category.Items.Insert(a, new ListItem(dr["c_name"].ToString(),
dr["c_id"].ToString()));
}
}
con.Close();
if (Request.QueryString["p_id"] != null)
{
int id = Convert.ToInt16(Request.QueryString["p_id"].ToString());
com = new SqlCommand("select * from product where p_id=" + id, con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
drop_category.SelectedValue = dr["c_id"].ToString();
s_id = dr["s_id"].ToString();
txt_name.Text = dr["p_nm"].ToString();
Image1.ImageUrl = dr["p_img"].ToString();
txt_price.Text = dr["p_price"].ToString();
TextBox1.Text = dr["p_desc"].ToString();
txt_quantity.Text = dr["p_quantity"].ToString();
dr.Close();
}
con.Close();
int ab = 0;
if (s_id != null)
{
com = new SqlCommand("select * from subcategory where c_id=" +
Convert.ToInt16(drop_category.SelectedValue), con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{

P S Hirapara Mahila College -JETPUR Page 87


A Project Report on: Stock Management

drop_subcategory.Items.Insert(ab, new ListItem(dr["name"].ToString(),


dr["s_id"].ToString()));
ab++;
}
}
con.Close();
drop_subcategory.SelectedValue = s_id;
}
}
}
}
protected void drop_category_SelectedIndexChanged(object sender, EventArgs e)
{
int i = 0;
drop_subcategory.Items.Clear();
if (drop_category.SelectedValue.ToString() == "0")
{
drop_category.Items.Insert(0, new ListItem("--select--", "0"));
}
else
{
if (Request.QueryString["u_id"] == null)
{
com = new SqlCommand("select * from subcategory where c_id=" +
Convert.ToInt16(drop_category.SelectedValue.ToString()), con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
drop_subcategory.Items.Insert(i, new ListItem(dr["name"].ToString(),
dr["s_id"].ToString()));
i++;
}
}
con.Close();
}
}
}
protected void drop_subcategory_SelectedIndexChanged(object sender, EventArgs e)
{

}
protected void btn_edit_Click(object sender, EventArgs e)
{
if (Request.QueryString["p_id"] != null)
{
string img = "../image/" + FileUpload1.FileName;
if (FileUpload1.FileName == "")

P S Hirapara Mahila College -JETPUR Page 88


A Project Report on: Stock Management

{
img = Image1.ImageUrl.ToString();
}
else
{
FileUpload1.SaveAs(MapPath("image/" + FileUpload1.FileName));
}
int i = Convert.ToInt16(Request.QueryString["p_id"].ToString());
com = new SqlCommand("update product set c_id='" + drop_category.SelectedValue
+ "',s_id='" + drop_subcategory.SelectedValue + "',p_name='" + txt_name.Text + "',p_img='"
+ img + "',p_price='" + txt_price.Text + "',p_quantity='" + txt_quantity.Text +
"',p_description='" + TextBox1.Text + "'where p_id='" + i + "'", con);
con.Open();
int i1 = com.ExecuteNonQuery();
if (i1 > 0)
{
Response.Redirect("view_product.aspx");
}
con.Close();
}
}
protected void btn_add_Click(object sender, EventArgs e)
{
string s1 = "select * from product where p_img='" + Image1.ImageUrl + "'";
SqlDataAdapter da = new SqlDataAdapter(s1, con);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Label1.Text = "Product Already Existing..";
}
else
{
com = new SqlCommand("select * from category where c_name=@c_name", con);
con.Open();
com.Parameters.AddWithValue("c_name",
drop_category.SelectedItem.Text.ToString());
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
cid = Convert.ToInt16(dr["c_id"].ToString());
}
con.Close();
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(MapPath("~/image/" + FileUpload1.FileName));
img = "~/image/" + FileUpload1.FileName;
}

P S Hirapara Mahila College -JETPUR Page 89


A Project Report on: Stock Management

else
{
Response.Write("not insert");
}
img = "~/image/" + FileUpload1.FileName;
com = new SqlCommand("insert into
product(c_id,s_id,p_nm,p_img,p_price,p_quantity,p_desc)values('" +
drop_category.SelectedValue + "','" + drop_subcategory.SelectedValue + "','" +
txt_name.Text + "','" + img + "','" + txt_price.Text + "','" + txt_quantity.Text + "','" +
TextBox1.Text + "')", con);
con.Open();
int i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_product.aspx");
}
con.Close();
}
}
}

view_product.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true" CodeFile="view_product.aspx.cs"
Inherits="admin_view_product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div align="center">
<asp:Label ID="Label1" runat="server" Text="view product" ForeColor="black" Font-
Size="XX-Large" Font-Bold="true" Font-Italic="true"></asp:Label></br>

category:<asp:DropDownList ID="DropDownList1" runat="server"


OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="true"></asp:DropDownList>
<br/>
subcategory:<asp:DropDownList ID="DropDownList2" runat="server"
AutoPostBack="true"></asp:DropDownList>
<br />
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/admin/add_product.aspx"><img src="../image/add.png" style="height:30px;
width:47px"/></asp:LinkButton>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand ="SELECT p_id, c_id, p_nm, p_img,
p_quantity, p_price, p_desc ,c_id FROM product WHERE (s_id = @s_id)">

P S Hirapara Mahila College -JETPUR Page 90


A Project Report on: Stock Management

<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" DefaultValue="0" Name="s_id"
PropertyName="selectedvalue" />

</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
DataKeyNames="p_id" DataSourceID="SqlDataSource1"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="4"
ForeColor="Black" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
BorderWidth="3px" CellSpacing="2">
<Columns>

<asp:TemplateField HeaderText="image">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#Bind("p_img")
%>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Height="43px" ImageUrl='<
%#Eval("p_img") %>' Width="63px"></asp:Image>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="p_nm" HeaderText="name"
SortExpression="p_nm" />
<asp:BoundField DataField="p_price" HeaderText="price"
SortExpression="p_price" />
<asp:BoundField DataField="p_desc" HeaderText="description"
SortExpression="p_desc" />
<asp:BoundField DataField="p_quantity" HeaderText="quantity"
SortExpression="quantity" />
<asp:TemplateField HeaderText="Action">

<ItemTemplate>
<a href="add_product.aspx?p_id=<%#Eval("p_id") %>" onclick="return
upd();">
<img src="../image/edit.gif" height="25px" width="25px" /></a>
<a href="view_product.aspx?p_id=<%#Eval("p_id") %>" onclick="return
del();">
<img src="../image/del.gif" height="25" width="25" /></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>

<FooterStyle BackColor="#CCCCCC" />


<HeaderStyle BackColor="Black" CssClass="ac" Height="45" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />

P S Hirapara Mahila College -JETPUR Page 91


A Project Report on: Stock Management

<RowStyle BackColor="White" />


<SelectedRowStyle BackColor="#000099" ForeColor="White" Font-Bold="True" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#808080" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
</div>
</asp:Content>

view_product.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class admin_view_product : System.Web.UI.Page
{
SqlCommand com;
SqlConnection con;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
String s = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(s.ToString());

//int i=o;
if (IsPostBack == false)
{
int id = 0;
DropDownList1.Items.Insert(id, new ListItem("--select--", "0"));
com = new SqlCommand("select * from category", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
id++;
DropDownList1.Items.Insert(id, new ListItem(dr["c_name"].ToString(),
dr["c_id"].ToString()));
}
}
con.Close();

P S Hirapara Mahila College -JETPUR Page 92


A Project Report on: Stock Management

}
if (DropDownList1.SelectedValue.ToString() == "0")
{
SqlDataSource1.SelectCommand = "SELECT *FROM[product]";
}
if (Request.QueryString["p_id"] != null)
{
int a = Convert.ToInt16(Request.QueryString["p_id"].ToString());
com = new SqlCommand("delete from product where p_id=@p_id", con);
con.Open();
com.Parameters.AddWithValue("@p_id", +a);
int i = com.ExecuteNonQuery();
if (i > 0)
{
Response.Redirect("view_product.aspx");
}
con.Close();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
int i = 0;
DropDownList2.Items.Clear();
if (DropDownList1.SelectedValue.ToString() == "0")
{
DropDownList2.Items.Insert(0, new ListItem("--select--", "0"));
}
else
{
com = new SqlCommand("select* from subcategory where c_id=" +
DropDownList1.SelectedValue.ToString() + "", con);
con.Open();
dr = com.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
DropDownList2.Items.Insert(i, new ListItem(dr["name"].ToString(),
dr["s_id"].ToString()));
i++;
}
}
con.Close();
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

P S Hirapara Mahila College -JETPUR Page 93


A Project Report on: Stock Management

view_purchase.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="view_purchase.aspx.cs" Inherits="admin_view_purchase" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content"><br />
<td class="label1" colspan="2" style="text-align:center; font-family :'Times New Roman' ">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand="select [b_id],[u_id],[b_total],[pur_date],
[b_nm],[b_eid],[b_con],[b_city] from [bill] where ([b_status]=@b_status)">
<SelectParameters>
<asp:Parameter DefaultValue="0" Name="b_status" Type="Int32" /> </SelectParameters>
</asp:SqlDataSource></table>

<tr><td><center>
<h1>ViewPurchase</h1></td></tr></center>
<center>
<tr><td style="text-align:center;">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="b_id" DataSourceID="SqlDataSource1" AllowPaging="True"
BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
CellPadding="4" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >
<Columns>
<asp:BoundField DataField="pur_date" FooterText="Date" SortExpression="pur_date"
HeaderText="Date" />
<asp:BoundField DataField="b_nm" FooterText="uname" SortExpression="b_nm"
HeaderText="Name" />
<asp:BoundField DataField="b_eid" FooterText="email" SortExpression="b_eid"
HeaderText="E-mail" />
<asp:BoundField DataField="b_con" FooterText="contactno" SortExpression="b_con"
HeaderText="Contact" />
<asp:BoundField DataField="b_city" FooterText="city" SortExpression="b_city"
HeaderText="City" />
<asp:TemplateField HeaderText="Actoin">
<ItemTemplate>
<a href="view_purchsedetail.aspx?b_id=<%# Eval("b_id") %>">View</a>
<a href="view_purchase.aspx?b_id=<%# Eval("b_id") %>">Shipping</a>
</ItemTemplate>
</asp:TemplateField> </Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#8E4D44" CssClass="ac" Height="45" Font-
Bold="True" ForeColor="#FFFFCC" />

P S Hirapara Mahila College -JETPUR Page 94


A Project Report on: Stock Management

<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"


HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="#663399" Font-
Bold="True" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>
</table><br /></div></div>
</asp:Content>

view_purchase.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class admin_view_purchase : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
String str = ConfigurationManager.ConnectionStrings["stock"].ConnectionString;
con = new SqlConnection(str);
if (Request.QueryString["b_id"] != null)
{
int a = Convert.ToInt16(Request.QueryString["b_id"].ToString());
cmd = new SqlCommand("update bill set b_status='" + 1 + "' where b_id=@b_id",
con);
con.Open();
cmd.Parameters.AddWithValue("@b_id", a);
int i = cmd.ExecuteNonQuery();
con.Close();
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

P S Hirapara Mahila College -JETPUR Page 95


A Project Report on: Stock Management

view_purchasedetail.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/stock.master"


AutoEventWireup="true"
CodeFile="view_purchsedetail.aspx.cs" Inherits="admin_view_purchsedetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<style type="text/css">
.auto-style1 {
width: 272px;
}
.auto-style2 {
color: #FF0000;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="content">
<div id="login_content" align="center"><br>
<tr><td align="center" >
<h1>Userpurchase</h1></td></tr>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:stock %>" SelectCommand="SELECT product.p_img, product.p_nm,
product.p_price, bill.b_total, bill1.p_quantity FROM bill1 INNER JOIN product ON
bill1.p_id = product.p_id INNER JOIN bill ON bill1.b_id = bill.b_id WHERE (bill1.b_id =
@b_id)">
<SelectParameters>
<asp:QueryStringParameter Name="b_id" QueryStringField="b_id" />
</SelectParameters>
</asp:SqlDataSource><tr><td class="auto-style1">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#CC9966"
BorderStyle="None" BorderWidth="1px" CellPadding="4">
<Columns><asp:TemplateField HeaderText="Image" SortExpression="image">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" CssClass="textbox" Text='<%#
Bind("p_img") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" CssClass="img" ImageUrl='<%#
Eval("p_img") %>' Height="65" Width="89"></asp:Image>
</ItemTemplate></asp:TemplateField>
<asp:BoundField DataField="p_nm" HeaderText="Name" SortExpression="p_nm" />
<asp:BoundField DataField="p_price" HeaderText="Price"
SortExpression="p_price" />
<asp:BoundField DataField="p_quantity" HeaderText="Quantity"
SortExpression="p_quantity" />
<asp:TemplateField HeaderText="Total">

P S Hirapara Mahila College -JETPUR Page 96


A Project Report on: Stock Management

<ItemTemplate>
<asp:Label ID="lbl_total" runat="server" Text='<%#
Convert.ToInt32( Eval("p_price"))*Convert.ToInt32(Eval("p_quantity")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#8E4D44" Font-Bold="True" ForeColor="#FFFFCC" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"
HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="#663399" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView></td></tr></table>
<asp:Button ID="Button1" runat="server" Text="Back" OnClick="Button1_Click"
CssClass="button"/>
<span class="auto-style2">Total</span>:-<asp:Label ID="Label1" runat="server"
ForeColor="Black" Text="Label"></asp:Label>
<br /></div></div>
</asp:Content>

view_purchasedetail.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_view_purchsedetail : System.Web.UI.Page


{
int a, b, c, sum = 0;
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
a = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text.ToString());
b = Convert.ToInt32(GridView1.Rows[i].Cells[3].Text.ToString());
c = a * b;
sum = sum + c;
}
Label1.Text = sum.ToString();
}
protected void Button1_Click(object sender, EventArgs e)

P S Hirapara Mahila College -JETPUR Page 97


A Project Report on: Stock Management

{
Response. Redirect("view_purchase.aspx");
}
}

7. Testing (Manual, Test Cases and Test Data)

P S Hirapara Mahila College -JETPUR Page 98


A Project Report on: Stock Management

7.1 Manual Testing:

1) Role of Testing:
A project is like a load trip, some projects are simple routine like Driving to store in broad
daylight. But most project work doing are driving a Truck in mountains at night those project
needs headlights as light the way.

You illuminate the road ahead so the programmer & manager, However the blocker over the
map , can at least see where they are what they Are about to run over & how close they are to
diff. The details mission of the Group varies from company. Behind those details there is
common factor.

Testing is done to find information critical decision about the project or products that are
made on basic of that information.

2) Testing:
Once source code has been generated software must be tested to uncover many errors
possible before to customer.

Its goal is design series of test cases that have likelihood of finding Errors software testing
techniques provide systematic guidance for designing.

Test that:-
a) Exercise internal logic of software components.
b) Exercise the I/P & O/P domains of program Functional behavior & performance.
Testing phase must maximize the number of errors detected & minimize the
number of test cases.

- Testing is two types:-


a) Functional
b) Structure

a) Functional Testing has:-

a) Equivalence class portion.


b) Boundary value analysis.
c) Cause effect graphing.

b) Structural Testing has:-

a) Control flow based criteria.


b) Data flow based testing.
c) Mutation testing.
3) Testing Objecting:

P S Hirapara Mahila College -JETPUR Page 99


A Project Report on: Stock Management

Testing is process of executing program with the intent of finding an error. A good test case
is one then has high probability of finding yet UN-discovers error.

A) White Box Testing:

 Guarantee that all individual paths within module have been exercise at least
once.
 Exercise all logical decision on their true & false side.
 Exercise all loops at their boundaries & within their optional bound.
 Exercise interval data to ensure there validity.

B) Black Box Testing:

 Black box testing also called behavior testing focus on functional requirement of
software.
 Black box testing enable the software engine to device the set input or output
condition that will fully exercise all functional requirement programs.
 Black box testing concerned with the proper execution of the system
specification.

 In black box testing we can checked:-

 Incorrect or missing fiction.


 Interface error.
 Error in data structure or external database access.
 Behavior or performance error.
 Initialization and termination error.

7.2Test Cases:-

P S Hirapara Mahila College -JETPUR Page 100


A Project Report on: Stock Management

Criteria:-
Input 1:-only character.
Inpur 2:-only digit.
Input 3:-character with digit.
Input 4:-character with special symbol.

Register:

Field Input1 Input2 Input3 Input4


Fname Yes No Yes Yes
Lname Yes No Yes Yes
City Yes No No No
Address Yes Yes Yes No
Contactno Yes Yes No No
Emailed Yes Yes Yes Yes
Username Yes No Yes No
Password Yes Yes No No
Sec question Yes No No No
Answer Yes Yes Yes Yes
Result Pass Error Error Error

Login:

Field Input1 Input2 Input3 Input4


Username Yes No Yes No
Password Yes Yes No No
Result Pass Error Error Error

Forgot password1:

Field Input1 Input2 Input3 Input4


Username Yes No No No
Result Pass Error Error Error

Forgot password2:

Field Input1 Input2 Input3 Input4


Answer Yes Yes Yes No
Result Pass Error Error Error
Forgot password3:

P S Hirapara Mahila College -JETPUR Page 101


A Project Report on: Stock Management

Field Input1 Input2 Input3 Input4


New pass Yes Yes Yes Yes
Conform pass Yes Yes Yes Yes
Result Pass Error Error Error

Change password:

Field Input1 Input2 Input3 Input4


Old pass Yes Yes Yes Yes
New pass Yes Yes Yes Yes
Conform pass Yes Yes Yes Yes
Result Pass Error Error Error

Feedback:

Field Input1 Input2 Input3 Input4


Comment Yes Yes Yes Yes
Result Pass Error Error Error

Category:

Field Input1 Input2 Input3 Input4


Category name Yes No Yes No
Result Pass Error Error Error

Sub Category:

Field Input1 Input2 Input3 Input4


C_name Yes No Yes No
S_name Yes Yes Yes No
Result Pass Error Error Error

Add to cart:

Field Input1 Input2 Input3 Input4


Quantity Yes Yes Yes No
Result Pass Error Error Error

Product:

P S Hirapara Mahila College -JETPUR Page 102


A Project Report on: Stock Management

Field Input1 Input2 Input3 Input4


Name Yes No No No
Price Yes No No No
Detail Yes No No No
Quantity Yes No No Yes
Result Pass Error Error Error

Purchase:

Field Input1 Input2 Input3 Input4


Name Yes No Yes No
Address Yes Yes Yes No
City Yes No No Yes
Contact Yes Yes No Yes
Result Pass Error Error Error

Bill 1:

Field Name Input1 Input2 Input3 Input4


name Yes Yes Yes No
address Yes No Yes No
city Yes Yes No Yes
contact Yes No No Yes
total Yes Yes No Yes
Result Pass Error Error Error

Bill 2:

Field Name Input1 Input2 Input3 Input4


quantity Yes No No Yes
Result Pass Error Error Error

8- Enhancement

P S Hirapara Mahila College -JETPUR Page 103


A Project Report on: Stock Management

8.1 advantages:

 Easy shopping
 Wide range of items
 Value for money of different items
 Publicity of different companies and their products
 Easy to purchase

8.2 Limitation:

 These include excessive crowding especially on weekends and holidays


 Sometimes it seems that everyone has the same idea to congregate at the shop.

8.3 Future scopes:

 Differencing the consumer offering with a focus on experience and convenience


 Transforming the shop experience by leveraging technology and multichannel
strategies
 Exploration of new formats and commercial real estate opportunities

9- References

P S Hirapara Mahila College -JETPUR Page 104


A Project Report on: Stock Management

Books:

Asp.net book reference.

Website:

Http//:www.w3schools.com

P S Hirapara Mahila College -JETPUR Page 105

You might also like