0% found this document useful (0 votes)
5 views

Software Dev Project

The document outlines the development of a 'University Result Auto Authentication & Publish' project, detailing its three main components: front end, back end, and database. It describes the process of collecting, approving, and publishing student results using ASP.NET Core, SQL Server, and web technologies like HTML, CSS, and JavaScript. The document includes step-by-step implementation instructions and code snippets for setting up the system and its functionalities.

Uploaded by

Brilliant
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Software Dev Project

The document outlines the development of a 'University Result Auto Authentication & Publish' project, detailing its three main components: front end, back end, and database. It describes the process of collecting, approving, and publishing student results using ASP.NET Core, SQL Server, and web technologies like HTML, CSS, and JavaScript. The document includes step-by-step implementation instructions and code snippets for setting up the system and its functionalities.

Uploaded by

Brilliant
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

To start and complete the "University Result Auto Authentication & Publish" project, we need to

break it down into three main components: front end, back end, and database. I’ll provide a
detailed plan and sample code snippets to guide you through the implementation.

Project Overview
The project involves the following steps:

Data Collection: Course teachers collect student semester results in an Excel sheet.
Approval by Dean: Dean approves the results via the admin portal.
Result Upload: Approved results are sent to the IT department for upload (although our goal is to
eliminate this step).
Result Publication: Results are published on the result portal after validation.
Dean Recheck: The dean can recheck and publish or discard the results.
Front End
We'll use HTML, CSS, and JavaScript for the front end. The front end will consist of:

Login Page: For admin (Dean) to log in.


Admin Dashboard: For the dean to approve, recheck, or discard results.
Result Upload Form: For the teacher to upload the Excel sheet.
Result Portal: Where students can view their results.
Back End
We'll use C# and ASP.NET for the back end. The back end will handle:

Authentication: Ensuring only authorized personnel can access the system.


Data Processing: Handling Excel file uploads and parsing the data.
Result Management: CRUD operations for managing results.
Database
We'll use SQL Server for the database. The database will store:

User Data: Information about admins (Dean), teachers, and students.


Results Data: The uploaded student results.
Logs: Actions performed by the dean and other users for audit purposes.
Step-by-Step Implementation
1. Setting Up the Database
Database Schema:

CREATE TABLE Users (

UserId INT PRIMARY KEY IDENTITY,

UserName NVARCHAR(50),

Password NVARCHAR(50),

Role NVARCHAR(20)

);
CREATE TABLE Results (

ResultId INT PRIMARY KEY IDENTITY,

StudentId NVARCHAR(50),

CourseId NVARCHAR(50),

Marks INT,

Status NVARCHAR(20) DEFAULT 'Pending'

);

CREATE TABLE AuditLogs (

LogId INT PRIMARY KEY IDENTITY,

UserId INT,

Action NVARCHAR(100),

Timestamp DATETIME DEFAULT GETDATE()

);

2. Back End: ASP.NET Core API


Setup ASP.NET Core Project:

dotnet new webapi -n UniversityResultSystem

cd UniversityResultSystem

Install Required Packages:

dotnet add package Microsoft.EntityFrameworkCore.SqlServer

dotnet add package Microsoft.EntityFrameworkCore.Tools

dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore

Configure Database Context:


// Models/User.cs

