Restaurant Details Facility Project for IMAT5210 E-Commerce Software

Verified

Added on  2022/12/15

|5
|571
|245
Project
AI Summary
This document presents a comprehensive solution for the Restaurant Details Facility project, a core component of the IMAT5210 E-Commerce Software module. The student's work demonstrates a strong understanding of n-tier web application design and implementation. Key features include the integration of AJAX for dynamic user interface updates in forms like UserLogin, WaiterRegistration, and NewCuisine, enhancing user experience by reducing page reloads. The solution incorporates secure password storage using the MD5 algorithm, ensuring data security. The document provides detailed use cases, including displaying waiter lists, adding new cuisine details, and updating user profiles, along with corresponding sample code snippets demonstrating database interactions. The code interacts with a database to retrieve, insert, and update restaurant-related data. This assignment showcases practical application of web development principles, including data security, user interface design, and database management, all within the context of an e-commerce platform for restaurant management. The provided code examples demonstrate the application of fundamental web development principles in a practical context, offering valuable insights into building robust and user-friendly e-commerce applications.
Document Page
Applying AJAX
I have implemented the AJAX features in UserLogin, WaiterRegistration and NewCuisine form
Format of AJAX is,
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Form coding ...
</ContentTemplate>
</asp:UpdatePanel>
Without post back, it interacts with the database. This is the one of the main features of AJAX
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Securing Password Storage
In WaiterRegistration web page, I have added the encryption using md5 algorithm. It converts the
original string into 32 bit hexa decimal digits
private String encryptMD5(String upass)
{
MD5 md5 = new MD5CryptoServiceProvider();
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(upass));
byte[] hashByte = md5.Hash;
StringBuilder builderHash = new StringBuilder();
for (int i = 0; i < hashByte.Length; i++)
builderHash.Append(hashByte[i].ToString("x2"));
return builderHash.ToString();
}
Document Page
Use Cases
Use Case 1: Display Waiter List
Sample Code:
try
{
dbConnect = new DatabaseConnection();
String command = "SELECT UserID, UserName, RealName,
EmailAddress, RoleID, RestaurantID FROM RestaurantUser WHERE
RoleID=1";
DbDataReader dreader = dbConnect.ExecuteReader(command);
gView.DataSource = dreader;
gView.DataBind();
}
catch (Exception ex)
{
Server.Transfer("UserLogin.aspx");
}
Document Page
Use Case 2: New Cuisine Details
Sample Code:
try
{
dbConnect = new DatabaseConnection();
String cuisineRegion, cuisineName,command;
cuisineRegion = txtCuisineRegion.Text;
cuisineName = txtCuisineName.Text;
if (cuisineRegion.Trim().Length != 0)
{
if (cuisineName.Trim().Length != 0)
{
dbConnect = new DatabaseConnection();
command = "insert into Cuisine (CuisineRegion, CuisineName)
VALUES (@cregion, @cname)";
dbConnect.addParameter("@cregion", cuisineRegion);
dbConnect.addParameter("@cname", cuisineName);
DbDataReader dreader = dbConnect.ExecuteReader(command);
lblError.Text = "New Cuisine added successfully";
//Response.Redirect("UserAccount.aspx");
}
else
lblError.Text = "Cuisine Name should not be empty";
}
else
lblError.Text = "Cuisine Region should not be empty";
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Use Case 3: Update User Profile
After Login the user, you choose UpdateProfile link
try
{
dbConnect = new DatabaseConnection();
String userID, realName,email, command;
userID = Session["userID"].ToString();
realName = txtRealName.Text;
email = txtEmailAddress.Text;
command = "update RestaurantUser SET RealName=@rname,
EmailAddress=@email, RoleID=@roleID WHERE UserID=@userID";
dbConnect.addParameter("@rname", realName);
dbConnect.addParameter("@email", email);
dbConnect.addParameter("@roleID",
Int32.Parse(ddlRestaurants.SelectedValue));
dbConnect.addParameter("@userID", Int32.Parse(userID));
DbDataReader dreader = dbConnect.ExecuteReader(command);
lblError.Text = "Updated Successfully";
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]