Final Project
ESOFT METRO CAMPUS
Shaping Lives, Creating Futures.
Contents
Introduction .............................................................................................................................. 14
•
Visual studio ................................................................................................................ 14
•
SQL Database Management System ............................................................................ 15
System Screenshots .................................................................................................................. 16
1.
Login Page ................................................................................................................... 16
2.
Login form C# Code .................................................................................................... 17
3.
Registration form ......................................................................................................... 21
4.
Registration form C# Code .......................................................................................... 22
5.
Register button ............................................................................................................. 30
6.
Update button. .............................................................................................................. 31
7.
Delete button. ............................................................................................................... 32
8.
Find function. ............................................................................................................... 33
9.
Exit function................................................................................................................. 34
10.
Logout ...................................................................................................................... 34
11.
Tables design ........................................................................................................... 35
12.
Login code ............................................................................................................... 35
13.
Registration table code ............................................................................................. 36
Conclusion ............................................................................................................................... 37
•
System advantages ....................................................................................................... 37
•
future improvements .................................................................................................... 37
All rights reserved © ESOFT Metro Campus
11
References ................................................................................................................................ 38
Figure 1 visual studio. .............................................................................................................. 14
Figure 2SQL Server Management Studio ................................................................................ 15
Figure 3Login Page .................................................................................................................. 16
Figure 4 Login Page Code (1/3)............................................................................................... 17
Figure 5 Login Page Code (2/3)............................................................................................... 18
Figure 6 Login Page Code (3/3)............................................................................................... 19
Figure 7 Login Successful Message. ....................................................................................... 20
Figure 8 incorrect Login Message ........................................................................................... 20
Figure 9 Registration form. ...................................................................................................... 21
Figure 10 Registration form C# Code (1/8) ............................................................................. 22
Figure 11 Registration form C# Code (2/8) ............................................................................. 23
Figure 12 Registration form C# Code (3/8) ............................................................................. 24
Figure 13 Registration form C# Code (4/8) ............................................................................. 25
Figure 14 Registration form C# Code (5/8) ............................................................................ 26
Figure 15 Registration form C# Code (6/8) ............................................................................. 27
Figure 16 Registration form C# Code (7/8) ............................................................................ 28
Figure 17 Registration form C# Code (8/8) ............................................................................. 29
Figure 18 Before Register button. ............................................................................................ 30
Figure 19 After Register button. .............................................................................................. 30
Figure 20 Before Update Button. ............................................................................................. 31
Figure 21 After Update Button. ............................................................................................... 31
Figure 22 Before Delete Button ............................................................................................... 32
Figure 23 After Delete Button ................................................................................................. 32
All rights reserved © ESOFT Metro Campus
12
Figure 24 Find function. .......................................................................................................... 33
Figure 25 After clicking find function. .................................................................................... 33
Figure 26 Exit function. ........................................................................................................... 34
Figure 27 Logout function ....................................................................................................... 34
Figure 28 SQL Tablet Design .................................................................................................. 35
Figure 29 SQL login code ........................................................................................................ 35
Figure 30 SQL Registration Form Code .................................................................................. 36
All rights reserved © ESOFT Metro Campus
13
Introduction
This is a Skills International School, and they sought to enhance their operations by developing
a comprehensive database system. Hence, we are undertaking the task of creating this database
system to meet their needs.
In this database project, we are utilizing Visual Studio alongside an SQL Database
Management System.
• Visual studio
Figure 1 visual studio.
Visual Studio is an integrated development environment (IDE) created by Microsoft. It is used
for developing applications, websites, web services, and mobile apps. Visual Studio supports
a wide range of programming languages, including C#, VB.NET, C++, Python, and JavaScript,
among others. It provides a comprehensive suite of tools and features that facilitate coding,
debugging, and deploying software.
All rights reserved © ESOFT Metro Campus
14
• SQL Database Management System
Figure 2SQL Server Management Studio
An SQL Database Management System (DBMS) is a software application that uses Structured
Query Language (SQL) to manage and manipulate relational databases. SQL is the standard
language for querying and managing data in a relational database, which organizes data into
tables with rows and columns.
All rights reserved © ESOFT Metro Campus
15
System Screenshots
1. Login Page
The login function operates successfully upon the provision of a valid username and password.
Figure 3Login Page
All rights reserved © ESOFT Metro Campus
16
2. Login form C# Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace login_page_03
{
public partial class Form1 : Form
{
private const string connectionString = "Data
Source=ASFAK\\SQLEXPRESS;Initial Catalog=loginDB;Integrated Security=True";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string username = textBox1.Text;
string password = textBox2.Text;
if (string.IsNullOrEmpty(username) ||
string.IsNullOrEmpty(password))
{
MessageBox.Show("Please enter both username and password.",
"Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
string query = "SELECT COUNT(*) FROM logintbl WHERE Uname =
@Username AND UPass = @Password";
using (SqlConnection connection = new
SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@Username", username);
command.Parameters.AddWithValue("@Password", password);
Figure 4 Login Page Code (1/3)
All rights reserved © ESOFT Metro Campus
17
try
{
connection.Open();
int count = (int)command.ExecuteScalar();
if (count > 0)
{
MessageBox.Show("Login successful",
"Login",MessageBoxButtons.OK,MessageBoxIcon.Information);
Form2 x = new Form2();
x.Show();
this.Hide();
}
else
{
MessageBox.Show("Invalid Login credentials, please
check Username and Password and try again", "Invalid login
Details",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
Figure 5 Login Page Code (2/3)
All rights reserved © ESOFT Metro Campus
18
private void button3_Click(object sender, EventArgs e)
{
{
if (MessageBox.Show("Are you sure,Do you really want to
Exit...?", "Exit", MessageBoxButtons.YesNo,
MessageBoxIcon.Question
) == DialogResult.Yes)
{
Application.Exit();
}
}
}
}
}
Figure 6 Login Page Code (3/3)
All rights reserved © ESOFT Metro Campus
19
After giving correct username and password
Figure 7 Login Successful Message.
If an incorrect username or password is provided 🔳
Figure 8 incorrect Login Message
All rights reserved © ESOFT Metro Campus
20
3. Registration form
Upon entering your correct username and password, you will be redirected to the registration
form.
Figure 9 Registration form.
All rights reserved © ESOFT Metro Campus
21
4. Registration form C# Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace login_page_03
{
public partial class Form2 : Form
{
SqlConnection mycon = new SqlConnection("Data
Source=ASFAK\\SQLEXPRESS;Initial Catalog=loginDB;Integrated
Security=True");
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int regNo = int.Parse(RegNoBox.Text);
string fn = FirstNameBox.Text;
string ln = LastNameBox.Text;
string dob = DOBPicker.Value.ToString("yyyy-MM-dd");
string gender = "";
if (MaleRadio.Checked)
{
gender = "Male";
}
else
{
gender = "Female";
}
Figure 10 Registration form C# Code (1/8)
All rights reserved © ESOFT Metro Campus
22
string address = AddressBox.Text;
string email = EmailBox.Text;
string mobile = MobileBox.Text;
string home = HomeBox.Text;
string parentName = ParentNameBox.Text;
string NIC = NICBox.Text;
string contact = ContactBox.Text;
string query = "INSERT INTO Registration VALUES('" + regNo
+ "','" + fn + "','" + ln + "','" + dob + "','" + gender + "','" + address
+ "','" + email + "','" + mobile + "','" + home + "','" + parentName +
"','" + NIC + "','" + contact + "')";
try
{
mycon.Open();
SqlCommand cmd = new SqlCommand(query, mycon);
cmd.ExecuteNonQuery();
MessageBox.Show("Record Added Succesfully", "Register
Student", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
mycon.Close();
}
Figure 11 Registration form C# Code (2/8)
}
All rights reserved © ESOFT Metro Campus
23
private void RegNoBox_SelectedIndexChanged(object sender, EventArgs e)
{
string no = RegNoBox.Text;
if (no != "New Register")
{
mycon.Open();
string query_select = "SELECT * FROM Registration WHERE
reg_ID=" + no;
SqlCommand cmd = new SqlCommand(query_select, mycon);
SqlDataReader row = cmd.ExecuteReader();
while (row.Read())
{
FirstNameBox.Text = row[1].ToString();
LastNameBox.Text = row[2].ToString();
DOBPicker.Format = DateTimePickerFormat.Custom;
DOBPicker.CustomFormat = "yyyy/MM/dd";
string dateString = row[3].ToString();
DateTime dobDate;
if (DateTime.TryParse(dateString, out dobDate))
{
DOBPicker.Value = dobDate;
}
if (row[4].ToString() == "Male")
{
MaleRadio.Checked = true;
FemaleRadio.Checked = false;
}
else
{
MaleRadio.Checked = false;
FemaleRadio.Checked = true;
}
AddressBox.Text = row[5].ToString();
EmailBox.Text = row[6].ToString();
MobileBox.Text = row[7].ToString();
HomeBox.Text = row[8].ToString();
ParentNameBox.Text = row[9].ToString();
NICBox.Text = row[10].ToString();
ContactBox.Text = row[11].ToString();
}
mycon.Close();
Button1.Enabled = false;
button2.Enabled = true;
button3.Enabled = true;
}
Figure 12 Registration form C# Code (3/8)
All rights reserved © ESOFT Metro Campus
24
else
{
FirstNameBox.Text = "";
LastNameBox.Text = "";
DOBPicker.Format = DateTimePickerFormat.Custom;
DOBPicker.CustomFormat = "yyyy/MM/dd";
DateTime thisDay = DateTime.Today;
DOBPicker.Text = thisDay.ToString();
MaleRadio.Checked = true;
FemaleRadio.Checked = false;
AddressBox.Text = "";
EmailBox.Text = "";
MobileBox.Text = "";
HomeBox.Text = "";
ParentNameBox.Text = "";
NICBox.Text = "";
ContactBox.Text = "";
Button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
}
}
private void button2_Click(object sender, EventArgs e)
{
{
int regNo = int.Parse(RegNoBox.Text);
string fn = FirstNameBox.Text;
string ln = LastNameBox.Text;
string dob = DOBPicker.Value.ToString("yyyy-MM-dd");
string gender = "";
if (MaleRadio.Checked)
{
gender = "Male";
}
else
{
gender = "Female";
}
Figure 13 Registration form C# Code (4/8)
All rights reserved © ESOFT Metro Campus
25
string address = AddressBox.Text;
string email = EmailBox.Text;
string mobile = MobileBox.Text;
string home = HomeBox.Text;
string parentName = ParentNameBox.Text;
string NIC = NICBox.Text;
string contact = ContactBox.Text;
string query = "UPDATE Registration SET first_Name = '" +
fn + "'," +
"Last_Name = '" + ln + "', DOB = '" + dob + "',Gender =
'" + gender + "', Caddress = '" + address + "'," +
"Cemail = '" + email + "', Telnum = " + mobile + ",
Hnum = '" + home + "', " +
"PName = '" + parentName + "',Nic = '" + NIC + "',
contac = '" + contact + "' WHERE reg_ID = " + regNo;
try
{
mycon.Open();
SqlCommand cmd = new SqlCommand(query, mycon);
cmd.ExecuteNonQuery();
MessageBox.Show("Record Added Succesfully", "Update
Student",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
mycon.Close();
}
}
}
Figure 14 Registration form C# Code (5/8)
All rights reserved © ESOFT Metro Campus
26
private void button3_Click(object sender, EventArgs e)
{
{
RegNoBox.Text = "";
FirstNameBox.Text = "";
LastNameBox.Text = "";
DOBPicker.Value = DateTime.Now;
MaleRadio.Select();
AddressBox.Text = "";
EmailBox.Text = "";
MobileBox.Text = "";
HomeBox.Text = "";
ParentNameBox.Text = "";
NICBox.Text = "";
ContactBox.Text = "";
RegNoBox.Focus();
}
}
private void button4_Click(object sender, EventArgs e)
{
{
string query = "DELETE FROM Registration WHERE reg_ID = " +
RegNoBox.Text;
if (MessageBox.Show("Are you sure, do you really want to
Delete this Record...?", "delete", MessageBoxButtons.YesNo,
MessageBoxIcon.Question
) == DialogResult.Yes)
try
{
mycon.Open();
SqlCommand cmd = new SqlCommand(query, mycon);
cmd.ExecuteNonQuery();
mycon.Close();
MessageBox.Show("Record Deleted Succesfully",
"Delete Student");
this.Refresh();
}
Figure 15 Registration form C# Code (6/8)
All rights reserved © ESOFT Metro Campus
27
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
mycon.Close();
}
}
}
private void linkLabel2_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
{
if (MessageBox.Show("Are you sure, do you really want to
Exit...?", "Exit", MessageBoxButtons.YesNo,
MessageBoxIcon.Question
) == DialogResult.Yes)
{
Application.Exit();
}
}
}
private void Logout_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
{
Form1 f = new Form1();
f.Show();
this.Hide();
}
}
Figure 16 Registration form C# Code (7/8)
All rights reserved © ESOFT Metro Campus
28
private void ContactBox_TextChanged(object sender, EventArgs e)
{
}
private void Form2_Load(object sender, EventArgs e)
{
try
{
mycon.Open();
string query_select = "SELECT reg_ID FROM Registration";
SqlCommand cmd = new SqlCommand(query_select, mycon);
SqlDataReader reader = cmd.ExecuteReader();
RegNoBox.Items.Clear();
RegNoBox.Items.Add("New Register");
while (reader.Read())
{
RegNoBox.Items.Add(reader["reg_ID"].ToString());
}
RegNoBox.SelectedIndex = 0;
}
catch (SqlException ex)
{
MessageBox.Show("Error loading registration numbers: " +
ex.Message);
}
finally
{
mycon.Close();
}
}
private void button1_Click_1(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender,
EventArgs e)
{
}
}
}
Figure 17 Registration form C# Code (8/8)
All rights reserved © ESOFT Metro Campus
29
5. Register button
Before clicking register button 🔳
Figure 18 Before Register button.
After clicking register button 🔳
Figure 19 After Register button.
All rights reserved © ESOFT Metro Campus
30
6. Update button.
Before clicking update button 🔳
Figure 20 Before Update Button.
After clicking update button 🔳
Figure 21 After Update Button.
All rights reserved © ESOFT Metro Campus
31
7. Delete button.
Before clicking delete button 🔳
Figure 22 Before Delete Button
After clicking delete button 🔳
Figure 23 After Delete Button
All rights reserved © ESOFT Metro Campus
32
8. Find function.
find function 🔳
Figure 24 Find function.
After clicking 🔳
Figure 25 After clicking find function.
All rights reserved © ESOFT Metro Campus
33
9. Exit function.
When you click the exit button on the Registration Form, a message will appear asking, 'Are
you sure you really want to exit?' If you click 'YES,' the application will close. If you click
'NO,' the application will remain open.
Figure 26 Exit function.
10.Logout
If you click the logout button on the Registration Form, you will be redirected to the login page.
Figure 27 Logout function
All rights reserved © ESOFT Metro Campus
34
11.
Tables design
Figure 28 SQL Tablet Design
12.
Login code
Figure 29 SQL login code
All rights reserved © ESOFT Metro Campus
35
13.
Registration table code
Figure 30 SQL Registration Form Code
All rights reserved © ESOFT Metro Campus
36
Conclusion
• System advantages
1. Personalized Experience: Tailored settings and content for users.
2. Data Collection: Insights into user behavior for better decision-making.
3. Enhanced Security: Protects user information and content.
4. User Engagement: Encourages active participation and contributions.
5. Customer Retention: Enables loyalty programs and personalized marketing.
6. Restricted Content Access: Limits premium features to registered users.
7. Improved Communication: Direct messages and updates to users.
8. Fraud Reduction: Monitors and minimizes spam and abusive behavior.
9. Service Integration: Connects with social media, payments, and support.
10. User Accountability: Tracks user activities for a respectful community
• future improvements
1. Biometric Authentication: Fingerprint, facial recognition, or iris scanning.
2. Password less Login: Magic links, OTPs, or authentication apps.
3. SSO Expansion: Seamless access across multiple platforms.
4. Enhanced MFA: Advanced methods like hardware tokens or biometrics.
5. Behavior Analytics: Detecting anomalies and security threats.
6. Progressive Profiling: Incremental information collection.
7. Customizable Interfaces: Personalized themes and layouts.
8. AI Assistance: Chatbots for account and login support.
9. Decentralized Identity: Blockchain for data control.
10. Adaptive Authentication: Dynamic requirements based on risk.
All rights reserved © ESOFT Metro Campus
37
References
Takyar, A. (2024) Ai model security: A comprehensive overview, LeewayHertz. Available at:
https://www.leewayhertz.com/ai-model-security/ (Accessed: 22 May 2024).
Restrict (2024) RESTRICT - membership, site, content and user access restrictions for WordPress,
WordPress.org. Available at: https://wordpress.org/plugins/restricted-content/ (Accessed: 23 May
2024).
The 11 best C++ IDES (and code editors) for 2024 (no date) Educative. Available at:
https://www.educative.io/blog/best-cpp-ides-code-editors (Accessed: 23 May 2024).
Mullins, C.S. (2023) What is a DBMS? database management system definition, Data
Management. Available at:
https://www.techtarget.com/searchdatamanagement/definition/database-managementsystem (Accessed: 23 May 2024).
All rights reserved © ESOFT Metro Campus
38
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )