asp.net/winforms login; uml managers, repositories pages edited
This commit is contained in:
117
StudentHouseDashboard/WinForms/Login.Designer.cs
generated
Normal file
117
StudentHouseDashboard/WinForms/Login.Designer.cs
generated
Normal file
@@ -0,0 +1,117 @@
|
||||
namespace WinForms
|
||||
{
|
||||
partial class Login
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
lblLogo = new Label();
|
||||
lblUsername = new Label();
|
||||
tbUsername = new TextBox();
|
||||
lblPassword = new Label();
|
||||
tbPassword = new TextBox();
|
||||
btnLogin = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblLogo
|
||||
//
|
||||
lblLogo.Location = new Point(12, 9);
|
||||
lblLogo.Name = "lblLogo";
|
||||
lblLogo.Size = new Size(230, 37);
|
||||
lblLogo.TabIndex = 0;
|
||||
lblLogo.Text = "Welcome to Student House Dashboard";
|
||||
lblLogo.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblUsername
|
||||
//
|
||||
lblUsername.AutoSize = true;
|
||||
lblUsername.Location = new Point(12, 64);
|
||||
lblUsername.Name = "lblUsername";
|
||||
lblUsername.Size = new Size(63, 15);
|
||||
lblUsername.TabIndex = 1;
|
||||
lblUsername.Text = "Username:";
|
||||
//
|
||||
// tbUsername
|
||||
//
|
||||
tbUsername.Location = new Point(81, 61);
|
||||
tbUsername.Name = "tbUsername";
|
||||
tbUsername.Size = new Size(161, 23);
|
||||
tbUsername.TabIndex = 2;
|
||||
//
|
||||
// lblPassword
|
||||
//
|
||||
lblPassword.AutoSize = true;
|
||||
lblPassword.Location = new Point(12, 93);
|
||||
lblPassword.Name = "lblPassword";
|
||||
lblPassword.Size = new Size(60, 15);
|
||||
lblPassword.TabIndex = 3;
|
||||
lblPassword.Text = "Password:";
|
||||
//
|
||||
// tbPassword
|
||||
//
|
||||
tbPassword.Location = new Point(81, 90);
|
||||
tbPassword.Name = "tbPassword";
|
||||
tbPassword.Size = new Size(161, 23);
|
||||
tbPassword.TabIndex = 4;
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
btnLogin.Location = new Point(167, 119);
|
||||
btnLogin.Name = "btnLogin";
|
||||
btnLogin.Size = new Size(75, 23);
|
||||
btnLogin.TabIndex = 5;
|
||||
btnLogin.Text = "Login";
|
||||
btnLogin.UseVisualStyleBackColor = true;
|
||||
btnLogin.Click += btnLogin_Click;
|
||||
//
|
||||
// Login
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(266, 163);
|
||||
Controls.Add(btnLogin);
|
||||
Controls.Add(tbPassword);
|
||||
Controls.Add(lblPassword);
|
||||
Controls.Add(tbUsername);
|
||||
Controls.Add(lblUsername);
|
||||
Controls.Add(lblLogo);
|
||||
Name = "Login";
|
||||
ShowIcon = false;
|
||||
Text = "StudentHouseDashboard";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label lblLogo;
|
||||
private Label lblUsername;
|
||||
private TextBox tbUsername;
|
||||
private Label lblPassword;
|
||||
private TextBox tbPassword;
|
||||
private Button btnLogin;
|
||||
}
|
||||
}
|
27
StudentHouseDashboard/WinForms/Login.cs
Normal file
27
StudentHouseDashboard/WinForms/Login.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using StudentHouseDashboard.Managers;
|
||||
using StudentHouseDashboard.Models;
|
||||
|
||||
namespace WinForms
|
||||
{
|
||||
public partial class Login : Form
|
||||
{
|
||||
public Login()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserManager userManager = new UserManager();
|
||||
User? user = userManager.AuthenticatedUser(tbUsername.Text, tbPassword.Text);
|
||||
if (user == null)
|
||||
{
|
||||
MessageBox.Show("Wrong username or password", "Login failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"Welcome, {user.Name}", "Login successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
StudentHouseDashboard/WinForms/Login.resx
Normal file
60
StudentHouseDashboard/WinForms/Login.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
17
StudentHouseDashboard/WinForms/Program.cs
Normal file
17
StudentHouseDashboard/WinForms/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace WinForms
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Login());
|
||||
}
|
||||
}
|
||||
}
|
15
StudentHouseDashboard/WinForms/WinForms.csproj
Normal file
15
StudentHouseDashboard/WinForms/WinForms.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HouseData\StudentHouseDashboard.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user