public class User {

public int UserId { get; set; }

public string UserName { get; set; }

public string Password { get; set; }

public string Role { get; set; }

// Models/Result.cs

public class Result {

public int ResultId { get; set; }

public string StudentId { get; set; }

public string CourseId { get; set; }

public int Marks { get; set; }

public string Status { get; set; }

// Models/AuditLog.cs

public class AuditLog {

public int LogId { get; set; }

public int UserId { get; set; }

public string Action { get; set; }

public DateTime Timestamp { get; set; }

// Data/ApplicationDbContext.cs

public class ApplicationDbContext : DbContext {

public DbSet<User> Users { get; set; }

public DbSet<Result> Results { get; set; }


public DbSet<AuditLog> AuditLogs { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {

optionsBuilder.UseSqlServer("YourConnectionStringHere");

Create the Migration and Update Database:

Sh:

dotnet ef migrations add InitialCreate

dotnet ef database update

API Controllers: C#

// Controllers/AuthController.cs
[ApiController]
[Route("api/[controller]")]
public class AuthController : ControllerBase {
private readonly ApplicationDbContext _context;

public AuthController(ApplicationDbContext context) {


_context = context;
}

[HttpPost("login")]
public IActionResult Login([FromBody] LoginRequest request) {
var user = _context.Users.SingleOrDefault(u => u.UserName ==
request.UserName && u.Password == request.Password);
if (user == null) {
return Unauthorized();
}
return Ok(new { token = "fake-jwt-token", userId = user.UserId, role =
user.Role });
}
}

public class LoginRequest {


public string UserName { get; set; }
public string Password { get; set; }
}

// Controllers/ResultsController.cs
[ApiController]
[Route("api/[controller]")]
public class ResultsController : ControllerBase {
private readonly ApplicationDbContext _context;

public ResultsController(ApplicationDbContext context) {


_context = context;
}

[HttpPost("upload")]
public IActionResult UploadResults([FromBody] List<Result> results) {
_context.Results.AddRange(results);
_context.SaveChanges();
return Ok();
}

[HttpGet("pending")]
public IActionResult GetPendingResults() {
var pendingResults = _context.Results.Where(r => r.Status ==
"Pending").ToList();
return Ok(pendingResults);
}

[HttpPost("approve")]
public IActionResult ApproveResult([FromBody] int resultId) {
var result = _context.Results.SingleOrDefault(r => r.ResultId == resultId);
if (result == null) {
return NotFound();
}
result.Status = "Approved";
_context.SaveChanges();
return Ok();
}

[HttpPost("discard")]
public IActionResult DiscardResult([FromBody] int resultId) {
var result = _context.Results.SingleOrDefault(r => r.ResultId == resultId);
if (result == null) {
return NotFound();
}
result.Status = "Discarded";
_context.SaveChanges();
return Ok();
}
}

3. Front End: HTML, CSS, and JavaScript

Login Page:
<!-- login.html -->
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h2>Login</h2>
<form id="loginForm">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Login</button>
</form>

<script>
document.getElementById('loginForm').addEventListener('submit',
function(event) {
event.preventDefault();
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;

fetch('api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userName: username, password: password })
})
.then(response => response.json())
.then(data => {
if (data.token) {
localStorage.setItem('token', data.token);
window.location.href = 'admin.html';
} else {
alert('Invalid credentials');
}
});
});
</script>
</body>
</html>

Admin Dashboard:

<!-- admin.html -->


<!DOCTYPE html>
<html>
<head>
<title>Admin Dashboard</title>
</head>
<body>
<h2>Admin Dashboard</h2>
<button onclick="fetchPendingResults()">Fetch Pending Results</button>
<div id="results"></div>

<script>
function fetchPendingResults() {
fetch('api/results/pending', {
headers: { 'Authorization': 'Bearer ' + localStorage.getItem('token') }
})
.then(response => response.json())
.then(data => {
var resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = '';
data.forEach(result => {
resultsDiv.innerHTML += `<div>
<p>Student ID: ${result.studentId}, Course ID: ${result.courseId},
Marks: ${result.marks}</p>
<button
onclick="approveResult(${result.resultId})">Approve</button>
<button
onclick="discardResult(${result.resultId})">Discard</button>
</div>`;
});
});
}

function approveResult(resultId) {
fetch('api/results/approve', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' +
localStorage.getItem('token') },
body: JSON.stringify(resultId)
})
.then(response => response.json())
.then(data => {
alert('Result approved');
fetchPendingResults();
});
}

function discardResult(resultId) {
fetch('api/results/discard', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' +
localStorage.getItem('token') },
body: JSON.stringify(resultId)
})
.then(response => response.json())
.then(data => {
alert('Result discarded');
fetchPendingResults();
});
}
</script>
</body>
</html>

Summary
This project involves setting up a web application where university results
can be uploaded, approved, and published by authorized personnel (Dean).
The project uses ASP.NET Core for the back end, SQL Server for the
database, and HTML, CSS, and JavaScript for the front end.

By following the steps and code snippets provided, you can develop a
functional "University Result Auto Authentication & Publish" system. Make
sure to test each component thoroughly to ensure the application meets the
requirements and works as expected.

You might also like