Personmodel handled as dbtabel and as file
This commit is contained in:
19
TrackerUI/CreateTeamForm.Designer.cs
generated
19
TrackerUI/CreateTeamForm.Designer.cs
generated
@ -37,7 +37,7 @@
|
||||
this.selectTeamMemberLabel = new System.Windows.Forms.Label();
|
||||
this.addNewMemberGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.createMemberButton = new System.Windows.Forms.Button();
|
||||
this.cellPhoneNumber = new System.Windows.Forms.TextBox();
|
||||
this.cellphoneValue = new System.Windows.Forms.TextBox();
|
||||
this.cellPhoneLabel = new System.Windows.Forms.Label();
|
||||
this.emailValue = new System.Windows.Forms.TextBox();
|
||||
this.emailLabel = new System.Windows.Forms.Label();
|
||||
@ -116,7 +116,7 @@
|
||||
// addNewMemberGroupBox
|
||||
//
|
||||
this.addNewMemberGroupBox.Controls.Add(this.createMemberButton);
|
||||
this.addNewMemberGroupBox.Controls.Add(this.cellPhoneNumber);
|
||||
this.addNewMemberGroupBox.Controls.Add(this.cellphoneValue);
|
||||
this.addNewMemberGroupBox.Controls.Add(this.cellPhoneLabel);
|
||||
this.addNewMemberGroupBox.Controls.Add(this.emailValue);
|
||||
this.addNewMemberGroupBox.Controls.Add(this.emailLabel);
|
||||
@ -147,14 +147,15 @@
|
||||
this.createMemberButton.TabIndex = 20;
|
||||
this.createMemberButton.Text = "Create Member";
|
||||
this.createMemberButton.UseVisualStyleBackColor = true;
|
||||
this.createMemberButton.Click += new System.EventHandler(this.createMemberButton_Click);
|
||||
//
|
||||
// cellPhoneNumber
|
||||
// cellphoneValue
|
||||
//
|
||||
this.cellPhoneNumber.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cellPhoneNumber.Location = new System.Drawing.Point(183, 169);
|
||||
this.cellPhoneNumber.Name = "cellPhoneNumber";
|
||||
this.cellPhoneNumber.Size = new System.Drawing.Size(185, 35);
|
||||
this.cellPhoneNumber.TabIndex = 16;
|
||||
this.cellphoneValue.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cellphoneValue.Location = new System.Drawing.Point(183, 169);
|
||||
this.cellphoneValue.Name = "cellphoneValue";
|
||||
this.cellphoneValue.Size = new System.Drawing.Size(185, 35);
|
||||
this.cellphoneValue.TabIndex = 16;
|
||||
//
|
||||
// cellPhoneLabel
|
||||
//
|
||||
@ -301,7 +302,7 @@
|
||||
private System.Windows.Forms.Label selectTeamMemberLabel;
|
||||
private System.Windows.Forms.GroupBox addNewMemberGroupBox;
|
||||
private System.Windows.Forms.Button createMemberButton;
|
||||
private System.Windows.Forms.TextBox cellPhoneNumber;
|
||||
private System.Windows.Forms.TextBox cellphoneValue;
|
||||
private System.Windows.Forms.Label cellPhoneLabel;
|
||||
private System.Windows.Forms.TextBox emailValue;
|
||||
private System.Windows.Forms.Label emailLabel;
|
||||
|
||||
@ -7,6 +7,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TrackerLibrary;
|
||||
using TrackerLibrary.Models;
|
||||
|
||||
namespace TrackerUI
|
||||
{
|
||||
@ -16,5 +18,54 @@ namespace TrackerUI
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void createMemberButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ValidateForm())
|
||||
{
|
||||
PersonModel p = new PersonModel();
|
||||
|
||||
p.FirstName = firstNameValue.Text;
|
||||
p.LastName = lastNameValue.Text;
|
||||
p.EmailAddress = emailValue.Text;
|
||||
p.CellPhoneNumber = cellphoneValue.Text;
|
||||
|
||||
GlobalConfig.Connection.CreatePerson(p);
|
||||
|
||||
firstNameValue.Text = string.Empty;
|
||||
lastNameValue.Text = string.Empty;
|
||||
emailValue.Text = string.Empty;
|
||||
cellphoneValue.Text = string.Empty;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("You need to fill in all of the fiealds.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool ValidateForm()
|
||||
{
|
||||
// TODO - add validation to the form
|
||||
if(firstNameValue.Text.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (lastNameValue.Text.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (emailValue.Text.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (cellphoneValue.Text.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TrackerUI
|
||||
|
||||
// Initialize the database connections
|
||||
GlobalConfig.InitializeConnections(DatabaseType.TextFile);
|
||||
Application.Run(new CreatePrizeForm());
|
||||
Application.Run(new CreateTeamForm());
|
||||
|
||||
//Application.Run(new TournamentDashboardForm());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user