Beruflich Dokumente
Kultur Dokumente
The project was all about developing a web application for maintaining online
shopping. The web application should be accessed from anywhere in the world through
Internet where visitors can create their account and become a customer. They can purchase
goods available in the online store by paying through credit card. There is an administrator
who monitors the website activity and adds, updates or removes product items as and when
required.
Problem Definition:
These days the importance of online shopping has increased significantly. Spending
hours for going to the shop and choosing the goods to buy is not always possible for
everyone. Facing the crowd is also a tough job for especially the senior citizens. Often people
do not get the world class goods in their locality. There are many more drawbacks of
conventional shopping procedure.
Proposed System:
In order to overcome these drawbacks, online shopping is a very convenient
alternative. We are designing a system that will facilitate the customers to review the
products, conveniently choose the required one and purchase them. The customer can also
add their needed items to their cart and buy those later on. An administrator will monitor the
website activities and manage the product items. The administrator also has the privilege of
deleting a particular customer and to manage the cart and the bank transactions database.
Page | 1
Requirements Analysis &
Specifications
Requirements Analysis
Following is a list of functionalities of the system. The system must consist of two
modules, Customer module or User module and an Administrator module.
Customer Module:
• Visitors must create their account first to access the website contents.
• After registration a visitor becomes a customer.
• Each customer will have unique user id and a password with which they can log in.
• After log in the customer will be redirected to their own user-home page, where they
can select their preferred product and add it to the cart.
• After adding to the cart, customers can also log out from the system and pay for those
items later.
• The details specifications & price of each product must be provided at the website.
• The customers should be able to update or delete their account if they want to.
• Account must be prevented from unauthorized access.
• The payment method will be online payment through credit card.
Administrator Module:
• An administrator can log in using his user id and password like any other users.
• After log in the administrator will be redirected to admin-home page.
• The administrator can add, update or remove products as and when required.
• The administrator can increase the number of stock of a product when required.
• The administrator can manage the user database.
• The administrator also has the privilege of managing the cart and the bank
transactions database.
• Administrator can change the log in password if needed.
Page | 2
• The administrator module must be prevented from unauthorized access. None other
than the administrator can be able to access this module.
Softwares Used:
Hardwares Used:
Page | 3
Data Flow Diagram
Level 0: Context Level Diagram
Level 1: Customer
Page | 4
Level 1: Administrator
Page | 5
Entity-Relationship Diagram
Page | 6
Table Schemas
Page | 7
Table 1: Usr
Table 2: Record
Table 3: Details
Table 4: Stock
Table 5: Cart
Page | 8
Table 6: Bank
Table 7: Admin
Project Screenshots
Customer Module:
Page | 9
User Login Page (default.aspx)
Page | 10
Products Home (products.aspx)
Page | 11
User Account Details (account.aspx)
Page | 12
Administrator Module:
Page | 13
Manage Cart (cart_admin.aspx)
Page | 14
Source Code
Customer Module:
User Functions Class (Class_usr.cs)
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public string InsertUsr(string email, string name, string comp, string coun,string addr,string
town,string pin,string phone,string job,string typecom,string password)
{
try
{
con.Open();
com = new SqlCommand("insert into usr values('" + email + "','" + name + "','" + comp +
"','" + coun + "','" + addr + "','" + town + "','" + pin + "','" + phone + "','" + job + "','" +
typecom + "','" + password + "')", con);
com.ExecuteNonQuery();
con.Close();
Page | 15
msg = "DONE";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error in registration (Maybe your username already in use), try again!";
return msg;
}
}
public string UpdateUsr(string email, string name, string comp, string coun, string addr, string
town, string pin, string phone, string job, string typecom, string password)
{
try
{
con.Open();
com = new SqlCommand("update usr set name='" + name + "',comp='" + comp + "',coun='" + coun
+ "',addr='" + addr + "',town='" + town + "',pin='" + pin + "',phone='" + phone + "',job='" + job +
"',typecom='" + typecom + "',password='" + password + "' where email='" + email + "'", con);
com.ExecuteNonQuery();
con.Close();
msg = "DONE";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error in updation, try again!";
return msg;
}
}
Page | 16
{
con.Close();
msg = "NOT DONE";
return msg;
}
}
public string InsertBank(string email, string bname, string bbranch, string card, int amnt,
DateTime datym)
{
string msg;
try
{
con.Open();
com = new SqlCommand("insert into bank values('" + email + "','" + bname + "','" + bbranch
+ "','" + card + "'," + amnt + ",'" + datym + "')", con);
com.ExecuteNonQuery();
con.Close();
msg = "DONE";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "NOT DONE";
return msg;
}
}
}
Page | 17
Login (Default.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("privsypolicy.aspx");
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
this.Label_error.Text = cu.InsertUsr(this.Text_email.Text, this.Text_name.Text,
this.Text_com.Text, this.Drop_coun.SelectedItem.Text, this.Text_add.Text, this.Text_city.Text,
this.Text_pc.Text, this.Text_pn.Text, this.Drop_job.SelectedItem.Text,this.Drop_type.SelectedItem.Text,
this.Text_passwd.Text);
Session["email"] = this.Text_email.Text;
if (this.Label_error.Text == "DONE")
Page | 18
{
Response.Redirect("account.aspx");
}
}
catch (Exception ex)
{
this.Label_error.Text = "Error in registration, please fill the registration form
properly!";
}
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("nwusr.aspx");
}
}
Page | 19
protected void Page_Load(object sender, EventArgs e)
{
try
{
string test = Session["email"].ToString(); //Checks the user is logged in or not.
}
catch (Exception ex)
{
//Response.Write("<script>alert('Please Login to Enter!!')</script>");
Response.Redirect("Default.aspx");
}
this.Label_pidd.Text = Session["pidd"].ToString();
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
string rpl = cu.InsertCart(Session["email"].ToString(),
Session["pidd"].ToString(),int.Parse(this.DropDownList1.SelectedItem.Text)); //Inserts the Qty. of the
selected item into the CART.
cu.UpdateStock(Session["pidd"].ToString(),
int.Parse(this.DropDownList1.SelectedItem.Text)); //Reduces the STOCK of the selected item after
inserting into CART.
if (rpl == "DONE")
{
Response.Write("<script>alert('Added to Cart')</script>");
}
else
Response.Write("<script>alert('Error!! Try Again..')</script>");
//Response.Redirect("products.aspx");
}
catch (Exception ex)
{
Response.Write("<script>alert('Error!! Try Again..')</script>");
}
}
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("products.aspx");
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("payment.aspx");
}
}
Page | 20
//Response.Write("<script>alert('Please Login to Enter!!')</script>");
Response.Redirect("Default.aspx"); //User is not logged in.
}
}
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("authentic.aspx");
}
protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("products.aspx");
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("authentic.aspx");
}
}
Page | 21
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Session.Remove("email");
Response.Write("<script language=javascript>var
wnd=window.open('','newWin','height=1,width=1,left=900,top=700,status=no,toolbar=no,menubar=no,scrollba
rs=no,maximize=false,resizable=1')</script>");
Response.Write("<script language=javascript>wnd.close()</script>");
Response.Write("<script
language=javascript>window.open('Default.aspx','_parent',replace=true)</script>");
}
}
Administrator Module:
Administrator Functions Class (Class_admin.cs)
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
Page | 22
{
sda = new SqlDataAdapter("select pid from record", con);
DataSet ds = new DataSet();
sda.Fill(ds, "pid_record");
return ds;
}
public string InsertRecord(string pid, string purl, string pname, int pprice)
{
try
{
con.Open();
com = new SqlCommand("insert into record values('" + pid + "','" + purl + "','" + pname +
"'," + pprice + ")", con);
com.ExecuteNonQuery();
con.Close();
msg = "Successfully Inserted into 'RECORD'";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error insertion in 'RECORD'";
return msg;
}
}
public string InsertDetails(string pdurl, string pid, string pmodel, string pspec,int mprice,int
eprice)
{
try
{
con.Open();
com = new SqlCommand("insert into details values('" + pdurl + "','" + pid + "','" + pmodel
+ "','" + pspec + "'," + mprice + "," + eprice + ")", con);
com.ExecuteNonQuery();
con.Close();
msg = "Successfully Inserted into 'DETAILS'";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error insertion in 'DETAILS'";
return msg;
}
}
Page | 23
public string InsertStock(string pid, int pqty)
{
try
{
con.Open();
com = new SqlCommand("insert into stock values('" + pid + "'," + pqty + ")", con);
com.ExecuteNonQuery();
con.Close();
msg = "Successfully Inserted into 'STOCK'";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error insertion in 'STOCK'";
return msg;
}
}
public string UpdateRecord(string pid, string purl, string pname, int pprice)
{
try
{
con.Open();
com = new SqlCommand("update record set purl='" + purl + "',pname='" + pname + "',pprice="
+ pprice + " where pid='" + pid + "'", con);
com.ExecuteNonQuery();
con.Close();
msg = "'RECORD' Updated Successfully";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error Updation in 'RECORD'";
return msg;
}
}
public string UpdateDetails(string pdurl, string pid, string pmodel,string pspec, int mprice,int
pprice)
{
try
{
con.Open();
com = new SqlCommand("update details set pdurl='" + pdurl + "',pmodel='" + pmodel +
"',pspec='" + pspec + "',mprice='" + mprice + "',eprice='" + pprice + "' where pid='" + pid + "'",
con);
com.ExecuteNonQuery();
con.Close();
msg = "'DETAILS' Updated Successfully";
return msg;
}
catch (Exception ex)
{
con.Close();
msg = "Error Updation in 'DETAILS'";
return msg;
}
}
Page | 24
catch (Exception ex)
{
con.Close();
msg = "Error Updation in 'STOCK'";
return msg;
}
}
Page | 25
try
{
con.Open();
com = new SqlCommand("delete from bank where card='" + card + "'", con);
com.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
con.Close();
}
}
}
Login (eshoppe_admin32310.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = ca.Login(this.TextBox1.Text, this.TextBox2.Text); //Validate administrator.
if (this.Label1.Text == "DONE")
{
Session["unamead"] = this.TextBox1.Text; //Will be used in the other administrator pages to
check wheather the administrator is logged in or not.
Response.Redirect("products_admin.aspx");
}
}
}
Page | 26
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
TempDs = ca.FetchRecord(this.DropDownList1.SelectedItem.Text);
this.TextBox_pid.Text = TempDs.Tables["record"].Rows[0][0].ToString();
this.TextBox_purl.Text = TempDs.Tables["record"].Rows[0][1].ToString();
this.TextBox_pname.Text = TempDs.Tables["record"].Rows[0][2].ToString();
this.TextBox_pprice.Text = TempDs.Tables["record"].Rows[0][3].ToString();
TempDs = ca.FetchDetails(this.DropDownList1.SelectedItem.Text);
this.TextBox_pdurl.Text = TempDs.Tables["details"].Rows[0][0].ToString();
this.TextBox_pmodel.Text = TempDs.Tables["details"].Rows[0][1].ToString();
this.TextBox_pspec.Text = TempDs.Tables["details"].Rows[0][2].ToString();
this.TextBox_mprice.Text = TempDs.Tables["details"].Rows[0][3].ToString();
TempDs = ca.FetchStock(this.DropDownList1.SelectedItem.Text);
this.TextBox_qty.Text = TempDs.Tables["stock"].Rows[0][0].ToString();
}
protected void Button1_Click(object sender, EventArgs e) //Used to insert a new item & refresh the
page.
{
try
{
this.Label1.Text = ca.InsertRecord(this.TextBox_pid.Text, this.TextBox_purl.Text,
this.TextBox_pname.Text, int.Parse(this.TextBox_pprice.Text));
this.Label2.Text = ca.InsertDetails(this.TextBox_pdurl.Text, this.TextBox_pid.Text,
this.TextBox_pmodel.Text, this.TextBox_pspec.Text, int.Parse(this.TextBox_mprice.Text),
int.Parse(this.TextBox_pprice.Text));
this.Label3.Text = ca.InsertStock(this.TextBox_pid.Text, int.Parse(this.TextBox_qty.Text));
//Response.Write("<script>alert('Values Inserted Successfully!!')</script>");
Response.Redirect("products_admin.aspx");
}
catch (Exception ex)
{
Response.Write("<script>alert('Please Enter in Proper Formats!!')</script>");
}
Page | 27
}
protected void Button3_Click(object sender, EventArgs e) //Used to delete an item from the
RECORD(The item will automatically removed from DETAILS & STOCK because of the Foreign Key) & refresh
the page.
{
this.Label2.Text = ca.DeleteRecord(this.TextBox_pid.Text);
Response.Redirect("products_admin.aspx");
}
protected void Button2_Click(object sender, EventArgs e) //Used to update an item & refresh the
page.
{
try
{
this.Label1.Text = ca.UpdateRecord(this.TextBox_pid.Text, this.TextBox_purl.Text,
this.TextBox_pname.Text, int.Parse(this.TextBox_pprice.Text));
this.Label2.Text = ca.UpdateDetails(this.TextBox_pdurl.Text, this.TextBox_pid.Text,
this.TextBox_pmodel.Text, this.TextBox_pspec.Text, int.Parse(this.TextBox_mprice.Text),
int.Parse(this.TextBox_pprice.Text));
this.Label3.Text = ca.UpdateStock(this.TextBox_pid.Text, int.Parse(this.TextBox_qty.Text));
//Response.Write("<script>alert('Values Updated Successfully!!')</script>");
Response.Redirect("products_admin.aspx");
}
catch (Exception ex)
{
Response.Write("<script>alert('Please Enter in Proper Formats!!')</script>");
}
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("usr_admin.aspx");
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("cart_admin.aspx");
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("bank_admin.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("esadmin_admin.aspx");
}
protected void Button8_Click(object sender, EventArgs e)
{
Session.Remove("unamead");
Response.Redirect("eshoppe_admin32310.aspx");
}
}
Manage Cart (cart_admin.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
Page | 28
}
catch (Exception ex)
{
//Response.Write("<script>alert('Please Login to Enter!!')</script>");
Response.Redirect("eshoppe_admin32310.aspx");
}
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("usr_admin.aspx");
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("products_admin.aspx");
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("bank_admin.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("esadmin_admin.aspx");
}
protected void Button8_Click(object sender, EventArgs e)
{
Session.Remove("unamead");
Response.Redirect("eshoppe_admin32310.aspx");
}
protected void Button10_Click(object sender, EventArgs e) //Some users are not paying & the CART is
getting heavy? Delete items from CART.
{
ca.DeleteCart(this.TextBox1.Text);
Response.Redirect("cart_admin.aspx");
}
}
Manage Bank (bank_admin.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
Page | 29
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("products_admin.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("esadmin_admin.aspx");
}
protected void Button8_Click(object sender, EventArgs e)
{
Session.Remove("unamead");
Response.Redirect("eshoppe_admin32310.aspx");
}
protected void Button10_Click(object sender, EventArgs e) //Delete the items from the BANK of this
user.
{
ca.DeleteBank_usr(this.TextBox1.Text);
Response.Redirect("bank_admin.aspx");
}
protected void Button11_Click(object sender, EventArgs e) //Delete the items from the BANK having
the Credit Card No.___ .
{
ca.DeleteBank_card(this.TextBox2.Text);
Response.Redirect("bank_admin.aspx");
}
}
Manage Users (usr_admin.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("products_admin.aspx");
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("cart_admin.aspx");
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("bank_admin.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("esadmin_admin.aspx");
Page | 30
}
protected void Button8_Click(object sender, EventArgs e)
{
Session.Remove("unamead");
Response.Redirect("eshoppe_admin32310.aspx");
}
protected void Button10_Click(object sender, EventArgs e) //Deletes an user & refreshes the page.
{
ca.DeleteUsr(this.TextBox1.Text);
Response.Redirect("usr_admin.aspx");
}
}
Change Password (esadmin_admin.aspx.cs)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
Page | 31
Testing
Black-Box Testing:
Page | 32
User Login Page Correct username & password Redirect to Products Home Redirect to Products Home
User Login Page Invalid Username Error: Error in login, try again! Error: Error in login, try again!
Correct username & wrong Error: The username & Error: The username &
User Login Page
password password doesn't match! password doesn't match!
New Registration Page Name field is blank Error: Can't leave blank Error: Can't leave blank
New Registration Page Invalid E-Mail address Error: Enter a valid E-Mail Error: Enter a valid E-Mail
Correct username & wrong Error: The username & Error: The username &
Administrator Login
password password doesn't match! password doesn't match!
Page | 33
Conclusions
We have tried our best to make this system bugs free as much as
possible. We have designed it keeping in mind that our application looks like a
real time application. It is designed in a very user friendly way. GUI is designed
as simple as possible. System is made such a way that optimal execution time
is needed to perform an operation. Maximum level of security is implemented in
the application. Moderating privilege is given to the administrator as much as
possible.
Still there are certain limitations in our web application and we hope to
solve that as soon as possible.
Page | 34
References
Bibliography:
1. Matthew MacDonald, Beginning ASP.NET 3.5 in C# 2008, Apress.
3. Dalton, Whitehead and Kogent, SQL Server 2005 (Black Book), Dreamtech Press.
Webliography:
1. http://www.roseindia.net/
2. http://www.w3schools.com/
3. http://www.tutorialspoint.com/
4. http://www.stardeveloper.com/
5. http://msdn.microsoft.com/en-us/library/ms123401.aspx
Page | 35