Skip to content

Commit

Permalink
Logout & Re-Login Feature Added
Browse files Browse the repository at this point in the history
  • Loading branch information
RubaiyadNoorShahriar1999 committed Dec 28, 2022
1 parent b2d1a2d commit c8df49a
Show file tree
Hide file tree
Showing 24 changed files with 438 additions and 366 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified AttendanceSystem/.vs/AttendanceSystem/v17/.futdcache.v2
Binary file not shown.
Binary file modified AttendanceSystem/.vs/AttendanceSystem/v17/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
103 changes: 103 additions & 0 deletions AttendanceSystem/AttendanceSystem/Bootstrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using AttendanceSystem.HomePages;
using AttendanceSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AttendanceSystem
{
public class Bootstrap
{
private static readonly AttendanceSystemDbContext db = new AttendanceSystemDbContext();
public static void ApplicationStart()
{
while (true)
{
int choice = 0;
string userName = "";
string password = "";

Console.Write("Options: ");
Console.Write("\n1. Admin Login\n2. Teacher Login\n3. Student Login\nEnter option: ");
choice = int.Parse(Console.ReadLine());

switch (choice)
{
case 1:
Console.WriteLine();
Console.Write("\nEnter User Name: ");
userName = Console.ReadLine();
Console.Write("Enter Password: ");
password = Console.ReadLine();

if (userName != string.Empty && password != string.Empty)
{
Admin a1 = Bootstrap.db.Admins.Where(x => x.UserName == userName && x.Password == password).FirstOrDefault();
if (a1 != null)
AdminPage.AdminOption(a1);
else
Console.WriteLine("Wrong Username and Password");
}
else
{
Console.WriteLine("Input can not be empty. Please enter a valid Username & Password");
}

break;

case 2:
Console.WriteLine();
Console.Write("\nEnter User Name: ");
userName = Console.ReadLine();
Console.Write("Enter Password: ");
password = Console.ReadLine();

if (userName != string.Empty && password != string.Empty)
{
Teacher a1 = Bootstrap.db.Teachers.Where(x => x.UserName == userName && x.Password == password).FirstOrDefault();
if (a1 != null)
TeacherPage.TeacherOption(a1);
else
Console.WriteLine("Wrong Username and Password");
}
else
{
Console.WriteLine("Input can not be empty. Please enter a valid Username & Password");
}

break;

case 3:
Console.WriteLine();
Console.Write("\nEnter User Name: ");
userName = Console.ReadLine();
Console.Write("Enter Password: ");
password = Console.ReadLine();

if (userName != string.Empty && password != string.Empty)
{
Student s1 = Bootstrap.db.Students.Where(x => x.UserName == userName && x.Password == password).FirstOrDefault();
if (s1 != null)
StudentPage.StudentOption(s1);
else
Console.WriteLine("Wrong Username and Password");
}
else
{
Console.WriteLine("Input can not be empty. Please enter a valid Username & Password");
}

break;

default:
Console.WriteLine("Invalid Input!!");
Console.WriteLine();
break;
}
}

}
}
}
Loading

0 comments on commit c8df49a

Please sign in to comment.