Code Shopping Project
Code Shopping Project
1. frmAboutus.aspx
<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmAboutus.aspx.cs" Inherits="About_Us_frmAboutus" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <html> <head> <title></title> </head> <body> <table> <tr> <td align="left"> <h3> About Us</h3> </td> </tr> <tr> <td style="text-align: justify"> <p>This Organization is ISO-9001 Certified Company.We are a group of 20 Lakh Employees spread all over the globe.We Provide Excellent Services to Costume and Fashion Industry.We specialize in Kurthis,Jeans, Shirts,Salwars,Sarees etc.Our Head office is located in Head Office Mumbai.We have our Branch Offices all over India(Hyderabad,Chennai etc).We Plan to extend our services to rural India in the near future. </p> </td> </tr> </table> </body> </html> </asp:Content>
using using using using using using using using using using
System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;
public partial class About_Us_frmAboutus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }
Admin
1. AdminCatalog a. adminBrand i.frmBrandList.aspx
<%@ Page Language="C#" AutoEventWireup="true" asterPageFile="~/Templates/Default/AdminMaster.master"CodeFile="frmBrandList.aspx.cs" Inherits="AdminBrand_frmBrandList" %> <%@ Register Src="ucBrandList.ascx" TagName="ucBrandList" TagPrefix="uc1" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc1:ucBrandList ID="UcBrandList1" runat="server" /> </div> </asp:Content>
ii.
ucBrandList.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucBrandList.ascx.cs" Inherits="ucBrandList" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td align="center" bgcolor="navy"> <strong><span style="color:White">BRAND LIST</span></strong><br /> </td> </tr> <tr> <td id="tdBrandList" style="width:100%" align="left"> <asp:Panel ID="panelTop" runat="server" Width="100%"> <asp:LinkButton ID="lBtnNewBrand" Text="Add New Brand" runat="server" OnClick="lBtnNewBrand_Click"></asp:LinkButton> <asp:DataList ID="dlBrand" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlBrand_ItemCommand"> <HeaderStyle BackColor="Lavender"/> <ItemStyle BackColor="Azure"/> <AlternatingItemStyle BackColor="LightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:25%" align="center">Brand Name</td> <td style="width:45%" align="center">Description</td> <td style="width:15%" align="center">Edit</td> <td style="width:15%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:25%" align="center"> <asp:Label ID="lblBrandName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"BrandName")%>'></asp:Label> </td> <td style="width:45%" align="center"> <img id="imgBrand" alt='<%#DataBinder.Eval(Container.DataItem,"Description")%>' src='<%#DataBinder.Eval(Container.DataItem,"Logo","~/Browse/Images/{0}")%>' runat="server" width="50" height="50" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnBrandEdit" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" />
</td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnBrandDelete" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Label ID="lblMsg" runat="server" ></asp:Label> </asp:Panel> </td> </tr> <tr> <td id="tdNewBrand" style="width:100%" align="left"> <asp:Panel ID="panelupdate" runat="server" Width="100%"> <table style="width:100%"> <tr> <th colspan="3" align="center" style="height: 21px"> <asp:Label ID="lblUpdateBrand" runat="server" ForeColor="Green"></asp:Label></th> </tr> <tr> <td colspan="3" align="center"><asp:Label ID="lblBrandID" Text="" runat="server" Visible="false"></asp:Label></td> </tr> <tr> <td align="right">Brand Name</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtBrandName" runat="server"></asp:TextBox> </td> </tr> <tr> <td align="right">Description</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtBrandDescriptrion" runat="server" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td align="right" style="height: 36px"> <asp:Label ID="lblBrandLogo" runat="server" Text="UpLoadLogo"></asp:Label> </td> <td align="center" style="width:2%; height: 36px;"><b>:</b></td> <td align="left" style="height: 36px"> <asp:Image ID="imgBrandLogo" runat="server" AlternateText="Not Available" width="100" Height="75"/> </td> </tr> <tr> <td align="right">Logo (Image)</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:FileUpload ID="fileBrand" runat="server" /></td> </tr> <tr> <td colspan="3" align="center"> <asp:ImageButton ID="IbtnBrandSubmit" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Submit" runat="server" OnClick="IbtnBrandSubmit_Click" /> <asp:ImageButton ID="IBtnBrandCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnBrandCancel_Click" /> </td> </tr>
ii.a. ucBrandList.ascx.cs
using using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.IO; ShoppingCart.BL;
public partial class ucBrandList : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); panelTop.Visible = true; panelupdate.Visible = false; } } private void BindList() { DataSet ds = ProductController.getALLBrands(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlBrand.DataSource = ds; dlBrand.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } } protected void lBtnNewBrand_Click(object sender, EventArgs e) { lblUpdateBrand.Text = "Add New Record"; panelTop.Visible = false; panelupdate.Visible = true; IbtnBrandSubmit.AlternateText = "Submit"; txtBrandName.Text = ""; txtBrandDescriptrion.Text = ""; //imgBrandLogo.Visible = false; //lblBrandLogo.Visible = false; } protected void IbtnBrandSubmit_Click(object sender, ImageClickEventArgs e) { string BrandName="", Description="",imageurl="",Logo=""; if (txtBrandName.Text.Trim().Length > 0) BrandName = txtBrandName.Text.Trim(); else lblMsgNewBrand.Text = "Enter Brand Name"; Description =txtBrandDescriptrion.Text.Trim(); if (fileBrand.FileName != null && fileBrand.FileName.Trim() != "")
{ imageurl = "~/Browse/Images/" + fileBrand.FileName; fileBrand.SaveAs(Server.MapPath(imageurl)); Logo = fileBrand.FileName; } else { if (imgBrandLogo.ImageUrl != null) { Logo = Path.GetFileName(imgBrandLogo.ImageUrl); } else Logo = "na.jpg"; }
if (IbtnBrandSubmit.AlternateText == "Submit") { ProductController.InsertBrand(BrandName, Description, Logo); } else { int ID = int.Parse(lblBrandID.Text); ProductController.UpdateBrand(ID, BrandName,Description,Logo); } BindList(); panelTop.Visible = true; panelupdate.Visible = false; } protected void dlBrand_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Edit") { lblUpdateBrand.Text = "Update Record"; //IbtnBrandSubmit.AlternateText = "Update"; DataSet ds = ProductController.GetAllBrandBYBrandID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblBrandID.Text = e.CommandArgument.ToString(); txtBrandName.Text = ds.Tables[0].Rows[0]["BrandName"].ToString(); txtBrandDescriptrion.Text = ds.Tables[0].Rows[0]["Description"].ToString(); imgBrandLogo.ImageUrl = String.Format("~/Browse/Images/{0}", ds.Tables[0].Rows[0]["Logo"].ToString()); IbtnBrandSubmit.AlternateText = "Update"; panelTop.Visible = false; panelupdate.Visible = true; } } if (e.CommandName == "Delete") { lblBrandID.Text = e.CommandArgument.ToString(); int BrandId = int.Parse(lblBrandID.Text); //Response.Write(BrandId); ProductController.DeleteBrand(BrandId); BindList(); } } protected void IBtnBrandCancel_Click(object sender, ImageClickEventArgs e) { panelupdate.Visible = false; panelTop.Visible = true; } }
b. adminCategory i. frmCategoriesList.aspx
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master" CodeFile="frmCategoriesList.aspx.cs" Inherits="frmCategoriesList" %> <%@ Register Src="ucategoryListl.ascx" TagName="ucategoryListl" TagPrefix="uc1" %> <%@ Register Src="ucategoryListl.ascx" TagName="ucategoryListl" TagPrefix="uc2" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc2:ucategoryListl ID="UcategoryListl1" runat="server" /> </div> </asp:Content>
ii.
ucCategoryListl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucategoryListl.ascx.cs" Inherits="ucategoryListl" %> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%" id="tdCategoryList" align="left"> <asp:Panel ID="panelCategoryTop" runat="server" Width="100%"> <asp:LinkButton ID="lBtnNewCategory" Text="Add New Category" runat="server" OnClick="lBtnNewCategory_Click"></asp:LinkButton> <asp:DataList ID="dlCategory" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlCategory_ItemCommand"> <HeaderStyle BackColor="Aqua" /> <ItemStyle BackColor="azure"/> <AlternatingItemStyle BackColor="lightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:30%" align="center">Category Name</td> <td style="width:40%" align="center">Description</td> <td style="width:15%" align="center">Edit</td> <td style="width:15%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:30%" align="center"> <asp:Label ID="lblCategoryName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name") %>'></asp:Label> </td> <td style="width:40%" align="center"> <img id="imgCategory" alt='<%#DataBinder.Eval(Container.DataItem,"Description")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","~/Browse/Images/{0}")%>' runat="server" width="100" height="75" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnEditCat" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnDeleteCat" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList>
<asp:Label ID="lblMsg" Text="" ForeColor="Red" runat="server"></asp:Label> </asp:Panel> </td> </tr> <tr> <td style="width:100%" id="tdNewCategory" align="left"> <asp:Panel ID="panelNewCategory" runat="server" Width="100%"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <th align="center" colspan="3"> <asp:Label ID="lblNewCAtegoryHeader" Text="" runat="server"></asp:Label> </th> </tr> <tr> <td colspan="3" align="center"> <asp:Label ID="lblCatID" Text="" runat="server" Visible="false"></asp:Label> </td> </tr> <tr> <td align="right"> Category Name</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:TextBox ID="txtCategoryName" runat="server" /> </td> </tr> <tr> <td align="right" style="height: 38px">Description</td> <td align="center" style="width:2%; height: 38px;"><b>:</b></td> <td align="left" style="height: 38px"> <asp:TextBox ID="txtCatDescriptrion" runat="server" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td align="right"> <asp:Label ID="lblImage" Text="Uploaded Image" runat="server"></asp:Label></td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:Image ID="imgCatLogo" runat="server" AlternateText="Not Available" Height="75px" Width="100px" /> </td> </tr> <tr> <td align="right">Upload New Image</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:FileUpload ID="fileCat" runat="server" /></td> </tr> <tr> <td colspan="3" align="center" style="height: 34px"> <asp:ImageButton ID="IbtnCatSubmit" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Submit" runat="server" OnClick="IbtnCatSubmit_Click" /> <asp:ImageButton ID="IBtnCatCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnCatCancel_Click" /> </td> </tr> </table> <asp:Label ID="lblMsgNewCat" runat="server" ForeColor="Red" Text=""></asp:Label></asp:Panel> </td> </tr> </table>
ii.a ucCategoryListl.ascx.cs
using using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.IO; ShoppingCart.BL;
public partial class ucategoryListl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } } private void BindList() { DataSet ds = ProductController.getALLCategories(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlCategory.DataSource = ds; dlCategory.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } } protected void lBtnNewCategory_Click(object sender, EventArgs e) { lblNewCAtegoryHeader.Text = "Add New Category"; panelCategoryTop.Visible = false; panelNewCategory.Visible = true; IbtnCatSubmit.AlternateText = "Submit"; txtCategoryName.Text = ""; txtCatDescriptrion.Text = ""; // imgCatLogo.Visible = false; //lblImage.Visible = false; } protected void IbtnCatSubmit_Click(object sender, ImageClickEventArgs e) { string catname="", description="", imageurl="",image=""; if (txtCategoryName.Text.Trim().Length > 0) catname = txtCategoryName.Text.Trim(); else lblMsgNewCat.Text = "Enter Category Name"; description = txtCatDescriptrion.Text.Trim(); if (fileCat.FileName != null && fileCat.FileName.Trim()!="") { imageurl = "~/Browse/Images/" + fileCat.FileName; fileCat.SaveAs(Server.MapPath(imageurl)); image=fileCat.FileName; } else {
if (IbtnCatSubmit.AlternateText == "Submit") { ProductController.InsertCategory(catname, description, image); } else { int catid = int.Parse(lblCatID.Text); ProductController.UpdateCategory(catid,catname, description, image); } BindList(); panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } protected void dlCategory_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Edit") { lblNewCAtegoryHeader.Text = "Update Category"; DataSet ds = ProductController.GetAllCategoriesBYCategoryID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblCatID.Text = e.CommandArgument.ToString(); txtCategoryName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); txtCatDescriptrion.Text = ds.Tables[0].Rows[0]["Description"].ToString(); imgCatLogo.ImageUrl = String.Format("~/Browse/Images/{0}", ds.Tables[0].Rows[0]["Image"].ToString()); IbtnCatSubmit.AlternateText = "Update"; panelCategoryTop.Visible = false; panelNewCategory.Visible = true; } } if (e.CommandName == "Delete") { lblCatID.Text = e.CommandArgument.ToString(); int catid = int.Parse(lblCatID.Text); //Response.Write(catid); ProductController.DeleteCategory(catid); BindList(); } } protected void IBtnCatCancel_Click(object sender, ImageClickEventArgs e) { panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } }
c. adminProduct i. frmproductList.aspx
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master" CodeFile="frmProductList.aspx.cs" Inherits="AdminProduct_frmProductList" %> <%@ Register Src="ucProductList.ascx" TagName="ucProductList" TagPrefix="uc1" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc1:ucProductList ID="UcProductList1" runat="server" /> </div> </asp:Content> ii. ucProductList.ascx