Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
96 changes: 88 additions & 8 deletions BSCpE_ProgramHeadSetup.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Imports System.Resources
Imports System.IO
Imports System.Net
Imports System.Resources
Imports System.Text.RegularExpressions
Imports Svg

Public Class BSCpE_ProgramHeadSetup
Expand Down Expand Up @@ -35,7 +38,7 @@ Public Class BSCpE_ProgramHeadSetup
Me.FormPanel.Controls.Add(Logo)

Dim Intro As New Transparent.Label With {
.Text = "Continue by registering the BSCpE Program head.",
.Text = "Continue by registering the BSCpE Program Head.",
.MaximumSize = New Size(Me.FormPanel.Width, 0),
.MinimumSize = New Size(Me.FormPanel.Width, 0),
.AutoSize = True,
Expand All @@ -45,11 +48,22 @@ Public Class BSCpE_ProgramHeadSetup
}
Me.FormPanel.Controls.Add(Intro)

Dim NameInput As New BaseTextInput With {
.Name = "Name",
Dim NamePanel As New Transparent.Panel With {
.Size = New Size(Me.FormPanel.Width - Globals.Unit(2), Globals.Unit(1))
}
Me.FormPanel.Controls.Add(NameInput)
Me.FormPanel.Controls.Add(NamePanel)
Dim FirstNameInput As New BaseTextInput With {
.Name = "First Name",
.Size = New Size((NamePanel.Width / 2) - Globals.Unit(0.25), Globals.Unit(1))
}
FirstNameInput.Location = New Point(0, 0)
NamePanel.Controls.Add(FirstNameInput)
Dim LastNameInput As New BaseTextInput With {
.Name = "Last Name",
.Size = New Size((NamePanel.Width / 2) - Globals.Unit(0.25), Globals.Unit(1))
}
LastNameInput.Location = New Point(NamePanel.Width - LastNameInput.Width, 0)
NamePanel.Controls.Add(LastNameInput)
Dim EmailInput As New BaseTextInput With {
.Name = "Email",
.Size = New Size(Me.FormPanel.Width - Globals.Unit(2), Globals.Unit(1))
Expand All @@ -70,11 +84,77 @@ Public Class BSCpE_ProgramHeadSetup

Dim ContinueButton As New BaseButton With {
.Text = "Continue",
.Name = "Continue"
.Name = "Continue",
.Size = New Size(Me.FormPanel.Width - Globals.Unit(2), Globals.Unit(1))
}
Me.FormPanel.Controls.Add(ContinueButton)
AddHandler ContinueButton.Click, Sub()
Me.GoToForm(New BSCpE_SetupData)
If FirstNameInput.Text = "" And FirstNameInput.Text.Length < 3 Then
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = "First Name must be at least 3 characters."
}
Modal.ShowDialog()
FirstNameInput.Alert()
Exit Sub
End If
If LastNameInput.Text = "" And LastNameInput.Text.Length < 2 Then
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = "Last Name must be at least 2 characters."
}
Modal.ShowDialog()
LastNameInput.Alert()
Exit Sub
End If
If EmailInput.Text = "" And Not New Regex("^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$").IsMatch(EmailInput.Text) Then
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = "Invalid email address."
}
Modal.ShowDialog()
EmailInput.Alert()
Exit Sub
End If
If PasswordInput.Text = "" And PasswordInput.Text.Length < 8 Then
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = "Password must be at least 8 characters."
}
Modal.ShowDialog()
PasswordInput.Alert()
Exit Sub
End If
If PasswordInput.Text <> ConfirmPasswordInput.Text Then
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = "Passwords do not match."
}
Modal.ShowDialog()
ConfirmPasswordInput.Alert()
Exit Sub
End If

Dim data As New Dictionary(Of String, String) From {
{"firstName", FirstNameInput.Text},
{"lastName", LastNameInput.Text},
{"email", EmailInput.Text},
{"password", PasswordInput.Text},
{"role", "bscpe"}
}
Try
Dim response As String = Globals.API("POST", "setup/admin", Globals.DictionaryToJSON(data))
Me.GoToForm(New BSCpE_SetupData)
Catch ex As WebException
Dim rep As HttpWebResponse = ex.Response
Using rdr As New StreamReader(rep.GetResponseStream())
Dim Modal As New BaseModal With {
.Title = "Error",
.Message = rep.StatusCode & ": " & rdr.ReadToEnd()
}
Modal.ShowDialog()
End Using
End Try
End Sub


Expand Down Expand Up @@ -122,7 +202,7 @@ Public Class BSCpE_ProgramHeadSetup


Dim Background As New Bitmap(Me.Contents.Width, Me.Contents.Height)
Dim SetupGraphics = Globals.LoadSvgFromResource("Setup Graphics").Draw()
Dim SetupGraphics = Globals.LoadSvgFromResource("BSCpE Setup Graphics").Draw()
Dim HalfTrapezoid = Globals.LoadSvgFromResource("Half Trapezoid").Draw()
Dim BarCompliment_Top = Globals.LoadSvgFromResource("Bar Complement").Draw()
Dim Bar_Top = Globals.LoadSvgFromResource("Bar").Draw()
Expand Down
Loading