Implement formload and admin button
This commit is contained in:
parent
0b8f630fc5
commit
3435e6161a
17
frmMainForm.Designer.cs
generated
17
frmMainForm.Designer.cs
generated
@ -29,13 +29,28 @@ namespace GreatHomeChildcare
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.btnAdmin = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
// btnAdmin
|
||||||
|
//
|
||||||
|
this.btnAdmin.Enabled = false;
|
||||||
|
this.btnAdmin.Location = new System.Drawing.Point(675, 12);
|
||||||
|
this.btnAdmin.Name = "btnAdmin";
|
||||||
|
this.btnAdmin.Size = new System.Drawing.Size(113, 41);
|
||||||
|
this.btnAdmin.TabIndex = 0;
|
||||||
|
this.btnAdmin.TabStop = false;
|
||||||
|
this.btnAdmin.Text = ">>ADMIN<<";
|
||||||
|
this.btnAdmin.UseVisualStyleBackColor = true;
|
||||||
|
this.btnAdmin.Visible = false;
|
||||||
|
this.btnAdmin.Click += new System.EventHandler(this.btnAdmin_Click);
|
||||||
|
//
|
||||||
// frmMainForm
|
// frmMainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.btnAdmin);
|
||||||
this.Name = "frmMainForm";
|
this.Name = "frmMainForm";
|
||||||
this.Text = "Main Screen";
|
this.Text = "Main Screen";
|
||||||
this.Load += new System.EventHandler(this.frmMainForm_Load);
|
this.Load += new System.EventHandler(this.frmMainForm_Load);
|
||||||
@ -44,5 +59,7 @@ namespace GreatHomeChildcare
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button btnAdmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,11 +7,16 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using GreatHomeChildcare.Models;
|
||||||
|
|
||||||
namespace GreatHomeChildcare
|
namespace GreatHomeChildcare
|
||||||
{
|
{
|
||||||
public partial class frmMainForm : Form
|
public partial class frmMainForm : Form
|
||||||
{
|
{
|
||||||
|
//globals for cheap access.
|
||||||
|
SqliteDataAccess SqliteDataAccess = new SqliteDataAccess();
|
||||||
|
Guardian guardian = new Guardian();
|
||||||
|
|
||||||
public frmMainForm()
|
public frmMainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -21,7 +26,35 @@ namespace GreatHomeChildcare
|
|||||||
//TODO: Add admin button if guardian isAdmin = 1
|
//TODO: Add admin button if guardian isAdmin = 1
|
||||||
private void frmMainForm_Load(object sender, EventArgs e)
|
private void frmMainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
int guardian_pin = Int32.Parse(frmPinEntry.strPin);
|
||||||
|
guardian = SqliteDataAccess.GetGuardianByPin(guardian_pin);
|
||||||
|
List<Child> children = SqliteDataAccess.GetChildrenByGuardian(guardian);
|
||||||
|
|
||||||
|
//TODO: remove once valid login check is implemented
|
||||||
|
if (guardian == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//If the guardian is an admin user, enable the button for crud operations.
|
||||||
|
if (guardian.isAdmin == 1)
|
||||||
|
{
|
||||||
|
btnAdmin.Visible = true;
|
||||||
|
btnAdmin.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//For each child, present a new button to sign the student in/out.
|
||||||
|
foreach (Child c in children)
|
||||||
|
{
|
||||||
|
//Button b = new Button();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: remove once I figure out how to add new button, perhaps to a table layout panel.
|
||||||
|
Console.WriteLine("test");
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: implement via another form.
|
||||||
|
private void btnAdmin_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("The admin button was clicked.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user