Consider the database development project developed during previous semester. A complete database design and development was carried out in previous semester project as detailed in your project report in printed form.
In addition during one of previous labs (see reference below) you were required to develop web interfaces on paper and then develop html prototypes for various functionalities of your database project mentioned as above.
Now the next task is to transform paper based and html based prototype interfaces into full scale working web forms for realization of various functionalities of your project. Ideally you are required to develop all web forms for implementing various project functionalities.
Reference: Lab 3 Q1) Consider the project database designed and implemented during previous semester i.e. Fall 2024. Its implementation was done using structured query language during previous semester. Try to recall major relations in your project database. You already have its report in printed form.
There is a need to implement a web based solution for above mentioned database. The web based solution must incorporate various functionalities of your project.
As a first step design above mentioned (i) to (v) user interfaces using paper and pencil.
Next write appropriate html for creating (i) to (v) user interface prototypes.
Create links for navigation among above pages.
Design a menu using list and styles.
Add help pages for user guidance.
Either use table for layout or may opt for flow based layout.
Test user interface prototypes in browser.
Experiment with style sheets.
You are strictly advised to refrain from using any AI tool during lab work. (0 score will be given for any such effort). Just follow codes as listed in book or as demonstrated in class from time to time.
Q1) Write code (code behind only) for any two of the interfaces below?
Q2) Draw corresponding graphical user interface as rendered in browser?
Homepage Code Behind File
Partial Class _Default
Inherits System.Web.UI.Page
End Class

Homepage Default.aspx File
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Home - Default.aspx</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Welcome to Software Subscription Homepage</h2>
<a href="CustomerRegistration.aspx">Customer Registration</a><br />
<a href="SoftwarePlans.aspx">Software Plans</a>
</div>
</form>
</body>
</html>
Customer Registration Code Behind File
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Partial Class CustomerRegistration
Inherits Page
Protected Sub btnRegister_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRegister.Click
Dim cons As String = "workstation id=zoyazahradb.mssql.somee.com;packet size=4096;user id=ZoyaZahra_SQLLogin_1;pwd=fjlk3wtfa3;data source=zoyazahradb.mssql.somee.com;persist security info=False;initial catalog=zoyazahradb;TrustServerCertificate=True"
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand()
cmd.Connection = con
' Step 1: Get latest customer ID
Dim latestId As String = ""
Dim newId As String = ""
Try
con.Open()
cmd.CommandText = "INSERT INTO Customer (Customer_Id, Email, Name, Cell_NO, Country) " &
"VALUES (@Customer_Id, @Email, @Name, @Cell_NO, @Country)"
cmd.Parameters.Clear()
cmd.Parameters.AddWithValue("@Customer_Id", txtCustomerId.Text)
cmd.Parameters.AddWithValue("@Email", txtEmail.Text)
cmd.Parameters.AddWithValue("@Name", txtName.Text)
cmd.Parameters.AddWithValue("@Cell_NO", txtCellNo.Text)
cmd.Parameters.AddWithValue("@Country", txtCountry.Text)
cmd.ExecuteNonQuery()
lblMessage.Text = "Registration successful! Customer ID: " & newId
Catch ex As Exception
lblMessage.Text = "Error: " & ex.Message
Finally
con.Close()
End Try
End Sub
Protected Sub btnSeeAllCustomers_Click(sender As Object, e As EventArgs) Handles btnSeeAllCustomers.Click
Dim cons As String
cons = "workstation id=zoyazahradb.mssql.somee.com;packet size=4096;user id=ZoyaZahra_SQLLogin_1;pwd=fjlk3wtfa3;data source=zoyazahradb.mssql.somee.com;persist security info=False;initial catalog=zoyazahradb;TrustServerCertificate=True"
' Create and open the connection
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "SELECT Customer_id, Email, Name, Cell_NO, Country From Customer"
' Declare the DataReader
Dim dr As SqlDataReader
Try
' Open the connection
con.Open()
' Execute the query
dr = cmd.ExecuteReader()
' Read and display the data
' Start the table
Response.Write("<table border='1'>")
Response.Write("<tr><th>Customer ID</th><th>Name</th><th>Email</th><th>Cell No</th><th>Country</th></tr>")
' Loop through the data
While (dr.Read())
Response.Write("<tr>")
Response.Write("<td>" & dr("Customer_Id") & "</td>")
Response.Write("<td>" & dr("Name") & "</td>")
Response.Write("<td>" & dr("Email") & "</td>")
Response.Write("<td>" & dr("Cell_NO") & "</td>")
Response.Write("<td>" & dr("Country") & "</td>")
Response.Write("</tr>")
End While
' End the table
Response.Write("</table>")
Catch ex As Exception
' Display error message in case of an issue
Response.Write("An error occurred: " & ex.Message)
Finally
' Cleanup
If Not dr Is Nothing Then
dr.Close()
End If
con.Close()
cmd.Dispose()
End Try
End Sub
Protected Sub btnDeleteCustomer_Click(sender As Object, e As EventArgs) Handles btnDeleteCustomer.Click
Dim cons As String = "workstation id=zoyazahradb.mssql.somee.com;packet size=4096;user id=ZoyaZahra_SQLLogin_1;pwd=fjlk3wtfa3;data source=zoyazahradb.mssql.somee.com;persist security info=False;initial catalog=zoyazahradb;TrustServerCertificate=True"
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand()
cmd.Connection = con
' Step 1: Get latest customer ID
Dim latestId As String = ""
Dim newId As String = ""
Try
con.Open()
cmd.CommandText = "Delete from customer where customer_id = @Customer_Id "
cmd.Parameters.Clear()
cmd.Parameters.AddWithValue("@Customer_Id", txtDeleteCustomer.Text)
Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
If rowsAffected > 0 Then
lblDeleteCustomer.Text = "Deletion successful! Customer ID: " & txtDeleteCustomer.Text
Else
lblDeleteCustomer.Text = "No customer found with ID: " & txtDeleteCustomer.Text
End If
Catch ex As Exception
lblMessage.Text = "Error: " & ex.Message
Finally
con.Close()
End Try
End Sub
End Class
Customer Registration .aspx File
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="CustomerRegistration.aspx.vb" Inherits="CustomerRegistration" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Customer Registration</title>
</head>
<body>
<form id="form1" runat="server">
<h2 style="width: 370px">Customer Registration</h2>
<div class="form-group">
<label>Customer ID (eg C020):<br /></label>
<asp:TextBox ID="txtCustomerId" runat="server"></asp:TextBox>
<br /><br />
</div>
<div class="form-group">
<label>Name:</label><br />
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br /><br />
</div>
<div class="form-group">
<label>Email:<br /></label>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<br /><br />
</div>
<div class="form-group">
<label>Cell No:<br /></label>
<asp:TextBox ID="txtCellNo" runat="server"></asp:TextBox>
<br /><br />
</div>
<div class="form-group">
<label>Country Code (2 Letters):<br /></label>
<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>
<br /><br />
</div>
<asp:Button ID="btnRegister" runat="server" Text="Register" />
<br />
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<br /><br /><br />
<asp:Label ID="lblDeleteCustomer" runat="server" Text="Enter Customer Id: "></asp:Label>
<br />
<asp:TextBox ID="txtDeleteCustomer" runat="server"></asp:TextBox>
<br /><br />
<asp:Button ID="btnDeleteCustomer" runat="server" Text="Delete Customer" />
<br /><br />
<asp:Button ID="btnSeeAllCustomers" runat="server" Text="See all customers in Database" />
<br />
</form>
</body>
</html>

