CreatePerson UI tillaggt

This commit is contained in:
2020-05-17 20:30:24 +02:00
parent c13e2f3ccb
commit 94056f5f08
8 changed files with 180 additions and 3 deletions

View File

@ -0,0 +1,79 @@
using Caliburn.Micro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TrackerLibrary;
using TrackerLibrary.Models;
namespace TrackerWPFUI.ViewModels
{
public class CreatePersonViewModel:Screen
{
private string _firstName="";
private string _lastName = "";
private string _email = "";
private string _cellphone = "";
public string FirstName
{
get { return _firstName; }
set { _firstName = value;
NotifyOfPropertyChange(() => FirstName);
}
}
public string LastName
{
get { return _lastName; }
set { _lastName = value;
NotifyOfPropertyChange(() => LastName);
}
}
public string Email
{
get { return _email; }
set { _email = value;
NotifyOfPropertyChange(() => Email);
}
}
public string Cellphone
{
get { return _cellphone; }
set { _cellphone = value;
NotifyOfPropertyChange(() => Cellphone);
}
}
public bool CanCreatePerson(string firstName, string lastName, string email, string cellphone)
{
if(firstName.Length>0 && lastName.Length>0 && email.Length>0 && cellphone.Length > 0)
{
return true;
}
else
{
return false;
}
}
public void CreatePerson(string firstName, string lastName, string email,string cellphone)
{
PersonModel p = new PersonModel();
p.FirstName = firstName;
p.LastName = lastName;
p.EmailAddress = email;
p.CellPhoneNumber = cellphone;
GlobalConfig.Connection.CreatePerson(p);
//TODO - Send results back to parent and close
}
}
}

View File

@ -18,7 +18,8 @@ namespace TrackerWPFUI.ViewModels
GlobalConfig.InitializeConnections(DatabaseType.Sql);
_existingTournaments = new BindableCollection<TournamentModel>(GlobalConfig.Connection.GetTournament_All());
//ActivateItem(new CreatePrizeViewModel());
ActivateItem(new CreateTeamViewModel());
//ActivateItem(new CreateTeamViewModel());
ActivateItem(new CreatePersonViewModel());
}
public void CreateTournament()
{