Implement formload and admin button
This commit is contained in:
parent
0b8f630fc5
commit
3435e6161a
|
@ -29,13 +29,28 @@ namespace GreatHomeChildcare
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnAdmin = new System.Windows.Forms.Button();
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.btnAdmin);
|
||||
this.Name = "frmMainForm";
|
||||
this.Text = "Main Screen";
|
||||
this.Load += new System.EventHandler(this.frmMainForm_Load);
|
||||
|
@ -44,5 +59,7 @@ namespace GreatHomeChildcare
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnAdmin;
|
||||
}
|
||||
}
|
|
@ -7,11 +7,16 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using GreatHomeChildcare.Models;
|
||||
|
||||
namespace GreatHomeChildcare
|
||||
{
|
||||
public partial class frmMainForm : Form
|
||||
{
|
||||
//globals for cheap access.
|
||||
SqliteDataAccess SqliteDataAccess = new SqliteDataAccess();
|
||||
Guardian guardian = new Guardian();
|
||||
|
||||
public frmMainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -21,7 +26,35 @@ namespace GreatHomeChildcare
|
|||
//TODO: Add admin button if guardian isAdmin = 1
|
||||
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