Search Products Code Behind File
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Partial Class SoftwarePlans
Inherits Page
Dim cons As String = "workstation id=zoyazahradb.mssql.somee.com;packet size=4096;user id=ZoyaZahra_SQLLogin_1;pwd=fjlk3wtfa3;data source=zoyazahradb.mssql.somee.com;persist security info=False;initial catalog=zoyazahradb;TrustServerCertificate=True"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
LoadUniqueProducts()
End If
End Sub
Private Sub LoadUniqueProducts()
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand("SELECT DISTINCT Software_Name FROM Software_Plan", con)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
con.Open()
da.Fill(dt)
con.Close()
rptProducts.DataSource = dt
rptProducts.DataBind()
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs)
SearchAndDisplay(txtSearch.Text.Trim())
End Sub
Protected Sub Product_Click(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim selectedProduct As String = e.CommandArgument.ToString()
SearchAndDisplay(selectedProduct)
End Sub
Private Sub SearchAndDisplay(ByVal productName As String)
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand("SELECT * FROM Software_Plan WHERE Software_Name = @SoftwareName", con)
cmd.Parameters.AddWithValue("@SoftwareName", productName)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
con.Open()
da.Fill(dt)
con.Close()
If dt.Rows.Count > 0 Then
GridView1.DataSource = dt
GridView1.DataBind()
lblMessage.Text = ""
Else
GridView1.DataSource = Nothing
GridView1.DataBind()
lblMessage.Text = "Product not available."
End If
End Sub
End Class
Search Products .aspx File
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="SoftwarePlans.aspx.vb" Inherits="SoftwarePlans" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Software Plans</title>
<style>
body {
font-family: Arial;
display: flex;
margin: 0;
}
.sidebar {
width: 200px;
background-color: #f2f2f2;
padding: 20px;
height: 100vh;
overflow-y: auto;
}
.sidebar h3 {
margin-top: 0;
}
.sidebar a {
display: block;
margin-bottom: 10px;
color: blue;
text-decoration: underline;
cursor: pointer;
}
.main {
padding: 20px;
flex-grow: 1;
}
.form-group {
margin-bottom: 15px;
}
table {
border-collapse: collapse;
width: 100%;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
#lblMessage {
color: red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="display: flex; min-height: 100vh;">
<!-- Sidebar -->
<div class="sidebar">
<h3>Available Products</h3>
<asp:Repeater ID="rptProducts" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkProduct" runat="server" Text='<%# Eval("Software_Name") %>' CommandArgument='<%# Eval("Software_Name") %>' OnCommand="Product_Click" />
</ItemTemplate>
</asp:Repeater>
</div>
<div class="main">
<h2>Search Product</h2>
<div class="form-group">
<label>Enter Software Name:</label>
<asp:TextBox ID="txtSearch" runat="server" />
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
</div>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="True" />
</div>
</div>
</form>
</body>
</html>
